implemented new selection screen

This commit is contained in:
Nick Dyer 2021-06-05 00:00:52 -04:00
parent 9e4dfdc16d
commit 639d552904

View File

@ -251,7 +251,7 @@ def game():
# The hardware is normally rendered at 80 pixels and upscaled from there. If changing displays, change the # The hardware is normally rendered at 80 pixels and upscaled from there. If changing displays, change the
# screen_size to reflect what the resolution of the new display is. # screen_size to reflect what the resolution of the new display is.
rendered_size = 80 rendered_size = 80
screen_size = 800 screen_size = 320
window = pygame.display.set_mode((screen_size, screen_size)) window = pygame.display.set_mode((screen_size, screen_size))
surface = pygame.Surface((rendered_size, rendered_size)) surface = pygame.Surface((rendered_size, rendered_size))
@ -565,12 +565,21 @@ def game():
egg.rect.y = 3 egg.rect.y = 3
all_sprites.add(egg) all_sprites.add(egg)
# Info screen for the eggs.
info = InfoText(small_font)
while running and game_state == 'egg_select' and submenu == 'egg_info': while running and game_state == 'egg_select' and submenu == 'egg_info':
pre_handler() pre_handler()
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == pygame.KEYDOWN: if event.type == pygame.KEYDOWN:
if event.key == Constants.buttons.get('j_d'):
# Scroll down on the info screen.
info.scroll_down()
if event.key == Constants.buttons.get('j_u'):
# Scroll up on the info screen.
info.scroll_up()
if event.key == Constants.buttons.get('a'): if event.key == Constants.buttons.get('a'):
# Go to an invalid hardware state if continuing. # Go to an invalid hardware state if continuing.
game_state = None game_state = None
@ -578,9 +587,8 @@ def game():
# Go back to the egg selection screen. # Go back to the egg selection screen.
submenu = 'main' submenu = 'main'
# Quick debugging for which egg is selected. # Draw the info screen.
selection_debug = small_font.render(egg.description, False, (64, 64, 64)) info.draw(surface)
surface.blit(selection_debug, (5, 35))
draw() draw()