mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- i_time: Add I_GetBuildTimeFrac()
.
* Currently not needed, but adding for feature parity.
This commit is contained in:
parent
2231386830
commit
be5419e77c
2 changed files with 16 additions and 1 deletions
|
@ -79,6 +79,11 @@ static uint64_t TicToNS(int tic)
|
|||
return static_cast<uint64_t>(tic) * 1'000'000'000 / GameTicRate;
|
||||
}
|
||||
|
||||
static uint64_t BuildTicToNS(int tic)
|
||||
{
|
||||
return static_cast<uint64_t>(tic) * 1'000'000'000 / 120;
|
||||
}
|
||||
|
||||
void I_SetFrameTime()
|
||||
{
|
||||
// Must only be called once per frame/swapbuffers.
|
||||
|
@ -184,6 +189,15 @@ double I_GetTimeFrac()
|
|||
return (CurrentFrameStartTime - ticStartTime) / (double)(ticNextTime - ticStartTime);
|
||||
}
|
||||
|
||||
double I_GetBuildTimeFrac()
|
||||
{
|
||||
int currentTic = NSToBuildTic(CurrentFrameStartTime - FirstFrameStartTime);
|
||||
uint64_t ticStartTime = FirstFrameStartTime + BuildTicToNS(currentTic);
|
||||
uint64_t ticNextTime = FirstFrameStartTime + BuildTicToNS(currentTic + 1);
|
||||
|
||||
return (CurrentFrameStartTime - ticStartTime) / (double)(ticNextTime - ticStartTime);
|
||||
}
|
||||
|
||||
void I_FreezeTime(bool frozen)
|
||||
{
|
||||
if (frozen)
|
||||
|
|
|
@ -12,13 +12,14 @@ int I_GetTime();
|
|||
// same, but using nanoseconds
|
||||
uint64_t I_GetTimeNS();
|
||||
|
||||
// Called by Build games in liew of totalclock, returns current time in tics at ticrate of 120.
|
||||
// Called by Build games in lieu of totalclock, returns current time in tics at ticrate of 120.
|
||||
int I_GetBuildTime();
|
||||
|
||||
// Reset timer variables to zero when called.
|
||||
void I_ResetTime();
|
||||
|
||||
double I_GetTimeFrac();
|
||||
double I_GetBuildTimeFrac();
|
||||
|
||||
// like I_GetTime, except it waits for a new tic before returning
|
||||
int I_WaitForTic(int);
|
||||
|
|
Loading…
Reference in a new issue