screen-color-flash/colors/main.py

40 lines
900 B
Python

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 = 720
window = pygame.display.set_mode((screen_size, screen_size))
surface = pygame.Surface((screen_size, screen_size))
clock = pygame.time.Clock()
while True:
clock.tick(60)
window.fill((0, 0, 0))
mouse_pos = pygame.mouse.get_pos()
pygame.draw.line(window, (255, 255, 255), (720/2, 720/2), mouse_pos, 5)
pygame.display.flip()
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
pygame.quit()
game()