2019-05-15 16:52:37 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class CTimer
|
|
|
|
{
|
2020-03-25 15:13:06 +01:00
|
|
|
|
2019-05-15 16:52:37 +02:00
|
|
|
static uint32 &m_snTimeInMilliseconds;
|
|
|
|
static uint32 &m_snTimeInMillisecondsPauseMode;
|
|
|
|
static uint32 &m_snTimeInMillisecondsNonClipped;
|
|
|
|
static uint32 &m_snPreviousTimeInMilliseconds;
|
|
|
|
static uint32 &m_FrameCounter;
|
|
|
|
static float &ms_fTimeScale;
|
|
|
|
static float &ms_fTimeStep;
|
|
|
|
static float &ms_fTimeStepNonClipped;
|
2020-03-25 15:13:06 +01:00
|
|
|
public:
|
2019-05-15 16:52:37 +02:00
|
|
|
static bool &m_UserPause;
|
|
|
|
static bool &m_CodePause;
|
2020-03-11 04:25:50 +01:00
|
|
|
|
2020-03-25 15:13:06 +01:00
|
|
|
static const float &GetTimeStep(void) { return ms_fTimeStep; }
|
2019-07-07 10:16:16 +02:00
|
|
|
static void SetTimeStep(float ts) { ms_fTimeStep = ts; }
|
|
|
|
static float GetTimeStepInSeconds() { return ms_fTimeStep / 50.0f; }
|
|
|
|
static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; }
|
2020-03-25 15:13:06 +01:00
|
|
|
static const float &GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; }
|
2019-07-07 10:16:16 +02:00
|
|
|
static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; }
|
2020-04-11 12:21:21 +02:00
|
|
|
static float GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; }
|
2019-07-07 10:16:16 +02:00
|
|
|
static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; }
|
2020-03-25 15:13:06 +01:00
|
|
|
static const uint32 &GetFrameCounter(void) { return m_FrameCounter; }
|
2019-07-07 10:16:16 +02:00
|
|
|
static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; }
|
2020-03-25 15:13:06 +01:00
|
|
|
static const uint32 &GetTimeInMilliseconds(void) { return m_snTimeInMilliseconds; }
|
2019-07-07 10:16:16 +02:00
|
|
|
static void SetTimeInMilliseconds(uint32 t) { m_snTimeInMilliseconds = t; }
|
2019-06-25 00:42:23 +02:00
|
|
|
static uint32 GetTimeInMillisecondsNonClipped(void) { return m_snTimeInMillisecondsNonClipped; }
|
2019-07-07 10:16:16 +02:00
|
|
|
static void SetTimeInMillisecondsNonClipped(uint32 t) { m_snTimeInMillisecondsNonClipped = t; }
|
2019-06-25 00:42:23 +02:00
|
|
|
static uint32 GetTimeInMillisecondsPauseMode(void) { return m_snTimeInMillisecondsPauseMode; }
|
2019-07-07 10:16:16 +02:00
|
|
|
static void SetTimeInMillisecondsPauseMode(uint32 t) { m_snTimeInMillisecondsPauseMode = t; }
|
2019-06-25 00:42:23 +02:00
|
|
|
static uint32 GetPreviousTimeInMilliseconds(void) { return m_snPreviousTimeInMilliseconds; }
|
2019-07-07 10:16:16 +02:00
|
|
|
static void SetPreviousTimeInMilliseconds(uint32 t) { m_snPreviousTimeInMilliseconds = t; }
|
2020-03-25 15:13:06 +01:00
|
|
|
static const float &GetTimeScale(void) { return ms_fTimeScale; }
|
2019-07-07 10:16:16 +02:00
|
|
|
static void SetTimeScale(float ts) { ms_fTimeScale = ts; }
|
2020-03-31 12:30:13 +02:00
|
|
|
static uint32 GetCyclesPerFrame();
|
2019-06-25 14:25:39 +02:00
|
|
|
|
2019-06-26 21:33:58 +02:00
|
|
|
static bool GetIsPaused() { return m_UserPause || m_CodePause; }
|
|
|
|
static bool GetIsUserPaused() { return m_UserPause; }
|
2019-08-02 22:20:12 +02:00
|
|
|
static bool GetIsCodePaused() { return m_CodePause; }
|
2019-06-26 21:33:58 +02:00
|
|
|
static void SetCodePause(bool pause) { m_CodePause = pause; }
|
2019-05-29 20:02:58 +02:00
|
|
|
|
|
|
|
static void Initialise(void);
|
|
|
|
static void Shutdown(void);
|
|
|
|
static void Update(void);
|
|
|
|
static void Suspend(void);
|
|
|
|
static void Resume(void);
|
2019-06-17 00:16:38 +02:00
|
|
|
static uint32 GetCyclesPerMillisecond(void);
|
|
|
|
static uint32 GetCurrentTimeInCycles(void);
|
|
|
|
static bool GetIsSlowMotionActive(void);
|
2019-05-29 20:02:58 +02:00
|
|
|
static void Stop(void);
|
|
|
|
static void StartUserPause(void);
|
|
|
|
static void EndUserPause(void);
|
2020-04-13 20:20:57 +02:00
|
|
|
|
|
|
|
friend bool GenericLoad(void);
|
|
|
|
friend bool GenericSave(int file);
|
2019-05-15 16:52:37 +02:00
|
|
|
};
|
2020-04-10 17:06:49 +02:00
|
|
|
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
extern double frameTime;
|
|
|
|
#endif
|