X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmainloop.hpp;h=bd03372b94467fc1d6e6018ddb74118c171a9cf9;hb=791b577793d178a35031a6585ebc9a73b94f299c;hp=20d21075fc3e85d6d07a63a43a617b932d587a3f;hpb=1486ceaaf9dd7a9d2d7e3654550b9a2768df2a56;p=supertux.git diff --git a/src/mainloop.hpp b/src/mainloop.hpp index 20d21075f..bd03372b9 100644 --- a/src/mainloop.hpp +++ b/src/mainloop.hpp @@ -1,5 +1,5 @@ -// $Id: worldmap.hpp 2800 2005-10-02 22:57:31Z matzebraun $ -// +// $Id$ +// // SuperTux // Copyright (C) 2006 Matthias Braun // @@ -12,7 +12,7 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -21,35 +21,58 @@ #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 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); + 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 -