diff options
| author | max-001 <maxsmits21@kpnmail.nl> | 2024-12-06 09:56:54 +0100 | 
|---|---|---|
| committer | max-001 <maxsmits21@kpnmail.nl> | 2024-12-06 09:56:54 +0100 | 
| commit | cbd7663b7f9cf7bf2b498f54b5d86c2ca37a5188 (patch) | |
| tree | 8724000b9550e5000990ebb9d7ee28bf8cab12d9 | |
| parent | 5835e478ff8c9417b5b12c8fe2e21cc0311991be (diff) | |
Modified game loop
| -rw-r--r-- | src/crepe/api/LoopManager.cpp | 16 | 
1 files changed, 4 insertions, 12 deletions
| diff --git a/src/crepe/api/LoopManager.cpp b/src/crepe/api/LoopManager.cpp index 2f8a0a7..90308a7 100644 --- a/src/crepe/api/LoopManager.cpp +++ b/src/crepe/api/LoopManager.cpp @@ -40,6 +40,7 @@ void LoopManager::fixed_update() {  	EventManager & ev = this->mediator.event_manager;  	ev.dispatch_events();  	this->get_system<ScriptSystem>().update(); +	this->get_system<AISystem>().update();  	this->get_system<PhysicsSystem>().update();  	this->get_system<CollisionSystem>().update();  } @@ -50,22 +51,17 @@ void LoopManager::loop() {  	while (game_running) {  		timer.update(); -		 +  		while (timer.get_lag() >= timer.get_fixed_delta_time()) {  			this->process_input();  			this->fixed_update();  			timer.advance_fixed_update();  		} -		 +  		this->update();  		this->render();  		timer.enforce_frame_rate(); - -		// Stop the game after 10 seconds, for testing purposes -		if (timer.get_current_time() > 10) { -			this->game_running = false; -		}  	}  } @@ -75,7 +71,6 @@ void LoopManager::setup() {  	this->scene_manager.load_next_scene();  	timer.start();  	timer.set_fps(200); -	this->scene_manager.load_next_scene();  }  void LoopManager::render() { @@ -84,7 +79,4 @@ void LoopManager::render() {  	this->get_system<RenderSystem>().update();  } -void LoopManager::update() { -	this->get_system<AnimatorSystem>().update(); -	this->get_system<AISystem>().update(); -} +void LoopManager::update() { this->get_system<AnimatorSystem>().update(); } |