summaryrefslogtreecommitdiffstats
path: root/src/core/Timer.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-07 13:09:11 +0200
committeraap <aap@papnet.eu>2019-07-07 13:09:11 +0200
commit53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb (patch)
treefc65a6c40fa719f9d43be9e0e15be79c490135e0 /src/core/Timer.h
parentfinished CPhysical (diff)
downloadre3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar
re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar.gz
re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar.bz2
re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar.lz
re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar.xz
re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar.zst
re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.zip
Diffstat (limited to 'src/core/Timer.h')
-rw-r--r--src/core/Timer.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/core/Timer.h b/src/core/Timer.h
new file mode 100644
index 00000000..9e6d447e
--- /dev/null
+++ b/src/core/Timer.h
@@ -0,0 +1,51 @@
+#pragma once
+
+class CTimer
+{
+ 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;
+ static bool &m_UserPause;
+ static bool &m_CodePause;
+public:
+ static float GetTimeStep(void) { return ms_fTimeStep; }
+ 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; }
+ static float GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; }
+ static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; }
+ static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; }
+ static uint32 GetFrameCounter(void) { return m_FrameCounter; }
+ static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; }
+ static uint32 GetTimeInMilliseconds(void) { return m_snTimeInMilliseconds; }
+ static void SetTimeInMilliseconds(uint32 t) { m_snTimeInMilliseconds = t; }
+ static uint32 GetTimeInMillisecondsNonClipped(void) { return m_snTimeInMillisecondsNonClipped; }
+ static void SetTimeInMillisecondsNonClipped(uint32 t) { m_snTimeInMillisecondsNonClipped = t; }
+ static uint32 GetTimeInMillisecondsPauseMode(void) { return m_snTimeInMillisecondsPauseMode; }
+ static void SetTimeInMillisecondsPauseMode(uint32 t) { m_snTimeInMillisecondsPauseMode = t; }
+ static uint32 GetPreviousTimeInMilliseconds(void) { return m_snPreviousTimeInMilliseconds; }
+ static void SetPreviousTimeInMilliseconds(uint32 t) { m_snPreviousTimeInMilliseconds = t; }
+ static float GetTimeScale(void) { return ms_fTimeScale; }
+ static void SetTimeScale(float ts) { ms_fTimeScale = ts; }
+
+ static bool GetIsPaused() { return m_UserPause || m_CodePause; }
+ static bool GetIsUserPaused() { return m_UserPause; }
+ static void SetCodePause(bool pause) { m_CodePause = pause; }
+
+ static void Initialise(void);
+ static void Shutdown(void);
+ static void Update(void);
+ static void Suspend(void);
+ static void Resume(void);
+ static uint32 GetCyclesPerMillisecond(void);
+ static uint32 GetCurrentTimeInCycles(void);
+ static bool GetIsSlowMotionActive(void);
+ static void Stop(void);
+ static void StartUserPause(void);
+ static void EndUserPause(void);
+};