mirror of
https://github.com/NoelFB/blah.git
synced 2024-11-25 16:18:57 +08:00
added Time::get_ticks() to poll for an immediate value
This commit is contained in:
parent
c52258ddcd
commit
068d0778c2
|
@ -8,10 +8,10 @@ namespace Blah
|
|||
// ticks per second (microseconds, in this case)
|
||||
constexpr u64 ticks_per_second = 1000000;
|
||||
|
||||
// uptime, in ticks
|
||||
// uptime, in ticks, at the start of the current frame
|
||||
extern u64 ticks;
|
||||
|
||||
// uptime, in seconds
|
||||
// uptime, in seconds, at the start of the current frame
|
||||
extern double seconds;
|
||||
|
||||
// delta time from last frame
|
||||
|
@ -26,6 +26,9 @@ namespace Blah
|
|||
// time the application should pause for
|
||||
extern float pause_timer;
|
||||
|
||||
// uptime, in ticks. polls the Platform for an immediate value, unlike the cached `Time::ticks` value
|
||||
u64 get_ticks();
|
||||
|
||||
// pauses the entire application for the given time
|
||||
void pause_for(float duration);
|
||||
|
||||
|
|
|
@ -10,6 +10,11 @@ double Time::previous_seconds = 0;
|
|||
float Time::delta = 0;
|
||||
float Time::pause_timer = 0;
|
||||
|
||||
u64 Time::get_ticks()
|
||||
{
|
||||
return Platform::ticks();
|
||||
}
|
||||
|
||||
void Time::pause_for(float duration)
|
||||
{
|
||||
if (duration >= pause_timer)
|
||||
|
|
Loading…
Reference in New Issue
Block a user