forked from Alfwich/CubicEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utilities.h
61 lines (44 loc) · 936 Bytes
/
Utilities.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/***
Utilities: Objects that preform useful operations; yet are not specific enough for their own file
***/
#ifndef UTILITIES_H
#define UTILITIES_H
#include "SDL.h"
class Timer
{
private:
int _iStartTicks;
int _iPausedTicks;
bool _bPaused;
bool _bStarted;
public:
Timer();
// Starts the Timer
void start();
// Stops the Timer
void stop();
// Pauses the Timer
void pause();
// Unpauses the Timer
void unpause();
// Postcondition: Returns the time elapsed in milliseconds
int get_ticks();
bool is_started();
bool is_paused();
};
// Fps Meter: Defines an object that will return the amount of 'ticks' per second
class FpsMeter
{
private:
Timer fpsTimer;
int frame;
int fps;
public:
FpsMeter();
void Start();
// Gets the most current reading
int GetReading();
// Returns true if the reading has changed
bool UpdateFrame();
};
#endif // !UTILITIES_H