Refactored video/ subsystem to make adding other methods of rendering (in particular...
[supertux.git] / src / mainloop.hpp
index 5e51d2d..bd03372 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <memory>
 #include <vector>
+#include "scripting/thread_queue.hpp"
 
 class Screen;
 class Console;
@@ -32,30 +33,46 @@ class MainLoop
 public:
   MainLoop();
   ~MainLoop();
-  
-  void run();
+
+  void run(DrawingContext &context);
   void exit_screen(ScreenFade* fade = NULL);
   void quit(ScreenFade* fade = NULL);
   void set_speed(float speed);
+  float get_speed() const;
+
+  /**
+   * requests that a screenshot be taken after the next frame has been rendered
+   */
+  void take_screenshot();
 
   // push new screen on screen_stack
   void push_screen(Screen* screen, ScreenFade* fade = NULL);
   void set_screen_fade(ScreenFade* fade);
 
+  /// threads that wait for a screenswitch
+  Scripting::ThreadQueue waiting_threads;
+
 private:
   void draw_fps(DrawingContext& context, float fps);
-  
+  void draw(DrawingContext& context);
+  void update_gamelogic(float elapsed_time);
+  void process_events();
+  void handle_screen_switch();
+
   bool running;
   float speed;
   bool nextpop;
+  bool nextpush;
+  /// measured fps
+  float fps;
   std::auto_ptr<Screen> next_screen;
   std::auto_ptr<Screen> current_screen;
   std::auto_ptr<Console> console;
   std::auto_ptr<ScreenFade> screen_fade;
   std::vector<Screen*> screen_stack;
+  bool screenshot_requested; /**< true if a screenshot should be taken after the next frame has been rendered */
 };
 
 extern MainLoop* main_loop;
 
 #endif
-