Source code for game.__main__

import asyncio
import pygame
from game.game_manager import GameManager
from game.utils.constants import SCREEN_WIDTH, SCREEN_HEIGHT, FPS


[docs] def main(): asyncio.run(_main())
async def _main(): pygame.init() pygame.mixer.quit() # no audio assets; avoids browser MEDIA USER ACTION REQUIRED block screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) pygame.display.set_caption("Tipping Pigs") clock = pygame.time.Clock() game_manager = GameManager(screen) running = True while running: dt = clock.tick(FPS) / 1000.0 for event in pygame.event.get(): if event.type == pygame.QUIT: running = False else: game_manager.handle_event(event) if game_manager.should_quit: running = False game_manager.update(dt) screen.fill((0, 100, 200)) game_manager.render(screen) pygame.display.flip() await asyncio.sleep(0) pygame.quit() if __name__ == "__main__": main()