-
Notifications
You must be signed in to change notification settings - Fork 0
/
FramerateModule.h
44 lines (35 loc) · 1018 Bytes
/
FramerateModule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Module that limits the framerate to a target rate.
*
* @author Francis BISSON
*/
#ifndef FRAMERATEMODULE_H
#define FRAMERATEMODULE_H
// INCLUDES ////////////////////////////////////////////////////////////////////
#include "Font.h"
#include "GameObject.h"
#include "Text.h"
// FORWARD DECLARATIONS ////////////////////////////////////////////////////////
class DisplayContext;
class Game;
// CLASS DEFINITION ////////////////////////////////////////////////////////////
class FramerateModule : public GameObject
{
public:
FramerateModule(Game* game, unsigned long targetFps);
virtual ~FramerateModule();
virtual bool Init();
virtual void Update(double deltaTime);
virtual void Render(DisplayContext* displayContext);
void LimitFramerate();
protected:
unsigned long m_FrameCount;
double m_Time;
double m_FrameTime;
unsigned long m_TargetFps;
#ifndef NDEBUG
FontPtr m_Font;
Text m_FPS;
#endif
};
#endif // FRAMERATEMODULE_H