diff options
| author | MonsterDruide1 <5958456@gmail.com> | 2021-08-05 01:33:20 +0200 |
|---|---|---|
| committer | MonsterDruide1 <5958456@gmail.com> | 2021-08-06 15:14:57 +0200 |
| commit | 69820471349ae5cc02543770a2f500c162a22f18 (patch) | |
| tree | 976e5d2d18d57fe51c04a276b432ea815023a2ef /src/KingSystem/System/SystemTimers.cpp | |
| parent | 0f6a9d95b5ab16c22e62291b98f0d66f76cdebd8 (diff) | |
ksys: Add SystemTimers
Diffstat (limited to 'src/KingSystem/System/SystemTimers.cpp')
| -rw-r--r-- | src/KingSystem/System/SystemTimers.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/KingSystem/System/SystemTimers.cpp b/src/KingSystem/System/SystemTimers.cpp new file mode 100644 index 00000000..4142cfd9 --- /dev/null +++ b/src/KingSystem/System/SystemTimers.cpp @@ -0,0 +1,49 @@ +#include "KingSystem/System/SystemTimers.h" + +#include "KingSystem/System/VFR.h" + +namespace ksys { + +SEAD_SINGLETON_DISPOSER_IMPL(SystemTimers) + +SystemTimers::~SystemTimers() = default; + +void SystemTimers::init() { + mVfrTimer = 0; + mFrameCounterB = 0; + mVfrTimer2 = 0; + mFrameCounterB2 = 0; + mFrameCounter = 0; + mFrameCounter2 = 0; +} + +void SystemTimers::init2() { + init(); +} + +void SystemTimers::prepareStageUnload() {} + +void SystemTimers::incrementCountersAndUpdate() { + mFrameCounter++; + mFrameCounter2++; + f32 deltaTime = VFR::instance()->getDeltaTime(); + mVfrTimer += deltaTime; + + while (mVfrTimer >= 1) { + mFrameCounterB++; + mVfrTimer--; + } + + mVfrTimer2 += deltaTime; + while (mVfrTimer2 >= 1) { + mFrameCounterB2++; + mVfrTimer2--; + } +} + +void SystemTimers::incrementCounters() { + mFrameCounter++; + mFrameCounterB++; +} + +} // namespace ksys |
