#include "scripting/squirrel_util.hpp"
#include "scripting/time_scheduler.hpp"
-extern float g_game_speed;
-
namespace Scripting {
SQInteger display(HSQUIRRELVM vm)
std::string translate(const std::string& text)
{
- return dictionary_manager.get_dictionary().translate(text);
+ return dictionary_manager->get_dictionary().translate(text);
}
void display_text_file(const std::string& filename)
#include "util/file_system.hpp"
#include "util/reader.hpp"
-SpriteManager* sprite_manager = NULL;
-
SpriteManager::SpriteManager() :
sprites()
{
SpriteData* load(const std::string& filename);
};
-extern SpriteManager* sprite_manager;
-
#endif
/* EOF */
SDL_Surface* g_screen;
JoystickKeyboardController* g_main_controller = 0;
-tinygettext::DictionaryManager dictionary_manager;
+tinygettext::DictionaryManager* dictionary_manager = 0;
int SCREEN_WIDTH;
int SCREEN_HEIGHT;
float game_time = 0;
float real_time = 0;
+TileManager* tile_manager = NULL;
+TileSet* current_tileset = NULL;
+
+SpriteManager* sprite_manager = NULL;
+
+float g_game_speed = 1.0f;
+
/* EOF */
#ifndef HEADER_SUPERTUX_SUPERTUX_GLOBALS_HPP
#define HEADER_SUPERTUX_SUPERTUX_GLOBALS_HPP
-#include <SDL.h>
-
+typedef struct SDL_Surface SDL_Surface;
+namespace tinygettext { class DictionaryManager; }
class Config;
class JoystickKeyboardController;
-class SoundManager;
+class PlayerStatus;
class ScreenManager;
+class SoundManager;
+class SpriteManager;
class TextureManager;
+class TileManager;
+class TileSet;
/** The width of the display (this is a logical value, not the
physical value, since aspect_ration and projection_area might
extern Config* g_config;
+extern tinygettext::DictionaryManager* dictionary_manager;
+
extern float game_time;
extern float real_time;
+extern TileManager *tile_manager;
+
+/** this is only set while loading a map */
+extern TileSet *current_tileset;
+
+// global player state
+extern PlayerStatus* player_status;
+
+extern SpriteManager* sprite_manager;
+
+extern float g_game_speed;
+
#endif
/* EOF */
void
Main::init_tinygettext()
{
+ dictionary_manager = new tinygettext::DictionaryManager();
tinygettext::Log::set_log_info_callback(0);
- dictionary_manager.set_filesystem(std::auto_ptr<tinygettext::FileSystem>(new PhysFSFileSystem));
+ dictionary_manager->set_filesystem(std::auto_ptr<tinygettext::FileSystem>(new PhysFSFileSystem));
- dictionary_manager.add_directory("locale");
- dictionary_manager.set_charset("UTF-8");
+ dictionary_manager->add_directory("locale");
+ dictionary_manager->set_charset("UTF-8");
// Config setting "locale" overrides language detection
- if (g_config->locale != "") {
- dictionary_manager.set_language(tinygettext::Language::from_name(g_config->locale));
+ if (g_config->locale != "")
+ {
+ dictionary_manager->set_language(tinygettext::Language::from_name(g_config->locale));
}
}
add_entry(MNID_LANGUAGE_ENGLISH, "English");
int mnid = MNID_LANGUAGE_NEXT;
- std::set<tinygettext::Language> languages = dictionary_manager.get_languages();
+ std::set<tinygettext::Language> languages = dictionary_manager->get_languages();
for (std::set<tinygettext::Language>::iterator i = languages.begin(); i != languages.end(); i++)
{
add_entry(mnid++, i->get_name());
tinygettext::Language language = tinygettext::Language::from_spec(locale->lang, locale->country, locale->variant);
FL_FreeLocale(&locale);
- dictionary_manager.set_language(language);
+ dictionary_manager->set_language(language);
g_config->locale = language.str();
g_config->save();
MenuManager::pop_current();
else if (item->id == MNID_LANGUAGE_ENGLISH) // english
{
g_config->locale = "en";
- dictionary_manager.set_language(tinygettext::Language::from_name(g_config->locale));
+ dictionary_manager->set_language(tinygettext::Language::from_name(g_config->locale));
g_config->save();
MenuManager::pop_current();
}
else
{
int mnid = MNID_LANGUAGE_NEXT;
- std::set<tinygettext::Language> languages = dictionary_manager.get_languages();
+ std::set<tinygettext::Language> languages = dictionary_manager->get_languages();
for (std::set<tinygettext::Language>::iterator i = languages.begin(); i != languages.end(); i++)
{
if (item->id == mnid++)
{
g_config->locale = i->str();
- dictionary_manager.set_language(*i);
+ dictionary_manager->set_language(*i);
g_config->save();
MenuManager::pop_current();
break;
PlayerStatus& operator=(const PlayerStatus&);
};
-// global player state
-extern PlayerStatus* player_status;
-
#endif
/* EOF */
/** don't skip more than every 2nd frame */
static const int MAX_FRAME_SKIP = 2;
-float g_game_speed = 1.0f;
-
ScreenManager::ScreenManager() :
waiting_threads(),
running(),
#include "lisp/list_iterator.hpp"
#include "supertux/tile_set.hpp"
-TileManager* tile_manager = NULL;
-TileSet* current_tileset = NULL;
-
TileManager::TileManager() :
tilesets()
{
TileSet* parse_tileset_definition(const Reader& reader);
};
-extern TileManager *tile_manager;
-/** this is only set while loading a map */
-extern TileSet *current_tileset;
-
#endif
/* EOF */
#ifndef HEADER_SUPERTUX_UTIL_GETTEXT_HPP
#define HEADER_SUPERTUX_UTIL_GETTEXT_HPP
-#include "tinygettext/tinygettext.hpp"
+#include <tinygettext/tinygettext.hpp>
+#include <assert.h>
-extern tinygettext::DictionaryManager dictionary_manager;
+#include "supertux/globals.hpp"
static inline const char* _(const char* message)
{
- return dictionary_manager.get_dictionary().translate(message);
+ if (dictionary_manager)
+ {
+ return dictionary_manager->get_dictionary().translate(message);
+ }
+ else
+ {
+ return message;
+ }
}
static inline std::string _(const std::string& message)
{
- return dictionary_manager.get_dictionary().translate(message);
+ if (dictionary_manager)
+ {
+ return dictionary_manager->get_dictionary().translate(message);
+ }
+ else
+ {
+ return message;
+ }
}
#endif /* _LIBGETTEXT_H */