diff options
Diffstat (limited to 'gameloop/include')
-rw-r--r-- | gameloop/include/loopManager.h | 3 | ||||
-rw-r--r-- | gameloop/include/timer.h | 29 |
2 files changed, 15 insertions, 17 deletions
diff --git a/gameloop/include/loopManager.h b/gameloop/include/loopManager.h index 5ed918d..06bcd5f 100644 --- a/gameloop/include/loopManager.h +++ b/gameloop/include/loopManager.h @@ -18,9 +18,8 @@ class LoopManager{ bool gameRunning = false; WindowManager window; int timeScale = 1; - float lag = 0.0; + float accumulator = 0.0; double currentTime; double t = 0.0; double dt = 0.01; - state previous; }; 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; }; |