From 765362a492bd41cec9cf50bb3ad8ce5469e3a6d1 Mon Sep 17 00:00:00 2001 From: Skullheadx <704277@pdsb.net> Date: Tue, 24 Jan 2023 17:07:31 -0500 Subject: [PATCH] basic window display --- display.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 display.py diff --git a/display.py b/display.py new file mode 100644 index 0000000..17038d3 --- /dev/null +++ b/display.py @@ -0,0 +1,38 @@ +import pygame + +pygame.init() + +BLACK = (0, 0, 0) +GRAY = (128, 128, 128) +WHITE = (255, 255, 255) + + +class Display: + WIDTH, HEIGHT = 640, 640 + DIMENSIONS = (WIDTH, HEIGHT) + FPS = 60 + + def __init__(self): + self.screen = pygame.display.set_mode(self.DIMENSIONS) + self.clock = pygame.time.Clock() + + def show(self): + is_running = True + + while is_running: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + is_running = False + + self.update() + self.draw(self.screen) + + pygame.display.flip() + + pygame.quit() + + def update(self): + delta = self.clock.tick(self.FPS) + + def draw(self, surf): + self.screen.fill(GRAY) -- 2.54.0