b7e048b2dd5826790bc6437d7ca222a9bdb25c42
[supertux.git] / src / gameloop.h
1 /*
2   gameloop.h
3   
4   Super Tux - Game Loop!
5   
6   by Bill Kendrick & Tobias Glaesser <tobi.web@gmx.de>
7   bill@newbreedsoftware.com
8   http://www.newbreedsoftware.com/supertux/
9   
10   April 11, 2000 - March 15, 2004
11 */
12
13 #ifndef SUPERTUX_GAMELOOP_H
14 #define SUPERTUX_GAMELOOP_H
15
16 #include "sound.h"
17 #include "type.h"
18 #include "level.h"
19
20 /* GameLoop modes */
21
22 #define ST_GL_PLAY 0
23 #define ST_GL_TEST 1
24 #define ST_GL_LOAD_GAME 2
25 #define ST_GL_LOAD_LEVEL_FILE  3
26
27 // FIXME: Make this local to the gamesession
28 extern Level current_level;
29
30 extern int game_started;
31
32 class GameSession
33 {
34  private:
35   timer_type fps_timer, frame_timer;
36
37  public:
38   GameSession(const char * subset, int levelnb, int mode);
39   int  run();
40   void draw();
41   int  action();
42 };
43
44 void  activate_bad_guys(Level* plevel);
45 void  savegame(int slot);
46 void  loadgame(int slot);
47 std::string slotinfo(int slot);
48
49 bool  rectcollision(base_type* one, base_type* two);
50 void  drawshape(float x, float y, unsigned int c, Uint8 alpha = 255);
51 void bumpbrick(float x, float y);
52
53 /** Try to grab the coin at the given coordinates */
54 void trygrabdistro(float x, float y, int bounciness);
55
56 /** Try to break the brick at the given coordinates */
57 void trybreakbrick(float x, float y, bool small);
58
59 /** Try to get the content out of a bonus box, thus emptying it */
60 void tryemptybox(float x, float y, int col_side);
61
62 /** Try to bumb a badguy that might we walking above Tux, thus shaking
63     the tile which the badguy is walking on an killing him this way */
64 void trybumpbadguy(float x, float y);
65
66 #endif /*SUPERTUX_GAMELOOP_H*/
67