mirror of
https://github.com/zeldaret/botw
synced 2026-09-09 11:44:20 -04:00
ksys: Add SystemTimers
This commit is contained in:
@@ -35,6 +35,8 @@ target_sources(uking PRIVATE
|
||||
StringBoard.h
|
||||
SystemPauseMgr.cpp
|
||||
SystemPauseMgr.h
|
||||
SystemTimers.cpp
|
||||
SystemTimers.h
|
||||
Timer.cpp
|
||||
Timer.h
|
||||
UIGlue.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
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <heap/seadDisposer.h>
|
||||
#include <heap/seadHeap.h>
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
namespace ksys {
|
||||
|
||||
class SystemTimers {
|
||||
SEAD_SINGLETON_DISPOSER(SystemTimers);
|
||||
|
||||
SystemTimers() = default;
|
||||
virtual ~SystemTimers();
|
||||
|
||||
public:
|
||||
void init();
|
||||
void init2();
|
||||
void prepareStageUnload();
|
||||
void incrementCountersAndUpdate();
|
||||
void incrementCounters();
|
||||
|
||||
unsigned int mFrameCounter = 0;
|
||||
int mFrameCounter2 = 0;
|
||||
float mVfrTimer = 0;
|
||||
int mFrameCounterB = 0;
|
||||
float mVfrTimer2 = 0;
|
||||
int mFrameCounterB2 = 0;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(SystemTimers, 0x40);
|
||||
|
||||
} // namespace ksys
|
||||
Reference in New Issue
Block a user