Renamed MainLoop to ScreenManager
authorgrumbel <grumbel@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Thu, 19 Nov 2009 17:06:22 +0000 (17:06 +0000)
committergrumbel <grumbel@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Thu, 19 Nov 2009 17:06:22 +0000 (17:06 +0000)
git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6051 837edb03-e0f3-0310-88ca-d4d4e8b29345

16 files changed:
src/gui/menu.cpp
src/object/endsequence_fireworks.cpp
src/object/endsequence_walkleft.cpp
src/object/endsequence_walkright.cpp
src/scripting/functions.cpp
src/supertux/globals.cpp
src/supertux/globals.hpp
src/supertux/menu/contrib_world_menu.cpp
src/supertux/screen_manager.cpp
src/supertux/screen_manager.hpp
src/supertux/world.cpp
src/video/surface.cpp
src/video/texture.hpp
src/video/texture_manager.cpp
src/video/texture_manager.hpp
src/worldmap/worldmap.cpp

index 3a78679..6e48496 100644 (file)
@@ -23,7 +23,7 @@
 #include "gui/menu_manager.hpp"
 #include "gui/mousecursor.hpp"
 #include "supertux/globals.hpp"
-#include "supertux/mainloop.hpp"
+#include "supertux/screen_manager.hpp"
 #include "supertux/resources.hpp"
 #include "supertux/timer.hpp"
 #include "util/gettext.hpp"
index 4fab4e1..2e4f830 100644 (file)
@@ -17,7 +17,8 @@
 #include "object/endsequence_fireworks.hpp"
 
 #include "object/fireworks.hpp"
-#include "supertux/mainloop.hpp"
+#include "supertux/globals.hpp"
+#include "supertux/screen_manager.hpp"
 #include "supertux/sector.hpp"
 
 EndSequenceFireworks::EndSequenceFireworks() :
@@ -39,7 +40,7 @@ void
 EndSequenceFireworks::starting()
 {
   EndSequence::starting();
-  endsequence_timer.start(7.3f * g_main_loop->get_speed());
+  endsequence_timer.start(7.3f * g_screen_manager->get_speed());
   Sector::current()->add_object(new Fireworks());
 }
 
index 809b8ba..19e2041 100644 (file)
@@ -16,7 +16,8 @@
 
 #include "object/endsequence_walkleft.hpp"
 #include "object/player.hpp"
-#include "supertux/mainloop.hpp"
+#include "supertux/globals.hpp"
+#include "supertux/screen_manager.hpp"
 #include "supertux/sector.hpp"
 
 EndSequenceWalkLeft::EndSequenceWalkLeft() :
@@ -40,7 +41,7 @@ EndSequenceWalkLeft::starting()
 {
   EndSequence::starting();
   last_x_pos = -1;
-  endsequence_timer.start(7.3f * g_main_loop->get_speed());
+  endsequence_timer.start(7.3f * g_screen_manager->get_speed());
 }
 
 void
index 5812975..1631c16 100644 (file)
@@ -16,7 +16,8 @@
 
 #include "object/endsequence_walkright.hpp"
 #include "object/player.hpp"
-#include "supertux/mainloop.hpp"
+#include "supertux/globals.hpp"
+#include "supertux/screen_manager.hpp"
 #include "supertux/sector.hpp"
 
 EndSequenceWalkRight::EndSequenceWalkRight() :
@@ -40,7 +41,7 @@ EndSequenceWalkRight::starting()
 {
   EndSequence::starting();
   last_x_pos = -1;
-  endsequence_timer.start(7.3f * g_main_loop->get_speed());
+  endsequence_timer.start(7.3f * g_screen_manager->get_speed());
 }
 
 void
index 853f204..245feac 100644 (file)
@@ -25,7 +25,7 @@
 #include "supertux/game_session.hpp"
 #include "supertux/gameconfig.hpp"
 #include "supertux/globals.hpp"
-#include "supertux/mainloop.hpp"
+#include "supertux/screen_manager.hpp"
 #include "supertux/sector.hpp"
 #include "supertux/shrinkfade.hpp"
 #include "supertux/textscroller.hpp"
