4 // Copyright (C) 2004 Bill Kendrick <bill@newbreedsoftware.com>
5 // Tobias Glaesser <tobi.web@gmx.de>
6 // Ingo Ruhnke <grumbel@gmx.de>
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef SUPERTUX_GAMELOOP_H
23 #define SUPERTUX_GAMELOOP_H
34 #define ST_GL_LOAD_GAME 2
35 #define ST_GL_LOAD_LEVEL_FILE 3
36 #define ST_GL_DEMO_GAME 4
38 extern int game_started;
42 /** The GameSession class controlls the controll flow of a World, ie.
43 present the menu on specifc keypresses, render and update it while
44 keeping the speed and framerate sane, etc. */
54 unsigned int last_update_time;
55 unsigned int update_time;
60 // FIXME: Hack for restarting the level
64 enum ExitStatus { NONE, LEVEL_FINISHED, GAME_OVER, LEVEL_ABORT };
66 ExitStatus exit_status;
71 GameSession(const std::string& subset, int levelnb, int mode);
74 /** Enter the busy loop */
78 void action(double frame_ratio);
80 Level* get_level() { return world->get_level(); }
81 World* get_world() { return world; }
83 static GameSession* current() { return current_; }
85 static GameSession* current_;
89 void check_end_conditions();
91 void process_events();
96 void drawresultscreen(void);
99 void on_escape_press();
102 std::string slotinfo(int slot);
104 bool rectcollision(base_type* one, base_type* two);
105 void bumpbrick(float x, float y);
107 #endif /*SUPERTUX_GAMELOOP_H*/