Bind Return key to menus
This commit is contained in:
parent
8d9b5166b7
commit
60d6c7509a
@ -68,6 +68,8 @@ class Game:
|
||||
elif key in (self.settings.KEY_UP_PRIMARY,
|
||||
self.settings.KEY_UP_SECONDARY):
|
||||
return KeyValues.UP
|
||||
elif key == self.settings.KEY_ENTER:
|
||||
return KeyValues.ENTER
|
||||
|
||||
def handle_key_pressed(self, key: KeyValues) -> None:
|
||||
if self.state == GameMode.PLAY:
|
||||
|
@ -1,4 +1,5 @@
|
||||
from enum import Enum, auto
|
||||
from typing import Any
|
||||
|
||||
|
||||
class Menu:
|
||||
@ -13,7 +14,7 @@ class Menu:
|
||||
def go_down(self) -> None:
|
||||
self.position = min(len(self.values) - 1, self.position + 1)
|
||||
|
||||
def validate(self) -> None:
|
||||
def validate(self) -> Any:
|
||||
return self.values[self.position]
|
||||
|
||||
|
||||
|
@ -27,6 +27,8 @@ class Settings:
|
||||
['d', 'Touche principale pour aller vers la droite']
|
||||
self.KEY_RIGHT_SECONDARY = \
|
||||
['KEY_RIGHT', 'Touche secondaire pour aller vers la droite']
|
||||
self.KEY_ENTER = \
|
||||
['\n', 'Touche pour valider un menu']
|
||||
self.TEXTURE_PACK = ['ASCII', 'Pack de textures utilisé']
|
||||
|
||||
def __getattribute__(self, item: str) -> Any:
|
||||
|
Loading…
Reference in New Issue
Block a user