Added basic events
This commit is contained in:
parent
e8a8739c9d
commit
f535da1594
@ -1,3 +1,11 @@
|
||||
import pygame
|
||||
|
||||
|
||||
class EventManager:
|
||||
def __init__(self):
|
||||
self.player
|
||||
def __init__(self, gameObject):
|
||||
self.game = gameObject
|
||||
|
||||
def handleEvents(self):
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
self.game.running = False
|
||||
|
@ -2,6 +2,7 @@ import pygame
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from game.EventManager import EventManager
|
||||
from game.Screen import Screen
|
||||
|
||||
|
||||
@ -35,10 +36,14 @@ class Game:
|
||||
self.screen = Screen(self, self.config["window"])
|
||||
print("OK")
|
||||
|
||||
self.eventManager = EventManager(self)
|
||||
|
||||
self.spritesList = pygame.sprite.Group()
|
||||
|
||||
self.mainLoop()
|
||||
|
||||
def mainLoop(self):
|
||||
while self.running:
|
||||
self.eventManager.handleEvents()
|
||||
self.spritesList.draw(self.screen.pygameScreen)
|
||||
pygame.display.flip()
|
||||
|
Loading…
Reference in New Issue
Block a user