Added w and s as alternate navigation keys for libstormgames menus.

This commit is contained in:
Storm Dragon 2025-02-07 02:12:34 -05:00
parent 21216f361a
commit dd246db5be

View File

@ -687,11 +687,11 @@ def display_text(text):
if event.key in (pygame.K_ESCAPE, pygame.K_RETURN): if event.key in (pygame.K_ESCAPE, pygame.K_RETURN):
return return
if event.key == pygame.K_DOWN and currentIndex < len(text) - 1: if event.key in [pygame.K_DOWN, pygame.K_s] and currentIndex < len(text) - 1:
currentIndex += 1 currentIndex += 1
speak(text[currentIndex]) speak(text[currentIndex])
if event.key == pygame.K_UP and currentIndex > 0: if event.key in [pygame.K_UP,pygame.K_w] and currentIndex > 0:
currentIndex -= 1 currentIndex -= 1
speak(text[currentIndex]) speak(text[currentIndex])
@ -798,11 +798,11 @@ def learn_sounds(sounds):
if event.key == pygame.K_ESCAPE: if event.key == pygame.K_ESCAPE:
return "menu" return "menu"
if event.key == pygame.K_DOWN and currentIndex < len(soundFiles) - 1: if event.key == [pygame.K_DOWN, pygame.K_s] and currentIndex < len(soundFiles) - 1:
pygame.mixer.stop() pygame.mixer.stop()
currentIndex += 1 currentIndex += 1
if event.key == pygame.K_UP and currentIndex > 0: if event.key in [pygame.K_UP, pygame.K_w] and currentIndex > 0:
pygame.mixer.stop() pygame.mixer.stop()
currentIndex -= 1 currentIndex -= 1
@ -890,7 +890,7 @@ def game_menu(sounds, *options):
# Menu navigation # Menu navigation
elif event.key == pygame.K_ESCAPE: elif event.key == pygame.K_ESCAPE:
exit_game() exit_game()
elif event.key == pygame.K_DOWN and currentIndex < len(options) - 1: elif event.key in [pygame.K_DOWN, pygame.K_s] and currentIndex < len(options) - 1:
currentIndex += 1 currentIndex += 1
try: try:
sounds['menu-move'].play() sounds['menu-move'].play()
@ -898,7 +898,7 @@ def game_menu(sounds, *options):
pass pass
if options[currentIndex] != "donate": if options[currentIndex] != "donate":
pygame.mixer.music.unpause() pygame.mixer.music.unpause()
elif event.key == pygame.K_UP and currentIndex > 0: elif event.key in [pygame.K_UP, pygame.K_w] and currentIndex > 0:
currentIndex -= 1 currentIndex -= 1
try: try:
sounds['menu-move'].play() sounds['menu-move'].play()