feat: add game loop with logging
This commit is contained in:
@@ -3,12 +3,25 @@
|
||||
import pygame
|
||||
|
||||
from constants import SCREEN_HEIGHT, SCREEN_WIDTH
|
||||
from logger import log_state
|
||||
|
||||
def main():
|
||||
"""Main method for asteroids game"""
|
||||
print(f"Starting Asteroids with pygame version: {pygame.version.ver}")
|
||||
print(f"Screen width: {SCREEN_WIDTH}")
|
||||
print(f"Screen height: {SCREEN_HEIGHT}")
|
||||
pygame.init()
|
||||
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||
|
||||
while True:
|
||||
log_state()
|
||||
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
return
|
||||
|
||||
screen.fill("black")
|
||||
pygame.display.flip()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user