2022-03-24 20:02:21 +01:00
|
|
|
import pygame
|
|
|
|
from pygame.locals import *
|
2022-04-25 17:26:32 +02:00
|
|
|
from Environment import Environment
|
|
|
|
from Global_variables import Global_variables as G_var
|
2022-03-24 20:02:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Program:
|
|
|
|
def __init__(self):
|
|
|
|
pygame.init()
|
2022-04-25 17:26:32 +02:00
|
|
|
self.window = pygame.display.set_mode(
|
|
|
|
(G_var().WINDOW_X, G_var().WINDOW_Y)) # decides window's size
|
|
|
|
self.environment = Environment(self.window)
|
2022-03-24 20:02:21 +01:00
|
|
|
|
|
|
|
def run(self):
|
|
|
|
running = True
|
|
|
|
while running:
|
|
|
|
for event in pygame.event.get(): # integrating with keyboard
|
2022-04-25 17:26:32 +02:00
|
|
|
if event.type == QUIT:
|
2022-03-24 20:02:21 +01:00
|
|
|
running = False
|
2022-05-08 16:43:43 +02:00
|
|
|
self.environment.update_all_elements(event)
|
2022-04-25 17:26:32 +02:00
|
|
|
self.environment.draw_all_elements()
|