X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmainloop.hpp;h=6edb42123ff32681910aa7ad3978a01018685b52;hb=2cc6d246e1ff259b7580707847abf9f139d3d22c;hp=db961e06be27976d138f925317d82e2240766783;hpb=690ac9e5920c8d3dd0a8a14a7bd163eaf52ce689;p=supertux.git diff --git a/src/mainloop.hpp b/src/mainloop.hpp index db961e06b..6edb42123 100644 --- a/src/mainloop.hpp +++ b/src/mainloop.hpp @@ -21,42 +21,61 @@ #include #include +#include "scripting/thread_queue.hpp" class Screen; class Console; class ScreenFade; class DrawingContext; +/** + * Manages, updates and draws all Screens, Controllers, Menus and the Console. + */ 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 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 -