src/supertux/screen_manager.hpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 #ifndef HEADER_SUPERTUX_SUPERTUX_MAINLOOP_HPP
00018 #define HEADER_SUPERTUX_SUPERTUX_MAINLOOP_HPP
00019 
00020 #include <memory>
00021 #include <cstddef>
00022 
00023 #include "scripting/thread_queue.hpp"
00024 
00025 class Screen;
00026 class Console;
00027 class ScreenFade;
00028 class DrawingContext;
00029 
00033 class ScreenManager
00034 {
00035 public:
00036   ScreenManager();
00037   ~ScreenManager();
00038 
00039   void run(DrawingContext &context);
00040   void exit_screen(ScreenFade* fade = NULL);
00041   void quit(ScreenFade* fade = NULL);
00042   void set_speed(float speed);
00043   float get_speed() const;
00044   bool has_no_pending_fadeout() const;
00045 
00049   void take_screenshot();
00050 
00051   // push new screen on screen_stack
00052   void push_screen(Screen* screen, ScreenFade* fade = NULL);
00053   void set_screen_fade(ScreenFade* fade);
00054 
00056   scripting::ThreadQueue waiting_threads;
00057 
00058 private:
00059   void draw_fps(DrawingContext& context, float fps);
00060   void draw(DrawingContext& context);
00061   void update_gamelogic(float elapsed_time);
00062   void process_events();
00063   void handle_screen_switch();
00064 
00065 private:
00066   bool running;
00067   float speed;
00068   bool nextpop;
00069   bool nextpush;
00071   float fps;
00072   std::auto_ptr<Screen> next_screen;
00073   std::auto_ptr<Screen> current_screen;
00074   std::auto_ptr<Console> console;
00075   std::auto_ptr<ScreenFade> screen_fade;
00076   std::vector<Screen*> screen_stack;
00077   bool screenshot_requested; 
00078 };
00079 
00080 #endif
00081 
00082 /* EOF */

Generated on Mon Jun 9 03:38:23 2014 for SuperTux by  doxygen 1.5.1