summaryrefslogtreecommitdiff
path: root/pycameltris/screens/Pause.py
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2021-11-08 22:17:14 +0100
committerOlivier Gayot <olivier.gayot@sigexec.com>2021-11-08 23:02:37 +0100
commit7779e857e040733e04c95ab0b129693170df4db8 (patch)
tree53030c7cf52c0fa1ca6b5e5ea49f17d07d82add4 /pycameltris/screens/Pause.py
parent2696b7bc1b3c64ecdc161acd104978a8a648c376 (diff)
Add type hints for screen package
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'pycameltris/screens/Pause.py')
-rw-r--r--pycameltris/screens/Pause.py14
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):