From a8674f073e3f60b0ad032ad46141c378938b8a43 Mon Sep 17 00:00:00 2001 From: Nicholas Dyer Date: Thu, 11 May 2023 15:31:36 -0400 Subject: [PATCH] added documentation to input_handler.py --- pocket_friends/game_files/io_helpers/input_handler.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pocket_friends/game_files/io_helpers/input_handler.py b/pocket_friends/game_files/io_helpers/input_handler.py index 4509c29..3a45db7 100644 --- a/pocket_friends/game_files/io_helpers/input_handler.py +++ b/pocket_friends/game_files/io_helpers/input_handler.py @@ -4,8 +4,15 @@ from pocket_friends.game_files.io_helpers.gpio_handler import Constants, GPIOHan class InputHandler: + """ + Class that is implemented into surfaces in order to control the + pressing of buttons on both the real hardware and on a keyboard. + """ + def __init__(self, pygame_clock): self.clock = pygame_clock + + # If not on actual hardware, fake the GPIO in order to get it working correctly. try: importlib.util.find_spec('RPi.GPIO') import RPi.GPIO as GPIO @@ -13,6 +20,7 @@ class InputHandler: except ImportError: import pocket_friends.game_files.io_helpers.fake_gpio as GPIO self.on_hardware = False + self.last_input_tick = 0 def create_event(self, pressed_button): @@ -65,6 +73,9 @@ class InputHandler: running = False def update(self): + """ + Run the input handler and check for inputs. + """ if self.on_hardware: self.handle_gpio() else: