From dfa8ffbc03c4c1acd74fd14e54c6ee566a3c445c Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Wed, 11 Dec 2024 14:33:31 +0100 Subject: make format --- src/crepe/api/LoopManager.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/crepe/api/LoopManager.cpp') diff --git a/src/crepe/api/LoopManager.cpp b/src/crepe/api/LoopManager.cpp index 4ca9928..b335cad 100644 --- a/src/crepe/api/LoopManager.cpp +++ b/src/crepe/api/LoopManager.cpp @@ -1,4 +1,6 @@ #include "../facade/SDLContext.h" +#include "../manager/EventManager.h" +#include "../manager/LoopTimerManager.h" #include "../system/AISystem.h" #include "../system/AnimatorSystem.h" #include "../system/AudioSystem.h" @@ -8,8 +10,6 @@ #include "../system/PhysicsSystem.h" #include "../system/RenderSystem.h" #include "../system/ScriptSystem.h" -#include "../manager/EventManager.h" -#include "../manager/LoopTimerManager.h" #include "../util/Log.h" #include "LoopManager.h" @@ -44,18 +44,18 @@ void LoopManager::setup() { void LoopManager::loop() { try { - while (game_running) { - this->loop_timer.update(); + while (game_running) { + this->loop_timer.update(); - while (this->loop_timer.get_lag() >= this->loop_timer.get_fixed_delta_time()) { - this->fixed_update(); - this->loop_timer.advance_fixed_elapsed_time(); - } + while (this->loop_timer.get_lag() >= this->loop_timer.get_fixed_delta_time()) { + this->fixed_update(); + this->loop_timer.advance_fixed_elapsed_time(); + } - this->frame_update(); - this->loop_timer.enforce_frame_rate(); - } - }catch(const exception & e){ + this->frame_update(); + this->loop_timer.enforce_frame_rate(); + } + } catch (const exception & e) { Log::logf(Log::Level::ERROR, "Exception caught in main loop: %s", e.what()); this->event_manager.trigger_event(ShutDownEvent{}); } @@ -73,7 +73,7 @@ void LoopManager::fixed_update() { } // will be called every frame -void LoopManager::frame_update() { +void LoopManager::frame_update() { this->scene_manager.load_next_scene(); this->get_system().update(); //render -- cgit v1.2.3