From 16444f19ae2c7c71a2be53ce6fd2e4d671aa8765 Mon Sep 17 00:00:00 2001 From: max-001 Date: Wed, 4 Dec 2024 12:15:05 +0100 Subject: Modified test and setup of AISystem --- src/crepe/api/LoopManager.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/crepe/api/LoopManager.cpp') diff --git a/src/crepe/api/LoopManager.cpp b/src/crepe/api/LoopManager.cpp index 7edf4d1..cd602d8 100644 --- a/src/crepe/api/LoopManager.cpp +++ b/src/crepe/api/LoopManager.cpp @@ -1,5 +1,6 @@ #include "../facade/SDLContext.h" +#include "../system/AISystem.h" #include "../system/AnimatorSystem.h" #include "../system/CollisionSystem.h" #include "../system/ParticleSystem.h" @@ -20,6 +21,7 @@ LoopManager::LoopManager() { this->load_system(); this->load_system(); this->load_system(); + this->load_system(); } void LoopManager::process_input() { @@ -51,6 +53,11 @@ void LoopManager::loop() { this->render(); timer.enforce_frame_rate(); + + // Stop the game after 5 seconds, for testing purposes + if (timer.get_current_time() > 5) { + this->game_running = false; + } } } @@ -58,6 +65,7 @@ void LoopManager::setup() { this->game_running = true; LoopTimer::get_instance().start(); LoopTimer::get_instance().set_fps(200); + this->scene_manager.load_next_scene(); } void LoopManager::render() { @@ -66,4 +74,8 @@ void LoopManager::render() { } } -void LoopManager::update() { LoopTimer & timer = LoopTimer::get_instance(); } +void LoopManager::update() { + LoopTimer & timer = LoopTimer::get_instance(); + this->get_system().update(); + this->get_system().update(); +} -- cgit v1.2.3 From e303bd4c54b0edbcd1819a47a5d8aaef88211a09 Mon Sep 17 00:00:00 2001 From: max-001 Date: Wed, 4 Dec 2024 17:27:30 +0100 Subject: Increased gameloop time --- src/crepe/api/LoopManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/crepe/api/LoopManager.cpp') diff --git a/src/crepe/api/LoopManager.cpp b/src/crepe/api/LoopManager.cpp index cd602d8..46831e8 100644 --- a/src/crepe/api/LoopManager.cpp +++ b/src/crepe/api/LoopManager.cpp @@ -54,8 +54,8 @@ void LoopManager::loop() { timer.enforce_frame_rate(); - // Stop the game after 5 seconds, for testing purposes - if (timer.get_current_time() > 5) { + // Stop the game after 10 seconds, for testing purposes + if (timer.get_current_time() > 10) { this->game_running = false; } } -- cgit v1.2.3 From cbd7663b7f9cf7bf2b498f54b5d86c2ca37a5188 Mon Sep 17 00:00:00 2001 From: max-001 Date: Fri, 6 Dec 2024 09:56:54 +0100 Subject: Modified game loop --- src/crepe/api/LoopManager.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/crepe/api/LoopManager.cpp') 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().update(); + this->get_system().update(); this->get_system().update(); this->get_system().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().update(); } -void LoopManager::update() { - this->get_system().update(); - this->get_system().update(); -} +void LoopManager::update() { this->get_system().update(); } -- cgit v1.2.3