allow quit by pressing esc

This commit is contained in:
Nicholas Dyer 2023-02-19 14:21:24 -05:00
parent cff537373e
commit 352e039e44

View File

@ -12,7 +12,7 @@ def rainbow_spectrum(position):
def main():
pygame.init()
clock = pygame.time.Clock()
window = pygame.display.set_mode((720, 720))
window = pygame.display.set_mode((720, 720), pygame.FULLSCREEN)
rainbow_pos = 0
running = True
@ -22,6 +22,9 @@ def main():
for keyboard_event in pygame.event.get():
if keyboard_event.type == pygame.QUIT:
running = False
if keyboard_event.type == pygame.KEYDOWN:
if keyboard_event.key == pygame.K_ESCAPE:
running = False
rainbow_pos %= 1530
window.fill(rainbow_spectrum(rainbow_pos))