Update main.py

main
Filips Kalniņš 2026-02-11 07:52:15 +00:00
parent e9c27990f1
commit c01488d85c
1 changed files with 9 additions and 40 deletions

49
main.py
View File

@ -1,43 +1,12 @@
import sys
import pygame
from settings import *
import traceback
from game import Game
def initialize_pygame():
pygame.init()
# Optional: control vsync if supported
flags = pygame.SCALED
if VSYNC:
flags |= pygame.DOUBLEBUF
screen = pygame.display.set_mode(
(SCREEN_WIDTH, SCREEN_HEIGHT),
flags
)
pygame.display.set_caption(GAME_TITLE)
return screen
def main():
try:
screen = initialize_pygame()
game = Game()
game.run()
except Exception as e:
print("An error occurred:")
print(e)
finally:
pygame.quit()
sys.exit()
if __name__ == "__main__":
main()
try:
print("Starting game...")
game = Game()
print("Game initialized.")
game.run()
except Exception:
print("An error occurred:")
traceback.print_exc()