41 lines
942 B
Python
41 lines
942 B
Python
|
|
import pygame
|
||
|
|
|
||
|
|
SCREEN_WIDTH = 640
|
||
|
|
SCREEN_HEIGHT = 480
|
||
|
|
|
||
|
|
|
||
|
|
class Game:
|
||
|
|
def __init__(self):
|
||
|
|
pygame.init()
|
||
|
|
|
||
|
|
pygame.display.set_caption("School Game")
|
||
|
|
|
||
|
|
self.clock = pygame.Clock()
|
||
|
|
self.screen: pygame.Surface = pygame.display.set_mode(
|
||
|
|
(SCREEN_WIDTH, SCREEN_HEIGHT)
|
||
|
|
)
|
||
|
|
|
||
|
|
self.display: pygame.Surface = pygame.Surface(
|
||
|
|
(self.screen.get_width() // 2, self.screen.get_height() // 2)
|
||
|
|
)
|
||
|
|
|
||
|
|
self.running: bool = True
|
||
|
|
|
||
|
|
def run(self) -> None:
|
||
|
|
while self.running:
|
||
|
|
self.display.fill((0, 0, 0, 0))
|
||
|
|
|
||
|
|
for event in pygame.event.get():
|
||
|
|
if event.type == pygame.QUIT:
|
||
|
|
self.running = False
|
||
|
|
|
||
|
|
self.screen.blit(
|
||
|
|
pygame.transform.scale(self.display, self.screen.get_size())
|
||
|
|
)
|
||
|
|
|
||
|
|
pygame.display.update()
|
||
|
|
self.clock.tick(60)
|
||
|
|
|
||
|
|
|
||
|
|
game = Game()
|
||
|
|
game.run()
|