From 8f82ba5acd095b78fcec9d63f2977c04c778f02b Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Fri, 12 Nov 2021 14:15:43 +0100 Subject: Update name of screen modules according to PEP8 Signed-off-by: Olivier Gayot --- cameltris/screens/Pause.py | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 cameltris/screens/Pause.py (limited to 'cameltris/screens/Pause.py') diff --git a/cameltris/screens/Pause.py b/cameltris/screens/Pause.py deleted file mode 100644 index 766a45c..0000000 --- a/cameltris/screens/Pause.py +++ /dev/null @@ -1,39 +0,0 @@ -import contextlib -import sys -from typing import Callable, NoReturn - -import pygame - -from .Screen import Screen -from ..controller import Controller, KeyboardController, JoystickController, Input -from ..misc import UnPause - - -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: pygame.surface.Surface): - self.event_handler: dict[int, Callable[[pygame.event.Event], None]] = {} - - def exit(_) -> NoReturn: - sys.exit() - - self.event_handler[pygame.QUIT] = exit - 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 - - def oneframe(self) -> None: - try: - for event in pygame.event.get(): - with contextlib.suppress(KeyError): - self.event_handler[event.type](event) - except UnPause: - pygame.event.clear() - raise -- cgit v1.2.3