diff options
| author | Zoltan Szabatin <[email protected]> | 2025-03-02 17:55:18 -0800 |
|---|---|---|
| committer | Zoltan Szabatin <[email protected]> | 2025-03-02 17:55:18 -0800 |
| commit | 4802f7f9d965c1014c710aeb024d090845a5b7bf (patch) | |
| tree | c572d87616d6c82af35d829fc9fb2745552d29b8 /src/splitscreen_duo/menu.py | |
| parent | refactor: Move serial controller up hierarchy (diff) | |
| download | splitscreen-duo-4802f7f9d965c1014c710aeb024d090845a5b7bf.tar.xz splitscreen-duo-4802f7f9d965c1014c710aeb024d090845a5b7bf.zip | |
feat: Add proper command options
Diffstat (limited to 'src/splitscreen_duo/menu.py')
| -rw-r--r-- | src/splitscreen_duo/menu.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/splitscreen_duo/menu.py b/src/splitscreen_duo/menu.py index 7934696..76114e2 100644 --- a/src/splitscreen_duo/menu.py +++ b/src/splitscreen_duo/menu.py @@ -2,6 +2,7 @@ import sys import pygame import os from .input import Input +from .command import Command import logging import json @@ -15,7 +16,6 @@ WIDTH = HEIGHT = FONT = screen = selected_index = None def init_display(): global WIDTH, HEIGHT, FONT, screen, selected_index - WIDTH, HEIGHT = ( pygame.display.Info().current_w // 2, pygame.display.Info().current_h // 2, @@ -46,7 +46,7 @@ def process_events(serial, instance): for event in pygame.event.get(): if event.type == pygame.QUIT: - return {"command": 0, "action": "QUIT_ALL"} + return {"command": Command.QUIT.value, "action": None, "value": None} action = input_handler.get_input(event) @@ -57,13 +57,21 @@ def process_events(serial, instance): elif action == "SELECT": if OPTIONS[selected_index] == "Quit": if instance == "primary": - return {"command": 0, "action": "QUIT_ALL"} + return { + "command": Command.QUIT.value, + "action": None, + "value": None, + } else: pygame.quit() sys.exit() else: - return {"command": 0, "action": OPTIONS[selected_index]} + return { + "command": Command.SELECT_GAME.value, + "action": None, + "value": OPTIONS[selected_index], + } elif action == "QUIT": - return {"command": 0, "action": "QUIT_ALL"} + return {"command": Command.QUIT.value, "action": None, "value": None} return None |