#include "sound.h"
#include "type.h"
#include "level.h"
+#include "world.h"
/* GameLoop modes */
#define ST_GL_LOAD_LEVEL_FILE 3
extern int game_started;
-extern st_level current_level;
-
-/* Function prototypes: */
-
-int gameloop(const char * subset, int levelnb, int mode);
-void savegame(int slot);
-void loadgame(int slot);
-void slotinfo(char **pinfo, int slot);
-int issolid(float x, float y);
-int isbrick(float x, float y);
-int isice(float x, float y);
-int isfullbox(float x, float y);
-int rectcollision(base_type* one, base_type* two);
-void drawshape(float x, float y, unsigned char c);
-unsigned char shape(float x, float y);
+
+class World;
+
+/** The GameSession class controlls the controll flow of a World, ie.
+ present the menu on specifc keypresses, render and update it while
+ keeping the speed and framerate sane, etc. */
+class GameSession
+{
+ private:
+ bool quit;
+ timer_type fps_timer, frame_timer;
+ World* world;
+
+ public:
+ GameSession();
+ GameSession(const std::string& filename);
+ GameSession(const std::string& subset, int levelnb, int mode);
+
+ int run();
+ void draw();
+ int action();
+ void process_events();
+
+ Level* get_level() { return world->get_level(); }
+ World* get_world() { return world; }
+
+ void savegame(int slot);
+ void loadgame(int slot);
+
+ static GameSession* current() { return current_; }
+ private:
+ static GameSession* current_;
+
+ void levelintro();
+ void start_timers();
+};
+
+void activate_bad_guys(Level* plevel);
+
+std::string slotinfo(int slot);
+
+bool rectcollision(base_type* one, base_type* two);
+void drawshape(float x, float y, unsigned int c, Uint8 alpha = 255);
void bumpbrick(float x, float y);
-void trygrabdistro(float x, float y, int bounciness);
-void trybreakbrick(float x, float y);
-void tryemptybox(float x, float y, int col_side);
-void trybumpbadguy(float x, float y);
#endif /*SUPERTUX_GAMELOOP_H*/