Merge remote-tracking branch 'origin/Time' into UI

This commit is contained in:
Michał Czekański 2020-04-05 21:56:00 +02:00
commit 097dbf1bf4

View File

@ -36,6 +36,11 @@ class Game:
print("The screen cannot be in a vertical orientation. Exiting...") print("The screen cannot be in a vertical orientation. Exiting...")
exit(1) exit(1)
# Initialize timers
self.pgTimer = pygame.time.Clock()
self.ingameTimer = Timer()
self.ingameTimer.startClock()
self.screen = Screen(self, self.config["window"]) self.screen = Screen(self, self.config["window"])
print("OK") print("OK")
@ -45,6 +50,9 @@ class Game:
def mainLoop(self): def mainLoop(self):
while self.running: while self.running:
# Update ingame clock
self.ingameTimer.updateTime(self.pgTimer.tick())
self.eventManager.handleEvents() self.eventManager.handleEvents()
self.spritesList.draw(self.screen.pygameScreen) self.spritesList.draw(self.screen.pygameScreen)
pygame.display.flip() pygame.display.flip()