aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/LoopTimer.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-08 19:49:41 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-08 19:49:41 +0100
commit519cc5d16e65ff501d330c03eeb35d2d095ead29 (patch)
tree3c7c3a64c922ec248f4136d1282530a6ec6647ac /src/crepe/api/LoopTimer.cpp
parent63bcd54e0e0ea64cfef5950568b4253d5dae5c1e (diff)
made sdlcontext not a singleton anymore
Diffstat (limited to 'src/crepe/api/LoopTimer.cpp')
-rw-r--r--src/crepe/api/LoopTimer.cpp13
1 files changed, 7 insertions, 6 deletions
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 <chrono>
#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<std::chrono::milliseconds>(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());
}
}