- removed old code
[supertux.git] / src / timer.h
1 //  $Id$
2 // 
3 //  SuperTux
4 //  Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
5 //
6 //  This program is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU General Public License
8 //  as published by the Free Software Foundation; either version 2
9 //  of the License, or (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU General Public License for more details.
15 // 
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 //  02111-1307, USA.
20
21 #ifndef SUPERTUX_TIMER_H
22 #define SUPERTUX_TIMER_H
23
24 extern unsigned int st_pause_ticks, st_pause_count;
25
26 unsigned int st_get_ticks(void);
27 void st_pause_ticks_init(void);
28 void st_pause_ticks_start(void);
29 void st_pause_ticks_stop(void);
30 bool st_pause_ticks_started(void);
31
32 class Timer
33 {
34  public:
35   unsigned int period;
36   unsigned int time;
37   unsigned int (*get_ticks) (void);  
38
39  public:
40   Timer();
41   
42   void init(bool st_ticks);
43   void start(unsigned int period);
44   void stop();
45
46   /*======================================================================
47     return: NO  = the timer is not started
48     or it is over
49     YES = otherwise
50     ======================================================================*/
51   int check();
52   int started();
53
54   /*======================================================================
55     return: the time left (in millisecond)
56     note  : the returned value can be negative
57     ======================================================================*/
58   int get_left();
59
60   int  get_gone();
61   void fwrite(FILE* fi);
62   void fread(FILE* fi);
63 };
64
65 #endif /*SUPERTUX_TIMER_H*/
66
67 /* Local Variables: */
68 /* mode:c++ */
69 /* End: */