changed flipping to be done at the end of the game routine

This commit is contained in:
Patrick Tschuchnig 2019-09-11 13:36:08 +02:00
parent a337c279f7
commit 8afb7765a5

View File

@ -446,7 +446,6 @@ while True:
# draw rectangle border around everything # draw rectangle border around everything
pygame.draw.rect(screen,pygame_color_black, (500, 200, (screen_size_x-500*2), (screen_size_y-200*2)), 5) pygame.draw.rect(screen,pygame_color_black, (500, 200, (screen_size_x-500*2), (screen_size_y-200*2)), 5)
if game_running == False and game_ending == False: if game_running == False and game_ending == False:
# one shot for changing the led colour # one shot for changing the led colour
if game_just_started == True: if game_just_started == True:
@ -488,7 +487,7 @@ while True:
screen.blit(score3_surface, score3_rectangle) screen.blit(score3_surface, score3_rectangle)
# display everything # display everything
pygame.display.flip() #pygame.display.flip()
# event handling for if the start button is pushed # event handling for if the start button is pushed
if GPIO.input(pin_start) == True and pin_start_inhibit == False: #wait for the user to press start button if GPIO.input(pin_start) == True and pin_start_inhibit == False: #wait for the user to press start button
@ -552,7 +551,7 @@ while True:
screen.blit(header_surface, header_rectangle) #header screen.blit(header_surface, header_rectangle) #header
# display everything # display everything
pygame.display.flip() #pygame.display.flip()
# if another push of start is detected (i.e. the game is ending!) # if another push of start is detected (i.e. the game is ending!)
if GPIO.input(pin_start) == True and pin_start_inhibit == False: if GPIO.input(pin_start) == True and pin_start_inhibit == False:
@ -592,7 +591,7 @@ while True:
screen.blit(header_surface, header_rectangle) #header screen.blit(header_surface, header_rectangle) #header
# display everything # display everything
pygame.display.flip() #pygame.display.flip()
# unneeded timer, replaced by tick based system # unneeded timer, replaced by tick based system
#time.sleep(5) #time.sleep(5)
@ -620,6 +619,7 @@ while True:
# this state is never supposed to be reached # this state is never supposed to be reached
pass pass
pygame.display.flip()
pygame.display.update() pygame.display.update()
pygame_clock.tick(pygame_fps) pygame_clock.tick(pygame_fps)