aboutsummaryrefslogtreecommitdiff
path: root/gameloop/include/timer.h
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-09-18 16:52:54 +0200
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-09-18 16:52:54 +0200
commit8bf919f750807060f3ac2c640b8a02300af1733c (patch)
tree7bae57855fc3b98779bdfecbea141e7ec1eed68c /gameloop/include/timer.h
parent61e382cedd71127033f91551298607e2e78c3809 (diff)
gameloop poc working with variable and constant update
Diffstat (limited to 'gameloop/include/timer.h')
-rw-r--r--gameloop/include/timer.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/gameloop/include/timer.h b/gameloop/include/timer.h
index 2769e4d..a245e5c 100644
--- a/gameloop/include/timer.h
+++ b/gameloop/include/timer.h
@@ -7,25 +7,24 @@ public:
static LoopTimer& getInstance();
void start();
void update();
- float getDeltaTime() const;
- float getDeltaTimeMs() const;
- float getFixedDeltaTime() const;
+ double getDeltaTime() const;
int getCurrentTime() const;
+ void advanceFixedUpdate();
+ double getFixedDeltaTime() const;
void setFPS(int FPS);
int getFPS() const;
void enforceFrameRate();
- float getLag() const;
+ double getLag() const;
private:
LoopTimer();
- int FPS = 30;
- float frameTargetTime = FPS / 1000;
- int lastTime;
- float fixedDeltaTime = 2;
- float maxDeltaTime = 1;
- float fixedTime = 0;
- int lastFrameTime;
- float deltaTime;
- float time = 0;
- int frequency;
- float lag;
+ int FPS = 50;
+ double gameScale = 1;
+ double maximumDeltaTime = 0.25;
+ double deltaTime;
+ double frameTargetTime = FPS / 1000;
+ double fixedDeltaTime = 0.01;
+ double elapsedTime;
+ double elapsedFixedTime;
+ double time;
+ uint64_t lastFrameTime;
};