From 519cc5d16e65ff501d330c03eeb35d2d095ead29 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Sun, 8 Dec 2024 19:49:41 +0100 Subject: made sdlcontext not a singleton anymore --- src/crepe/api/LoopTimer.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/crepe/api/LoopTimer.cpp') diff --git a/src/crepe/api/LoopTimer.cpp b/src/crepe/api/LoopTimer.cpp index 40fc94e..d6bf451 100644 --- a/src/crepe/api/LoopTimer.cpp +++ b/src/crepe/api/LoopTimer.cpp @@ -1,16 +1,16 @@ #include #include "../util/Log.h" +#include "facade/SDLContext.h" +#include "manager/Manager.h" #include "LoopTimer.h" using namespace crepe; -LoopTimer::LoopTimer() { dbg_trace(); } - -LoopTimer & LoopTimer::get_instance() { - static LoopTimer instance; - return instance; +LoopTimer::LoopTimer(Mediator & mediator) : Manager(mediator){ + dbg_trace(); + mediator.timer = *this; } void LoopTimer::start() { @@ -66,7 +66,8 @@ void LoopTimer::enforce_frame_rate() { = std::chrono::duration_cast(this->frame_target_time - frame_duration); if (delay_time.count() > 0) { - //SDLContext::get_instance().delay(delay_time.count()); + SDLContext & ctx = this->mediator.sdl_context; + ctx.delay(delay_time.count()); } } -- cgit v1.2.3