ksys: Add Timer (header only for now)

This commit is contained in:
Léo Lam 2020-11-08 21:58:52 +01:00
parent f7e6cce7a9
commit ff3421d4eb
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
3 changed files with 29 additions and 0 deletions

View File

@ -15,4 +15,6 @@ target_sources(uking PRIVATE
StringBoard.h
SystemPauseMgr.cpp
SystemPauseMgr.h
Timer.cpp
Timer.h
)

View File

@ -0,0 +1 @@
#include "KingSystem/System/Timer.h"

View File

@ -0,0 +1,26 @@
#pragma once
#include <basis/seadTypes.h>
namespace ksys {
struct Timer {
Timer() = default;
Timer(f32 value, f32 previous_value, f32 speed = -1.0)
: value(value), previous_value(previous_value), speed(speed) {}
void reset(f32 value_, f32 speed_ = -1.0) {
value = previous_value = value_;
speed = speed_;
}
void update();
static void update(f32& t);
bool hasEnded(f32 end_time) const;
f32 value{};
f32 previous_value{};
f32 speed{};
};
} // namespace ksys