@@ -64,27 +64,27 @@ void wait(HSQUIRRELVM vm, float seconds)
 
 void wait_for_screenswitch(HSQUIRRELVM vm)
 {
-  g_main_loop->waiting_threads.add(vm);
+  g_screen_manager->waiting_threads.add(vm);
 }
 
 void exit_screen()
 {
-  g_main_loop->exit_screen();
+  g_screen_manager->exit_screen();
 }
 
 void fadeout_screen(float seconds)
 {
-  g_main_loop->set_screen_fade(new FadeOut(seconds));
+  g_screen_manager->set_screen_fade(new FadeOut(seconds));
 }
 
 void shrink_screen(float dest_x, float dest_y, float seconds)
 {
-  g_main_loop->set_screen_fade(new ShrinkFade(Vector(dest_x, dest_y), seconds));
+  g_screen_manager->set_screen_fade(new ShrinkFade(Vector(dest_x, dest_y), seconds));
 }
 
 void abort_screenfade()
 {
-  g_main_loop->set_screen_fade(NULL);
+  g_screen_manager->set_screen_fade(NULL);
 }
 
 std::string translate(const std::string& text)
@@ -94,19 +94,19 @@ std::string translate(const std::string& text)
 
 void display_text_file(const std::string& filename)
 {
-  g_main_loop->push_screen(new TextScroller(filename));
+  g_screen_manager->push_screen(new TextScroller(filename));
 }
 
 void load_worldmap(const std::string& filename)
 {
   using namespace WorldMapNS;
 
-  g_main_loop->push_screen(new WorldMap(filename));
+  g_screen_manager->push_screen(new WorldMap(filename));
 }
 
 void load_level(const std::string& filename)
 {
-  g_main_loop->push_screen(new GameSession(filename));
+  g_screen_manager->push_screen(new GameSession(filename));
 }
 
 static SQInteger squirrel_read_char(SQUserPointer file)
@@ -277,7 +277,7 @@ void set_gamma(float gamma) {
 
 void quit()
 {
-  g_main_loop->quit();
+  g_screen_manager->quit();
 }
 
 int rand()
index 22a7311..c85a446 100644 (file)
@@ -24,4 +24,8 @@ tinygettext::DictionaryManager dictionary_manager;
 int SCREEN_WIDTH;
 int SCREEN_HEIGHT;
 
+ScreenManager* g_screen_manager = NULL;
+
+TextureManager* texture_manager = NULL;
+
 /* EOF */
index eb9a252..6fe934f 100644 (file)
 
 #include <SDL.h>
 
+class JoystickKeyboardController;
+class ScreenManager;
+class TextureManager;
+
 /** The width of the display (this is a logical value, not the
     physical value, since aspect_ration and projection_area might
     shrink or scale things) */
@@ -30,11 +34,14 @@ extern int SCREEN_WIDTH;
 extern int SCREEN_HEIGHT;
 
 // global variables
-class  JoystickKeyboardController;
 extern JoystickKeyboardController* g_main_controller;
 
 extern SDL_Surface* g_screen;
 
+extern ScreenManager* g_screen_manager;
+
+extern TextureManager* texture_manager;
+
 #endif
 
 /* EOF */
index b3e0fe1..f7205f0 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "audio/sound_manager.hpp"
 #include "gui/menu_item.hpp"
+#include "supertux/globals.hpp"
 #include "supertux/screen_manager.hpp"
 #include "supertux/title_screen.hpp"
 #include "supertux/world.hpp"
index 2b4478e..d43ce30 100644 (file)
@@ -42,8 +42,6 @@ static const int MAX_FRAME_SKIP = 2;
 
 float g_game_speed = 1.0f;
 
-ScreenManager* g_screen_manager = NULL;
-
 ScreenManager::ScreenManager() :
   waiting_threads(),
   running(),
index 09acd6a..1cb5ffc 100644 (file)
@@ -76,8 +76,6 @@ private:
   bool screenshot_requested; /**< true if a screenshot should be taken after the next frame has been rendered */
 };
 
-extern ScreenManager* g_screen_manager;
-
 #endif
 
 /* EOF */
