aboutsummaryrefslogtreecommitdiff
path: root/src/crepe
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-12-06 09:56:54 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-12-06 09:56:54 +0100
commitcbd7663b7f9cf7bf2b498f54b5d86c2ca37a5188 (patch)
tree8724000b9550e5000990ebb9d7ee28bf8cab12d9 /src/crepe
parent5835e478ff8c9417b5b12c8fe2e21cc0311991be (diff)
Modified game loop
Diffstat (limited to 'src/crepe')
-rw-r--r--src/crepe/api/LoopManager.cpp16
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(); }