- moved loadshared() to the right point
[supertux.git] / src / gameloop.h
index d7edeae..27f6ce1 100644 (file)
@@ -16,6 +16,7 @@
 #include "sound.h"
 #include "type.h"
 #include "level.h"
+#include "world.h"
 
 /* GameLoop modes */
 
 
 extern int game_started;
 
+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:
-  timer_type fps_timer, frame_timer;
-  Level current_level;
+  bool quit;
+  Timer fps_timer;
+  Timer frame_timer;
+  World* world;
+  int st_gl_mode;
+
+  float fps_fps;
+  unsigned int last_update_time;
+  unsigned int update_time;
+  int pause_menu_frame;
+  int debug_fps;
+  bool game_pause;
+
+  // FIXME: Hack for restarting the level
+  std::string subset;
+  int levelnb;
 
  public:
+  Timer time_left;
+
   GameSession();
   GameSession(const std::string& filename);
   GameSession(const std::string& subset, int levelnb, int mode);
+  ~GameSession();
+
+  /** Enter the busy loop */
   int  run();
+
   void draw();
-  int  action();
-  void process_events();
+  int  action(double frame_ratio);
 
-  Level* get_level() { return &current_level; }
+  Level* get_level() { return world->get_level(); }
+  World* get_world() { return world; }
 
   void  savegame(int slot);
   void  loadgame(int slot);
@@ -53,17 +76,20 @@ class GameSession
  private:
   static GameSession* current_;
 
-  void levelintro();
+  void init();
+
   void start_timers();
-  void activate_particle_systems();
-};
+  void process_events();
 
-void  activate_bad_guys(Level* plevel);
+  void levelintro();
+  void drawstatus();
+  void drawendscreen();
+  void drawresultscreen(void);
+};
 
 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);
+bool rectcollision(base_type* one, base_type* two);
 void bumpbrick(float x, float y);
 
 #endif /*SUPERTUX_GAMELOOP_H*/