projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new editor image for infoblock
[supertux.git]
/
lib
/
special
/
timer.cpp
diff --git
a/lib/special/timer.cpp
b/lib/special/timer.cpp
index
0791f71
..
1ff1349
100644
(file)
--- a/
lib/special/timer.cpp
+++ b/
lib/special/timer.cpp
@@
-18,45
+18,47
@@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
+#include <config.h>
+
#include "SDL.h"
#include "SDL.h"
-#include "
special/
timer.h"
+#include "timer.h"
using namespace SuperTux;
using namespace SuperTux;
-unsigned int
SuperTux::st_pause_ticks, SuperTux::st_
pause_count;
+unsigned int
Ticks::pause_ticks, Ticks::
pause_count;
-unsigned int
SuperTux::st_get_ticks
(void)
+unsigned int
Ticks::get
(void)
{
{
- if(
st_
pause_count != 0)
- return /*SDL_GetTicks()*/ -
st_pause_ticks /*- SDL_GetTicks()*/ + st_
pause_count;
+ if(pause_count != 0)
+ return /*SDL_GetTicks()*/ -
pause_ticks /*- SDL_GetTicks()*/ +
pause_count;
else
else
- return SDL_GetTicks() -
st_
pause_ticks;
+ return SDL_GetTicks() - pause_ticks;
}
}
-void
SuperTux::st_pause_ticks
_init(void)
+void
Ticks::pause
_init(void)
{
{
-
st_
pause_ticks = 0;
-
st_
pause_count = 0;
+ pause_ticks = 0;
+ pause_count = 0;
}
}
-void
SuperTux::st_pause_ticks
_start(void)
+void
Ticks::pause
_start(void)
{
{
- if(
st_
pause_count == 0)
-
st_
pause_count = SDL_GetTicks();
+ if(pause_count == 0)
+ pause_count = SDL_GetTicks();
}
}
-void
SuperTux::st_pause_ticks
_stop(void)
+void
Ticks::pause
_stop(void)
{
{
-if(
st_
pause_count == 0)
+if(pause_count == 0)
return;
return;
-
st_pause_ticks += SDL_GetTicks() - st_
pause_count;
-
st_
pause_count = 0;
+
pause_ticks += SDL_GetTicks() -
pause_count;
+ pause_count = 0;
}
}
-bool
SuperTux::st_pause_ticks
_started(void)
+bool
Ticks::pause
_started(void)
{
{
-if(
st_
pause_count == 0)
+if(pause_count == 0)
return false;
else
return true;
return false;
else
return true;
@@
-68,11
+70,11
@@
Timer::Timer()
}
void
}
void
-Timer::init(bool
st
_ticks)
+Timer::init(bool
game
_ticks)
{
period = 0;
time = 0;
{
period = 0;
time = 0;
- get_ticks =
st_ticks ? st_get_ticks
: SDL_GetTicks;
+ get_ticks =
game_ticks ? Ticks::get
: SDL_GetTicks;
}
void
}
void
@@
-85,7
+87,7
@@
Timer::start(unsigned int period_)
void
Timer::stop()
{
void
Timer::stop()
{
- if(get_ticks ==
st_
get_ticks)
+ if(get_ticks == get_ticks)
init(true);
else
init(false);
init(true);
else
init(false);
@@
-136,7
+138,7
@@
Timer::fwrite(FILE* fi)
::fwrite(&period,sizeof(unsigned int),1,fi);
::fwrite(&diff_ticks,sizeof(unsigned int),1,fi);
::fwrite(&period,sizeof(unsigned int),1,fi);
::fwrite(&diff_ticks,sizeof(unsigned int),1,fi);
- if(get_ticks ==
st_
get_ticks)
+ if(get_ticks == get_ticks)
tick_mode = true;
else
tick_mode = false;
tick_mode = true;
else
tick_mode = false;
@@
-154,7
+156,7
@@
Timer::fread(FILE* fi)
::fread(&tick_mode,sizeof(unsigned int),1,fi);
if (tick_mode)
::fread(&tick_mode,sizeof(unsigned int),1,fi);
if (tick_mode)
- get_ticks =
st_
get_ticks;
+ get_ticks = get_ticks;
else
get_ticks = SDL_GetTicks;
else
get_ticks = SDL_GetTicks;