LeviLamina
Loading...
Searching...
No Matches
Timer.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5class Timer {
6public:
7 // member variables
8 // NOLINTBEGIN
9 ::ll::TypedStorage<4, 4, float> mTicksPerSecond;
10 ::ll::TypedStorage<4, 4, int> mTicks;
11 ::ll::TypedStorage<4, 4, float> mAlpha;
12 ::ll::TypedStorage<4, 4, float> mTimeScale;
13 ::ll::TypedStorage<4, 4, float> mPassedTime;
14 ::ll::TypedStorage<4, 4, float> mFrameStepAlignmentRemainder;
15 ::ll::TypedStorage<4, 4, float> mLastTimeSeconds;
16 ::ll::TypedStorage<4, 4, float> mLastTimestep;
17 ::ll::TypedStorage<4, 4, float> mOverflowTime;
18 ::ll::TypedStorage<8, 8, int64> mLastMs;
19 ::ll::TypedStorage<8, 8, int64> mLastMsSysTime;
20 ::ll::TypedStorage<4, 4, float> mAdjustTime;
21 ::ll::TypedStorage<4, 4, float> mSteppingTick;
22 ::ll::TypedStorage<8, 64, ::std::function<int64()>> mGetTimeMSCallback;
23 // NOLINTEND
24
25public:
26 // prevent constructor by default
27 Timer();
28
29public:
30 // member functions
31 // NOLINTBEGIN
32 MCAPI Timer(float ticksPerSecond, ::std::function<int64()> getTimeMSCallback);
33
34 MCAPI void advanceTime(float preferredFrameStep);
35
36#ifdef LL_PLAT_C
37 MCFOLD float getAlpha() const;
38#endif
39
40 MCAPI uint64 getTicks() const;
41
42#ifdef LL_PLAT_C
43 MCFOLD float getTime() const;
44#endif
45
46 MCFOLD float getTimeScale() const;
47
48 MCAPI int popOverflowTicks();
49
50 MCAPI void resetTimePassed();
51
52 MCAPI void setTimeScale(float timeScale);
53
54 MCAPI void stepTick(int numSteps);
55
56#ifdef LL_PLAT_C
57 MCAPI void stepTick(float numSteps);
58#endif
59
60 MCAPI bool stepping() const;
61 // NOLINTEND
62
63public:
64 // static functions
65 // NOLINTBEGIN
66 MCAPI static int64 getMillisecondsSinceLaunch();
67 // NOLINTEND
68
69public:
70 // constructor thunks
71 // NOLINTBEGIN
72 MCAPI void* $ctor(float ticksPerSecond, ::std::function<int64()> getTimeMSCallback);
73 // NOLINTEND
74};