blob: 00749b9f612834e7b57bb2dbae3d150d7b0c6a8d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "KingSystem/System/Timer.h"
#include "KingSystem/System/VFR.h"
namespace ksys {
void Timer::update(f32* t, f32 rate) {
*t += VFR::instance()->getDeltaTime() * rate;
}
void Timer::update() {
previous_value = value;
update(&value, rate);
}
bool Timer::hasEnded(f32 end_time) const {
if (value == end_time)
return true;
return (previous_value - end_time) * (value - end_time) < 0.0;
}
} // namespace ksys
|