diff options
Diffstat (limited to 'cameltris/screens')
-rw-r--r-- | cameltris/screens/in_game.py | 3 | ||||
-rw-r--r-- | cameltris/screens/pause.py | 1 | ||||
-rw-r--r-- | cameltris/screens/screen.py | 1 |
3 files changed, 2 insertions, 3 deletions
diff --git a/cameltris/screens/in_game.py b/cameltris/screens/in_game.py index 242f683..5596ddb 100644 --- a/cameltris/screens/in_game.py +++ b/cameltris/screens/in_game.py @@ -15,6 +15,7 @@ from ..misc import Pause class WouldCollide(Exception): pass + class PlayerQuit(Exception): pass @@ -44,7 +45,6 @@ class Player: self.score_canvas = pygame.Surface((296, 50)) self.level_canvas = pygame.Surface((296, 50)) - def generate_piece(self) -> tuple[Piece, list[int]]: # We may want to make this a function outside the class piece = random.choice((TPiece, SPiece, IPiece, ZPiece, SquarePiece, LPiece, JPiece))() @@ -234,6 +234,7 @@ class Player: if element is not None: self.grid_canvas.blit(element, ((col_idx + self.current_piece_position[1]) * 50 + 1, (row_idx + self.current_piece_position[0]) * 50 + 1)) + def handle_input_pressed(instance, players: list[Player], event: pygame.event.Event) -> None: for player in players: if isinstance(player.controller, instance): diff --git a/cameltris/screens/pause.py b/cameltris/screens/pause.py index 2ea7849..99749f3 100644 --- a/cameltris/screens/pause.py +++ b/cameltris/screens/pause.py @@ -25,7 +25,6 @@ class Pause(Screen): self.event_handler[pygame.JOYBUTTONDOWN] = lambda evt: handle_input_pressed(JoystickController(evt.joy), evt) self.event_handler[pygame.KEYDOWN] = lambda evt: handle_input_pressed(KeyboardController(pygame.key), evt) - def refresh(self) -> None: pass diff --git a/cameltris/screens/screen.py b/cameltris/screens/screen.py index 419c1d2..87c15f4 100644 --- a/cameltris/screens/screen.py +++ b/cameltris/screens/screen.py @@ -9,4 +9,3 @@ class Screen(abc.ABC): @abc.abstractmethod def oneframe(self) -> None: pass - |