From: grumbel Date: Thu, 19 Nov 2009 17:46:40 +0000 (+0000) Subject: Move some more globals to supertux/globals.hpp X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e7956824fe9a9c5acdf5f34faba0f82c433ad34c;p=supertux.git Move some more globals to supertux/globals.hpp git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6054 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- diff --git a/src/audio/sound_manager.cpp b/src/audio/sound_manager.cpp index 9a6b6c8df..ce1579fe7 100644 --- a/src/audio/sound_manager.cpp +++ b/src/audio/sound_manager.cpp @@ -32,13 +32,11 @@ * supertux... */ #ifdef alcGetString -#undef alcGetString +# undef alcGetString #endif -#define alcGetString(x,y) "" +# define alcGetString(x,y) "" #endif -SoundManager* sound_manager = 0; - SoundManager::SoundManager() : device(0), context(0), diff --git a/src/audio/sound_manager.hpp b/src/audio/sound_manager.hpp index 7791df1df..3744c6265 100644 --- a/src/audio/sound_manager.hpp +++ b/src/audio/sound_manager.hpp @@ -117,8 +117,6 @@ private: SoundManager& operator=(const SoundManager&); }; -extern SoundManager* sound_manager; - #endif /* EOF */ diff --git a/src/gui/button_group.cpp b/src/gui/button_group.cpp index 00e37b54a..0a2c7edd1 100644 --- a/src/gui/button_group.cpp +++ b/src/gui/button_group.cpp @@ -19,8 +19,6 @@ #include "supertux/globals.hpp" #include "video/drawing_context.hpp" -extern SDL_Surface* g_screen; - ButtonGroup::ButtonGroup(Vector pos_, Vector buttons_size_, Vector buttons_box_) : pos(pos_), buttons_size(buttons_size_), diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index 6e48496f2..48a4c879a 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -33,8 +33,6 @@ static const float MENU_REPEAT_INITIAL = 0.4f; static const float MENU_REPEAT_RATE = 0.1f; -extern SDL_Surface* g_screen; - Menu::Menu() : hit_item(), pos_x(), diff --git a/src/gui/mousecursor.cpp b/src/gui/mousecursor.cpp index b40a111d3..7139d2efb 100644 --- a/src/gui/mousecursor.cpp +++ b/src/gui/mousecursor.cpp @@ -22,7 +22,6 @@ #include "video/drawing_context.hpp" MouseCursor* MouseCursor::current_ = 0; -extern SDL_Surface* g_screen; MouseCursor::MouseCursor(std::string cursor_file) : mid_x(0), diff --git a/src/lisp/parser.cpp b/src/lisp/parser.cpp index c78255102..c0fc5f13c 100644 --- a/src/lisp/parser.cpp +++ b/src/lisp/parser.cpp @@ -22,6 +22,7 @@ #include "obstack/obstackpp.hpp" #include "physfs/ifile_stream.hpp" #include "physfs/ifile_streambuf.hpp" +#include "supertux/globals.hpp" #include "tinygettext/tinygettext.hpp" #include "supertux/gameconfig.hpp" diff --git a/src/supertux/gameconfig.cpp b/src/supertux/gameconfig.cpp index b9a299560..96dbdf7de 100644 --- a/src/supertux/gameconfig.cpp +++ b/src/supertux/gameconfig.cpp @@ -25,8 +25,6 @@ #include "util/reader.hpp" #include "supertux/globals.hpp" -Config* g_config = 0; - Config::Config() : profile(1), fullscreen_width (800), diff --git a/src/supertux/gameconfig.hpp b/src/supertux/gameconfig.hpp index 0fd89e6d1..6833c05b1 100644 --- a/src/supertux/gameconfig.hpp +++ b/src/supertux/gameconfig.hpp @@ -63,8 +63,6 @@ public: std::string locale; /**< force SuperTux language to this locale, e.g. "de". A file "data/locale/xx.po" must exist for this to work. An empty string means autodetect. */ }; -extern Config* g_config; - #endif /* EOF */ diff --git a/src/supertux/globals.cpp b/src/supertux/globals.cpp index c85a4467a..a89efb1e1 100644 --- a/src/supertux/globals.cpp +++ b/src/supertux/globals.cpp @@ -24,8 +24,15 @@ tinygettext::DictionaryManager dictionary_manager; int SCREEN_WIDTH; int SCREEN_HEIGHT; -ScreenManager* g_screen_manager = NULL; +ScreenManager* g_screen_manager = 0; -TextureManager* texture_manager = NULL; +TextureManager* texture_manager = 0; + +SoundManager* sound_manager = 0; + +Config* g_config = 0; + +float game_time = 0; +float real_time = 0; /* EOF */ diff --git a/src/supertux/globals.hpp b/src/supertux/globals.hpp index 6fe934f4e..86a62b4a4 100644 --- a/src/supertux/globals.hpp +++ b/src/supertux/globals.hpp @@ -19,7 +19,9 @@ #include +class Config; class JoystickKeyboardController; +class SoundManager; class ScreenManager; class TextureManager; @@ -42,6 +44,13 @@ extern ScreenManager* g_screen_manager; extern TextureManager* texture_manager; +extern SoundManager* sound_manager; + +extern Config* g_config; + +extern float game_time; +extern float real_time; + #endif /* EOF */ diff --git a/src/supertux/menu/keyboard_menu.cpp b/src/supertux/menu/keyboard_menu.cpp index a34b97428..883adef0b 100644 --- a/src/supertux/menu/keyboard_menu.cpp +++ b/src/supertux/menu/keyboard_menu.cpp @@ -19,6 +19,7 @@ #include "util/gettext.hpp" #include "supertux/gameconfig.hpp" +#include "supertux/globals.hpp" KeyboardMenu::KeyboardMenu(JoystickKeyboardController* _controller) : controller(_controller) diff --git a/src/supertux/menu/language_menu.cpp b/src/supertux/menu/language_menu.cpp index 5e110b08a..5b1fef398 100644 --- a/src/supertux/menu/language_menu.cpp +++ b/src/supertux/menu/language_menu.cpp @@ -18,11 +18,12 @@ #include "supertux/menu/language_menu.hpp" extern "C" { -#include "findlocale.h" +#include } #include "gui/menu_item.hpp" #include "gui/menu_manager.hpp" #include "supertux/gameconfig.hpp" +#include "supertux/globals.hpp" enum { MNID_LANGUAGE_AUTO_DETECT = 0, diff --git a/src/supertux/menu/profile_menu.cpp b/src/supertux/menu/profile_menu.cpp index 5ed50722d..f61b76dbc 100644 --- a/src/supertux/menu/profile_menu.cpp +++ b/src/supertux/menu/profile_menu.cpp @@ -21,6 +21,7 @@ #include "gui/menu_manager.hpp" #include "gui/menu_item.hpp" #include "supertux/gameconfig.hpp" +#include "supertux/globals.hpp" #include "util/gettext.hpp" ProfileMenu::ProfileMenu() diff --git a/src/supertux/timer.cpp b/src/supertux/timer.cpp index 8981c958b..90e765534 100644 --- a/src/supertux/timer.cpp +++ b/src/supertux/timer.cpp @@ -18,11 +18,10 @@ #include "supertux/timer.hpp" -float game_time = 0; -float real_time = 0; - -Timer::Timer() - : period(0), cycle_start(0), cyclic(false) +Timer::Timer() : + period(0), +cycle_start(0), + cyclic(false) { } diff --git a/src/supertux/timer.hpp b/src/supertux/timer.hpp index 9f2a5405a..646f0dd2b 100644 --- a/src/supertux/timer.hpp +++ b/src/supertux/timer.hpp @@ -17,8 +17,7 @@ #ifndef HEADER_SUPERTUX_SUPERTUX_TIMER_HPP #define HEADER_SUPERTUX_SUPERTUX_TIMER_HPP -extern float game_time; -extern float real_time; +#include "supertux/globals.hpp" /** * Simple timer designed to be used in the update functions of objects