aboutsummaryrefslogtreecommitdiff
path: root/gameloop/src/timer.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-09-26 10:38:45 +0200
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-09-26 10:38:45 +0200
commit86a7bd1aee2ee96079e00e2696a624fd6b642fa0 (patch)
tree058e11d246cdb25657e03f6b431a5c254b2a3438 /gameloop/src/timer.cpp
parent8bf919f750807060f3ac2c640b8a02300af1733c (diff)
update
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;