diff --git a/Sources/nCine/Application.cpp b/Sources/nCine/Application.cpp index 6c4f387a..d52be1cd 100644 --- a/Sources/nCine/Application.cpp +++ b/Sources/nCine/Application.cpp @@ -681,7 +681,7 @@ namespace nCine #if defined(DEATH_TARGET_WINDOWS) const std::uint64_t clockFreq = static_cast(clock().frequency()); const std::uint64_t frameTimeDuration = (clockFreq / static_cast(appCfg_.frameLimit)); - const std::int64_t remainingTime = (std::int64_t)frameTimeDuration - (std::int64_t)frameTimer_->frameIntervalAsTicks(); + const std::int64_t remainingTime = (std::int64_t)frameTimeDuration - (std::int64_t)frameTimer_->frameDurationAsTicks(); if (remainingTime > 0) { LARGE_INTEGER dueTime; dueTime.QuadPart = -(LONGLONG)((10000000ULL * remainingTime) / clockFreq); @@ -691,8 +691,8 @@ namespace nCine ::CancelWaitableTimer(_waitableTimer); } #else - const float frameTimeDuration = 1.0f / static_cast(appCfg_.frameLimit); - while (frameTimer_->frameInterval() < frameTimeDuration) { + const float frameDuration = 1.0f / static_cast(appCfg_.frameLimit); + while (frameTimer_->frameDuration() < frameDuration) { Timer::sleep(0); } #endif diff --git a/Sources/nCine/Base/FrameTimer.h b/Sources/nCine/Base/FrameTimer.h index bc6b5e50..0b43ab92 100644 --- a/Sources/nCine/Base/FrameTimer.h +++ b/Sources/nCine/Base/FrameTimer.h @@ -27,16 +27,16 @@ namespace nCine inline unsigned long int totalNumberFrames() const { return totNumFrames_; } - /// Returns the interval in seconds between the last two subsequent calls to `addFrame()` + /// Returns the last frame duration in seconds between the last two subsequent calls to `addFrame()` inline float lastFrameDuration() const { return frameDuration_; } - /// Returns the interval in seconds since the last call to `addFrame()` - inline float currentFrameDuration() const { + /// Returns current frame duration in seconds since the last call to `addFrame()` + inline float frameDuration() const { return frameStart_.secondsSince(); } - /// Returns the interval in ticks since the last call to `addFrame()` - inline uint64_t frameIntervalAsTicks() const { + /// Returns current frame duration in ticks since the last call to `addFrame()` + inline uint64_t frameDurationAsTicks() const { return frameStart_.timeSince().ticks(); } /// Returns the average FPS during the update interval