Add "back" button in settings menu

This commit is contained in:
Yohann D'ANELLO 2020-11-11 23:10:49 +01:00
parent ddf0b21e37
commit ffa1ea01b1

View File

@ -70,6 +70,8 @@ class SettingsMenu(Menu):
self.values.append("")
self.values.append("Changer le pack de textures n'aura effet")
self.values.append("qu'après avoir relancé le jeu.")
self.values.append("")
self.values.append("Retour (espace)")
def handle_key_pressed(self, key: Optional[KeyValues], raw_key: str,
game: Any) -> None:
@ -77,7 +79,9 @@ class SettingsMenu(Menu):
For now, in the settings mode, we can only go backwards.
"""
if not self.waiting_for_key:
if key == KeyValues.SPACE:
if key == KeyValues.SPACE or \
key == KeyValues.ENTER and \
self.position == len(self.values) - 1:
game.state = GameMode.MAINMENU
if key == KeyValues.DOWN:
self.go_down()