nomlib
Toggle main menu visibility
Loading...
Searching...
No Matches
include
nomlib
system
Timer.hpp
1
/******************************************************************************
2
3
nomlib - C++11 cross-platform game engine
4
5
Copyright (c) 2013, 2014 Jeffrey Carpenter <i8degrees@gmail.com>
6
All rights reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
10
11
1. Redistributions of source code must retain the above copyright notice, this
12
list of conditions and the following disclaimer.
13
2. Redistributions in binary form must reproduce the above copyright notice,
14
this list of conditions and the following disclaimer in the documentation
15
and/or other materials provided with the distribution.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
******************************************************************************/
29
#ifndef NOMLIB_SDL_TIMER_HEADERS
30
#define NOMLIB_SDL_TIMER_HEADERS
31
32
#include <iostream>
33
#include <string>
34
35
#include "export.hpp"
36
#include "nomlib/config.hpp"
37
38
namespace
nom {
39
40
class
NOM_EXPORT Timer
41
{
42
public
:
43
Timer (
void
);
44
virtual
~Timer (
void
);
45
46
void
start (
void
);
47
void
stop (
void
);
48
50
void
restart
(
void
);
51
52
void
pause (
void
);
53
void
unpause (
void
);
54
55
uint32 ticks (
void
)
const
;
56
57
bool
started (
void
)
const
;
58
bool
paused (
void
)
const
;
59
60
const
std::string ticksAsString (
void
)
const
;
61
62
real32 to_seconds()
const
;
63
69
static
uint32
to_milliseconds
(real32 seconds);
70
76
static
real32
to_seconds
(uint32 ticks);
77
78
private
:
80
uint32
elapsed_ticks
;
81
83
uint32
paused_ticks
;
84
86
bool
timer_paused
;
87
89
bool
timer_started
;
90
};
91
92
93
}
// namespace nom
94
95
#endif
// NOMLIB_SDL_TIMER_HEADERS defined
nom::Timer::restart
void restart(void)
Alias for start.
nom::Timer::timer_started
bool timer_started
Tracks whether we are started or not.
Definition
Timer.hpp:89
nom::Timer::timer_paused
bool timer_paused
Tracks whether we are paused or not.
Definition
Timer.hpp:86
nom::Timer::to_seconds
static real32 to_seconds(uint32 ticks)
Convert a timer value to seconds.
nom::Timer::to_milliseconds
static uint32 to_milliseconds(real32 seconds)
Convert milliseconds to seconds.
nom::Timer::paused_ticks
uint32 paused_ticks
Holds ticks while paused.
Definition
Timer.hpp:83
nom::Timer::elapsed_ticks
uint32 elapsed_ticks
Milliseconds since timer start.
Definition
Timer.hpp:80
Generated on
for nomlib by
1.18.0