2023-03-09 19:44:02 +01:00
|
|
|
import pygame
|
|
|
|
from gameEventHandler import handle_game_event
|
2023-03-12 16:08:54 +01:00
|
|
|
from gameContext import GameContext
|
2023-04-03 19:26:56 +02:00
|
|
|
from startup import startup
|
2023-03-12 16:08:54 +01:00
|
|
|
from PIL import Image
|
2023-03-09 19:44:02 +01:00
|
|
|
|
|
|
|
pygame.init()
|
|
|
|
|
|
|
|
canvas = pygame.display.set_mode((800, 800))
|
|
|
|
|
|
|
|
pygame.display.set_caption("Inteligentna śmieciarka")
|
2023-04-22 11:45:32 +02:00
|
|
|
dust_car_pil = Image.open('imgs/dust_car_right.png')
|
2023-03-12 16:08:54 +01:00
|
|
|
|
2023-03-12 16:47:18 +01:00
|
|
|
game_context = GameContext()
|
2023-03-13 08:49:34 +01:00
|
|
|
game_context.dust_car_pil = dust_car_pil
|
|
|
|
game_context.dust_car_pygame = pygame.image.frombuffer(dust_car_pil.tobytes(), dust_car_pil.size, 'RGB')
|
2023-03-12 16:47:18 +01:00
|
|
|
game_context.canvas = canvas
|
|
|
|
startup(game_context)
|
2023-03-12 16:08:54 +01:00
|
|
|
|
|
|
|
|
2023-03-09 19:44:02 +01:00
|
|
|
exit = False
|
|
|
|
|
|
|
|
while not exit:
|
|
|
|
for event in pygame.event.get():
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
exit = True
|
|
|
|
else:
|
2023-03-12 16:47:18 +01:00
|
|
|
handle_game_event(event, game_context)
|
2023-03-09 19:44:02 +01:00
|
|
|
pygame.display.update()
|