X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmainloop.hpp;h=244c63f9f12b1b24918e9b2b51035974bb404053;hb=8ea989626785c9a386bf4aef1b44fd201b677a08;hp=8be8b11d9d4ad64780d57da3556eb0d37dbeb7f6;hpb=07ddaed2a657e4d2a3d038fed223fc5827159caf;p=supertux.git diff --git a/src/mainloop.hpp b/src/mainloop.hpp index 8be8b11d9..244c63f9f 100644 --- a/src/mainloop.hpp +++ b/src/mainloop.hpp @@ -21,35 +21,57 @@ #include #include +#include "scripting/thread_queue.hpp" class Screen; class Console; +class ScreenFade; +class DrawingContext; class MainLoop { public: MainLoop(); ~MainLoop(); - + void run(); - void exit_screen(); - void quit(); + void exit_screen(ScreenFade* fade = NULL); + void quit(ScreenFade* fade = NULL); void set_speed(float speed); + /** + * 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); + 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 -