diff options
Diffstat (limited to 'src/splitscreen_duo/__init__.py')
| -rw-r--r-- | src/splitscreen_duo/__init__.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/splitscreen_duo/__init__.py b/src/splitscreen_duo/__init__.py index 9fef2eb..9689db4 100644 --- a/src/splitscreen_duo/__init__.py +++ b/src/splitscreen_duo/__init__.py @@ -9,6 +9,7 @@ import json from .games import benchmark from .games.snake import Snake from .games.breakout import Breakout +from .games.pong import Pong def main() -> int: @@ -82,6 +83,19 @@ def main() -> int: pygame.quit() return 0 + elif message.get("value") == Game.PONG.value: + logger.info("received pong game selection from primary") + + pong_game = Pong(menu.screen, serial, INSTANCE) + game_result = pong_game.main_loop() + + if ( + game_result + and game_result.get("command") == Command.QUIT.value + ): + pygame.quit() + + return 0 except json.JSONDecodeError: logger.error("failed to decode serial message") @@ -129,6 +143,16 @@ def main() -> int: pygame.quit() return 0 + elif serial_command.get("value") == Game.PONG.value: + logger.info("starting pong game") + + pong_game = Pong(menu.screen, serial, INSTANCE) + game_result = pong_game.main_loop() + + if game_result and game_result.get("command") == Command.QUIT.value: + pygame.quit() + + return 0 menu.draw_menu() |