diff options
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 |