Key handler does not depend on curses's screen anymore
This commit is contained in:
@ -53,9 +53,10 @@ class Game:
|
||||
screen.refresh()
|
||||
self.display_refresh()
|
||||
key = screen.getkey()
|
||||
self.handle_key_pressed(KeyValues.translate_key(key, self.settings))
|
||||
self.handle_key_pressed(
|
||||
*KeyValues.translate_key(key, self.settings))
|
||||
|
||||
def handle_key_pressed(self, key: KeyValues) -> None:
|
||||
def handle_key_pressed(self, key: KeyValues, raw_key: str = '') -> None:
|
||||
"""
|
||||
Indicates what should be done when the given key is pressed,
|
||||
according to the current game state.
|
||||
@ -65,7 +66,7 @@ class Game:
|
||||
elif self.state == GameMode.MAINMENU:
|
||||
self.main_menu.handle_key_pressed(key, self)
|
||||
elif self.state == GameMode.SETTINGS:
|
||||
self.settings_menu.handle_key_pressed(key, self.settings)
|
||||
self.settings_menu.handle_key_pressed(key, raw_key, self)
|
||||
self.display_refresh()
|
||||
|
||||
def handle_key_pressed_play(self, key: KeyValues) -> None:
|
||||
|
Reference in New Issue
Block a user