X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmainloop.hpp;h=e9fa1a11acde0539e0d5db59e9109deb2253b9ed;hb=9d05abe97c11bec660967594ca889f89338ab343;hp=5e51d2df1dc37df0bb41d9fc03aa363d98e12cb4;hpb=9b58f72e1c6900540c0ee00a800ed57d2c1f4974;p=supertux.git diff --git a/src/mainloop.hpp b/src/mainloop.hpp index 5e51d2df1..e9fa1a11a 100644 --- a/src/mainloop.hpp +++ b/src/mainloop.hpp @@ -21,6 +21,7 @@ #include #include +#include "scripting/thread_queue.hpp" class Screen; class Console; @@ -32,30 +33,46 @@ class MainLoop public: MainLoop(); ~MainLoop(); - + void run(); 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 next_screen; std::auto_ptr current_screen; std::auto_ptr console; std::auto_ptr screen_fade; std::vector screen_stack; + bool screenshot_requested; /**< true if a screenshot should be taken after the next frame has been rendered */ }; extern MainLoop* main_loop; #endif -