class Application(object): def __init__(self): self.state_stack = StateStack() self.state_stack.push(GameState.QUIT) self.state_stack.push(GameState.MAIN_MENU) self.window = pygame.display.set_mode([800, 600]) # Window(800, 600) self.running = True self.clock = pygame.time.Clock() self.state_dict = {GameState.MAIN_MENU: Dummy()} self.input = InputManager(self.window) flock_manager.init() def run(self): while self.running: self.window.fill((0, 0, 0)) dt = self.clock.tick(60) / 1000.0 self.input.update(dt) if self.state_stack[-1] is GameState.QUIT: return if self.state_dict[self.state_stack[-1]].is_done: self.state_stack.pop() continue # Skip over the rest of this, we need to check if we quit flock_manager.update(dt) flock_manager.render(self.window) self.state_dict[self.state_stack[-1]].update(dt) self.state_dict[self.state_stack[-1]].draw(self.window) pygame.display.flip() def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): print("QUITTING")