From be9838af5c1dc8ce35f2de10ad282d1a2babfdd0 Mon Sep 17 00:00:00 2001 From: Moris Krajnc Date: Thu, 16 Jul 2020 10:58:01 +0200 Subject: [PATCH] cleaned code --- gametest_rev2.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/gametest_rev2.py b/gametest_rev2.py index 60192ee..6f8b78f 100644 --- a/gametest_rev2.py +++ b/gametest_rev2.py @@ -282,10 +282,6 @@ hs3_time = 300000 # initialise the game pygame.init() -#fps counter definitions -#font = pygame.font.Font('freesansbold.ttf', 30) -#clock = pygame.time.Clock() - # screen settings - autodetermined based on the initialised pygame video instance screen_size_x = pygame.display.Info().current_w screen_size_y = pygame.display.Info().current_h @@ -299,6 +295,7 @@ logoff_sound = pygame.mixer.Sound('snd/winxplogoff.wav') pygame_font_1 = pygame.font.Font('freesansbold.ttf', 90) pygame_font_2 = pygame.font.Font('freesansbold.ttf', 65) pygame_font_3 = pygame.font.Font('freesansbold.ttf', 45) +pygame_font_4 = pygame.font.Font('freesansbold.ttf', 16) # colors pygame_color_green = pygame.Color(42, 217, 13) @@ -786,11 +783,6 @@ while True: time_rectangle = time_surface.get_rect() time_rectangle.topleft = (640, 480) - # fps = font.render(str(int(clock.get_fps())), True, pygame.Color('white')) - # screen.blit(fps, (50, 50)) - # pygame.display.flip() - # clock.tick(30) - errors_surface = pygame_font_2.render('Fehler: ' + str(errors), True, pygame_font_main_color) errors_rectangle = errors_surface.get_rect() errors_rectangle.topleft = (640, 560) @@ -801,10 +793,11 @@ while True: screen.blit(errors_surface, errors_rectangle) #errors screen.blit(time_surface, time_rectangle) #time screen.blit(header_surface, header_rectangle) #header - - # display everything - #pygame.display.flip() - + + + fps = pygame_font_4.render(str(int(pygame_clock.get_fps())), True, pygame.Color('white')) + screen.blit(fps, (50, 50)) + # if another push of start is detected (i.e. the game is ending!) if not GPIO.input(pin_stop): # change led colour to red