diff options
Diffstat (limited to 'pycameltris/screens/Pause.py')
-rw-r--r-- | pycameltris/screens/Pause.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pycameltris/screens/Pause.py b/pycameltris/screens/Pause.py index 1502be7..885b7f6 100644 --- a/pycameltris/screens/Pause.py +++ b/pycameltris/screens/Pause.py @@ -1,22 +1,22 @@ import contextlib import sys -from typing import NoReturn +from typing import Callable, NoReturn import pygame from .Screen import Screen -from ..controller import KeyboardController, JoystickController, Input +from ..controller import Controller, KeyboardController, JoystickController, Input from ..misc import UnPause -def handle_input_pressed(controller, event): +def handle_input_pressed(controller: Controller, event: pygame.event.Event): if controller.get_input_down(event) == Input.PAUSE: raise UnPause() class Pause(Screen): - def __init__(self, screen): - self.event_handler = dict() + def __init__(self, screen: pygame.Surface): + self.event_handler: dict[int, Callable[[pygame.event.Event], None]] = {} def exit(_) -> NoReturn: sys.exit() @@ -26,10 +26,10 @@ class Pause(Screen): self.event_handler[pygame.KEYDOWN] = lambda evt: handle_input_pressed(KeyboardController(pygame.key), evt) - def refresh(self): + def refresh(self) -> None: pass - def oneframe(self): + def oneframe(self) -> None: try: for event in pygame.event.get(): with contextlib.suppress(KeyError): |