Game Engine 2D Platformer
include
Timer.h
Go to the documentation of this file.
1
7
//Using SDL, SDL_image, SDL_ttf, standard IO, strings, and string streams
8
#include <SDL2/SDL.h>
9
#include <stdio.h>
10
const
int
SCREEN_FPS
= 60;
11
const
int
SCREEN_TICK_PER_FRAME
= 1000 /
SCREEN_FPS
;
12
13
//The application time based timer
14
class
Timer
15
{
16
public
:
17
//Initializes variables
18
Timer
();
19
20
//The various clock actions
21
void
start
();
22
void
stop
();
23
void
pause
();
24
void
unpause
();
25
26
//Gets the timer's time
27
Uint32
getTicks
();
28
29
//Checks the status of the timer
30
bool
isStarted
();
31
bool
isPaused
();
32
33
private
:
34
//The clock time when the timer started
35
Uint32 mStartTicks;
36
37
//The ticks stored when the timer was paused
38
Uint32 mPausedTicks;
39
40
//The timer status
41
bool
mPaused;
42
bool
mStarted;
43
};
SCREEN_FPS
const int SCREEN_FPS
Definition:
Timer.h:10
SCREEN_TICK_PER_FRAME
const int SCREEN_TICK_PER_FRAME
Definition:
Timer.h:11
Timer
Definition:
Timer.h:15
Timer::pause
void pause()
Definition:
Timer.cpp:38
Timer::isStarted
bool isStarted()
Definition:
Timer.cpp:92
Timer::start
void start()
Definition:
Timer.cpp:12
Timer::getTicks
Uint32 getTicks()
Definition:
Timer.cpp:68
Timer::Timer
Timer()
Definition:
Timer.cpp:2
Timer::stop
void stop()
Definition:
Timer.cpp:25
Timer::unpause
void unpause()
Definition:
Timer.cpp:52
Timer::isPaused
bool isPaused()
Definition:
Timer.cpp:98
Generated by
1.9.0