YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Timer.cpp
Go to the documentation of this file.
1
#include "
YAPOG/System/Time/Timer.hpp
"
2
3
namespace
yap
4
{
5
Timer::Timer
()
6
: clock_ ()
7
, init_ ()
8
{
9
}
10
11
Timer::Timer
(
const
Time
& init)
12
: clock_ ()
13
, init_ (init)
14
{
15
}
16
17
void
Timer::Reset
()
18
{
19
Reset
(
Time
());
20
}
21
22
void
Timer::Reset
(
const
Time
& init)
23
{
24
init_
= init;
25
26
clock_
.restart ();
27
}
28
29
Time
Timer::GetCurrentTime
()
const
30
{
31
return
Time
(
clock_
.getElapsedTime ()) +
init_
;
32
}
33
34
int
Timer::DelayIsComplete
(
const
Time
& delay,
bool
reset)
35
{
36
float
currentTime =
GetCurrentTime
().
GetValue
();
37
38
int
factor =
static_cast<
int
>
(
39
currentTime / delay.
GetValue
());
40
41
if
(reset && factor > 0)
42
Reset
(
Time
(currentTime - factor * delay.
GetValue
()));
43
44
return
factor;
45
}
46
}
// namespace yap
YAPOG
src
YAPOG
System
Time
Timer.cpp
Generated on Mon Sep 17 2012 22:24:26 for YAPOG by
1.8.1.1