mirror of
https://github.com/kristoferssolo/2048.git
synced 2025-10-21 15:20:35 +00:00
feat(game): render screen
This commit is contained in:
parent
45a1f690b7
commit
1912d6458d
11
main.py
Executable file
11
main.py
Executable 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
0
src/py2048/__init__.py
Normal file
26
src/py2048/game.py
Normal file
26
src/py2048/game.py
Normal 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()
|
||||
Loading…
Reference in New Issue
Block a user