index 07de751..02ac4a9 100644 (file)
@@ -19,6 +19,7 @@
 #include "physfs/ifile_stream.hpp"
 #include "scripting/serialize.hpp"
 #include "scripting/squirrel_util.hpp"
+#include "supertux/globals.hpp"
 #include "supertux/screen_manager.hpp"
 #include "supertux/player_status.hpp"
 #include "supertux/world.hpp"
index 6265a1a..b15d80b 100644 (file)
 Surface::Surface(const std::string& file) :
   texture(texture_manager->get(file)),
   surface_data(),
-  x(0), y(0), w(0), h(0),
+  x(0),
+  y(0), 
+  w(0), 
+  h(0),
   flipx(false)
 {
   texture->ref();
@@ -38,7 +41,10 @@ Surface::Surface(const std::string& file) :
 Surface::Surface(const std::string& file, int x, int y, int w, int h) :
   texture(texture_manager->get(file)),
   surface_data(),
-  x(x), y(y), w(w), h(h),
+  x(x), 
+  y(y),
+  w(w),
+  h(h),
   flipx(false)
 {
   texture->ref();
@@ -48,8 +54,10 @@ Surface::Surface(const std::string& file, int x, int y, int w, int h) :
 Surface::Surface(const Surface& other) :
   texture(other.texture),
   surface_data(),
-  x(other.x), y(other.y),
-  w(other.w), h(other.h),
+  x(other.x), 
+  y(other.y),
+  w(other.w), 
+  h(other.h),
   flipx(false)
 {
   texture->ref();
@@ -57,7 +65,7 @@ Surface::Surface(const Surface& other) :
 }
 
 const Surface& 
-Surface::operator= (const Surface& other)
+Surface::operator=(const Surface& other)
 {
   other.texture->ref();
   texture->unref();
index 589fd95..74710bd 100644 (file)
@@ -22,6 +22,7 @@
 #include <assert.h>
 #include <string>
 
+#include "supertux/globals.hpp"
 #include "video/texture_manager.hpp"
 
 /// bitset for drawing effects
index c15d4cf..ca311ed 100644 (file)
@@ -25,8 +25,6 @@
 #include "video/gl/gl_texture.hpp"
 #include "video/video_systems.hpp"
 
-TextureManager* texture_manager = NULL;
-
 TextureManager::TextureManager() :
   image_textures()
 #ifdef HAVE_OPENGL
index e404790..496c415 100644 (file)
@@ -77,8 +77,6 @@ private:
 #endif
 };
 
-extern TextureManager* texture_manager;
-
 #endif
 
 /* EOF */
index 82e87ad..c61e667 100644 (file)
@@ -45,7 +45,7 @@
 #include "sprite/sprite_manager.hpp"
 #include "supertux/game_session.hpp"
 #include "supertux/globals.hpp"
-#include "supertux/mainloop.hpp"
+#include "supertux/screen_manager.hpp"
 #include "supertux/menu/menu_storage.hpp"
 #include "supertux/menu/options_menu.hpp"
 #include "supertux/menu/worldmap_menu.hpp"
@@ -294,8 +294,8 @@ WorldMap::move_to_spawnpoint(const std::string& spawnpoint, bool pan)
 void
 WorldMap::change(const std::string& filename, const std::string& force_spawnpoint)
 {
-  g_main_loop->exit_screen();
-  g_main_loop->push_screen(new WorldMap(filename, force_spawnpoint));
+  g_screen_manager->exit_screen();
+  g_screen_manager->push_screen(new WorldMap(filename, force_spawnpoint));
 }
 
 void
@@ -597,7 +597,7 @@ WorldMap::update(float delta)
             MenuManager::set_current(0);
             break;
           case MNID_QUITWORLDMAP: // Quit Worldmap
-            g_main_loop->exit_screen();
+            g_screen_manager->exit_screen();
             break;
         }
       }
@@ -723,7 +723,7 @@ WorldMap::update(float delta)
           // update state and savegame
           save_state();
 
-          g_main_loop->push_screen(new GameSession(levelfile, &level->statistics),
+          g_screen_manager->push_screen(new GameSession(levelfile, &level->statistics),
                                    new ShrinkFade(shrinkpos, 1.0f));
           in_level = true;
         } catch(std::exception& e) {