From 1c7a70ecdcf56e85a4083a5d9f7bf8c00eccf4cb Mon Sep 17 00:00:00 2001 From: nickedyer Date: Sat, 18 Feb 2023 22:33:32 -0500 Subject: [PATCH] made it work --- colors/main.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 colors/main.py diff --git a/colors/main.py b/colors/main.py new file mode 100644 index 0000000..8eda80d --- /dev/null +++ b/colors/main.py @@ -0,0 +1,53 @@ +import time + +import pygame + + +def game(): + """ + Starts the game. + """ + pygame.init() + + # Hide the cursor for the Pi display. + pygame.mouse.set_visible(False) + + # The game 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 = 700 + + window = pygame.display.set_mode((screen_size, screen_size)) + surface = pygame.Surface((screen_size, screen_size)) + + clock = pygame.time.Clock() + + def draw(): + """ + Draws the main pygame display. + """ + + # Draws all the sprites on screen and scales the screen to the correct size from the rendered size. + frame = pygame.transform.scale(surface, (screen_size, screen_size)) + window.blit(frame, frame.get_rect()) + + # Update the entire display. + pygame.display.flip() + + window.fill((255, 0, 0)) + pygame.display.flip() + time.sleep(0.5) + window.fill((0, 255, 0)) + pygame.display.flip() + time.sleep(0.5) + window.fill((0, 0, 255)) + pygame.display.flip() + time.sleep(0.5) + window.fill((255, 255, 255)) + pygame.display.flip() + time.sleep(0.5) + window.fill((0, 0, 0)) + pygame.display.flip() + time.sleep(0.5) + pygame.quit() + +game()