aboutsummaryrefslogtreecommitdiff
path: root/gameloop/src/timer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gameloop/src/timer.cpp')
-rw-r--r--gameloop/src/timer.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/gameloop/src/timer.cpp b/gameloop/src/timer.cpp
index 1e3045f..03a2dbb 100644
--- a/gameloop/src/timer.cpp
+++ b/gameloop/src/timer.cpp
@@ -25,7 +25,7 @@ void LoopTimer::update() {
if (deltaTime > maximumDeltaTime) {
deltaTime = maximumDeltaTime;
}
-
+ deltaTime *= gameScale;
elapsedTime += deltaTime;
lastFrameTime = currentFrameTime;
}
@@ -53,7 +53,12 @@ void LoopTimer::setFPS(int FPS) {
int LoopTimer::getFPS() const {
return FPS;
}
-
+void LoopTimer::setGameScale(double value){
+ gameScale = value;
+};
+double LoopTimer::getGameScale(){
+ return gameScale;
+}
void LoopTimer::enforceFrameRate() {
uint64_t currentFrameTime = SDL_GetTicks64();
double frameDuration = (currentFrameTime - lastFrameTime) / 1000.0;