diff options
| author | Zoltan Szabatin <[email protected]> | 2025-03-02 22:39:48 -0800 |
|---|---|---|
| committer | Zoltan Szabatin <[email protected]> | 2025-03-02 22:39:48 -0800 |
| commit | 05061161e296ba2e54f3fc7d60a88adac9cd2761 (patch) | |
| tree | 20c3c64cb254ff08ca183c880293d434d686fc32 /src/splitscreen_duo/menu.py | |
| parent | feat(games): Use input handler (diff) | |
| download | splitscreen-duo-05061161e296ba2e54f3fc7d60a88adac9cd2761.tar.xz splitscreen-duo-05061161e296ba2e54f3fc7d60a88adac9cd2761.zip | |
feat: Add split mode toggle for debugging
Diffstat (limited to 'src/splitscreen_duo/menu.py')
| -rw-r--r-- | src/splitscreen_duo/menu.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/splitscreen_duo/menu.py b/src/splitscreen_duo/menu.py index a7bda82..9517d3d 100644 --- a/src/splitscreen_duo/menu.py +++ b/src/splitscreen_duo/menu.py @@ -17,6 +17,7 @@ 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, @@ -40,7 +41,7 @@ def draw_menu(): pygame.display.flip() -def process_events(serial, instance): +def process_events(serial, instance, is_joint_mode): global selected_index input_handler = Input(debug=IS_DEVELOPMENT_MODE) @@ -75,4 +76,22 @@ def process_events(serial, instance): elif action == "QUIT": return {"command": Command.QUIT.value, "action": None, "value": None} + if ( + event.type == pygame.KEYDOWN + and event.key == pygame.K_b + and instance == "primary" + and IS_DEVELOPMENT_MODE + ): + is_joint_mode[0] = not is_joint_mode[0] + + logger.info(f"Toggled joint mode to {is_joint_mode[0]}") + + command = ( + Command.ENTER_JOINT_MODE.value + if is_joint_mode[0] + else Command.EXIT_JOINT_MODE.value + ) + + serial.write(json.dumps({"command": command}).encode("utf-8")) + return None |