TurtleBrains  0.2.1
High quality, portable, C++ API for native application and game development.
tb_game_timer.h
1 
9 #ifndef _TurtleBrains_GameTimer_h_
10 #define _TurtleBrains_GameTimer_h_
11 
12 #include "../core/tb_types.h"
13 
14 namespace TurtleBrains
15 {
16  namespace Game
17  {
18 
25  class GameTimer
26  {
27  public:
32 
36  static GameTimer kZero;
37 
41  GameTimer(void);
42 
48  explicit GameTimer(const Milliseconds& valueMilliseconds);
49 
53  GameTimer(const GameTimer& other);
54 
58  ~GameTimer(void);
59 
63  GameTimer& operator=(const GameTimer& other);
64 
71  bool DecrementStep(void);
72 
81  void IncrementStep(void);
82 
86  bool IsZero(void) const;
87 
92  const Milliseconds& GetElapsedTime(void) const;
93 
98  const Milliseconds& GetRemainingTime(void) const;
99 
109  float GetPercentageOf(const GameTimer& timeValue) const;
110 
116  static float ToSeconds(const Milliseconds& valueMilliseconds);
117 
124  static Milliseconds ToMilliseconds(const float& valueSeconds);
125 
132  static void SetMillisecondsPerStep(const Milliseconds& millisecondsPerStep);
133 
137  static Milliseconds GetMillisecondsPerStep(void);
138 
145  static float GetSecondsPerStep(void);
146 
147  private:
148  Milliseconds mMillisecondTimer;
149  static Milliseconds sMillisecondsPerStep;
150  };
151 
152  }; /* namespace Game */
153 }; /* namespace TurtleBrains */
154 
155 namespace tbGame = TurtleBrains::Game;
156 
157 #endif /* _TurtleBrains_GameTimer_h_ */
GameTimer & operator=(const GameTimer &other)
static Milliseconds GetMillisecondsPerStep(void)
float GetPercentageOf(const GameTimer &timeValue) const
static float GetSecondsPerStep(void)
const Milliseconds & GetRemainingTime(void) const
static GameTimer kZero
Definition: tb_game_timer.h:36
static void SetMillisecondsPerStep(const Milliseconds &millisecondsPerStep)
Contains all functions, classes and helpers related to game/application development written by Tim "B...
Definition: tb_application_dialog.h:21
static float ToSeconds(const Milliseconds &valueMilliseconds)
static Milliseconds ToMilliseconds(const float &valueSeconds)
uint32_t uint32
Unsigned integer with a size of 32 bits. Supports values from 0 to 4294967295, (2^32 - 1)...
Definition: tb_types.h:27
const Milliseconds & GetElapsedTime(void) const
tbCore::uint32 Milliseconds
Definition: tb_game_timer.h:31
This is the heart of TurtleBrains for game developers to create GameScenes and Entities to interact w...
Definition: tb_game_timer.h:25