mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-15 12:10:53 +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;
|
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()
|
void I_SetFrameTime()
|
||||||
{
|
{
|
||||||
// Must only be called once per frame/swapbuffers.
|
// Must only be called once per frame/swapbuffers.
|
||||||
|
@ -184,6 +189,15 @@ double I_GetTimeFrac()
|
||||||
return (CurrentFrameStartTime - ticStartTime) / (double)(ticNextTime - ticStartTime);
|
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)
|
void I_FreezeTime(bool frozen)
|
||||||
{
|
{
|
||||||
if (frozen)
|
if (frozen)
|
||||||
|
|
|
@ -12,13 +12,14 @@ int I_GetTime();
|
||||||
// same, but using nanoseconds
|
// same, but using nanoseconds
|
||||||
uint64_t I_GetTimeNS();
|
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();
|
int I_GetBuildTime();
|
||||||
|
|
||||||
// Reset timer variables to zero when called.
|
// Reset timer variables to zero when called.
|
||||||
void I_ResetTime();
|
void I_ResetTime();
|
||||||
|
|
||||||
double I_GetTimeFrac();
|
double I_GetTimeFrac();
|
||||||
|
double I_GetBuildTimeFrac();
|
||||||
|
|
||||||
// like I_GetTime, except it waits for a new tic before returning
|
// like I_GetTime, except it waits for a new tic before returning
|
||||||
int I_WaitForTic(int);
|
int I_WaitForTic(int);
|
||||||
|
|
Loading…
Reference in a new issue