feat(game): render screen

This commit is contained in:
Kristofers Solo 2023-12-23 21:25:53 +02:00
parent 45a1f690b7
commit 1912d6458d
3 changed files with 37 additions and 0 deletions

11
main.py Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env python
from py2048.game import Game
def main() -> None:
Game().run()
if __name__ == "__main__":
main()

0
src/py2048/__init__.py Normal file
View File

26
src/py2048/game.py Normal file
View File

@ -0,0 +1,26 @@
import sys
import pygame
class Game:
def __init__(self) -> None:
pygame.init()
self.screen = pygame.display.set_mode((1200, 800))
pygame.display.set_caption("2048")
self.bg_color = (230, 230, 230)
def run(self) -> None:
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
self.screen.fill(self.bg_color)
pygame.display.flip()
def update(self) -> None:
pass
def render(self) -> None:
self.screen.fill((255, 255, 255))
pygame.display.flip()