diff options
| author | Zoltan Szabatin <[email protected]> | 2025-05-14 21:36:56 -0700 |
|---|---|---|
| committer | Zoltan Szabatin <[email protected]> | 2025-05-14 21:36:56 -0700 |
| commit | 70a4c41a75275be6050683191e05ec1cb693ffce (patch) | |
| tree | ffa5257b21e227e17ab65d0ead0dd2851f22c97e /src/splitscreen_duo/games/game_base.py | |
| parent | switched from usb hid to cdc (diff) | |
| download | splitscreen-duo-main.tar.xz splitscreen-duo-main.zip | |
Diffstat (limited to 'src/splitscreen_duo/games/game_base.py')
| -rw-r--r-- | src/splitscreen_duo/games/game_base.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/splitscreen_duo/games/game_base.py b/src/splitscreen_duo/games/game_base.py index 8ef02ec..a539ba0 100644 --- a/src/splitscreen_duo/games/game_base.py +++ b/src/splitscreen_duo/games/game_base.py @@ -24,6 +24,9 @@ class GameBase: self.BLACK = (0, 0, 0) self.WHITE = (255, 255, 255) self.input_handler = Input(debug=os.getenv("DEVELOPMENT", "").lower() != "") + self.screen_width = screen.get_width() + self.screen_height = screen.get_height() + self.is_vertical = is_joint_mode def handle_common_events(self, event): action = self.input_handler.get_input(event) @@ -93,7 +96,21 @@ class GameBase: + b"\n" ) + def update_screen_dimensions(self): + current_width = self.screen.get_width() + current_height = self.screen.get_height() + + if (current_width != self.screen_width or current_height != self.screen_height): + self.screen_width = current_width + self.screen_height = current_height + self.is_vertical = current_height > current_width * 1.5 + + self.reset() + logger.debug(f"screen dimensions updated: {self.screen_width}x{self.screen_height}, vertical: {self.is_vertical}") + def update(self): + self.update_screen_dimensions() + if self.is_joint_mode: return None |