Upped tinygettext to r177
[supertux.git] / src / supertux / main.cpp
index 4f0bf22..4979871 100644 (file)
 
 #ifdef MACOSX
 namespace supertux_apple {
-}
+#  include <CoreFoundation/CoreFoundation.h>
+} // namespace supertux_apple
 #endif
 
+#include "tinygettext/log.hpp"
+
 #include "addon/addon_manager.hpp"
 #include "audio/sound_manager.hpp"
 #include "binreloc/binreloc.h"
 #include "control/joystickkeyboardcontroller.hpp"
 #include "math/random_generator.hpp"
+#include "physfs/ifile_stream.hpp"
 #include "physfs/physfs_sdl.hpp"
+#include "physfs/physfs_file_system.hpp"
 #include "scripting/squirrel_util.hpp"
 #include "supertux/gameconfig.hpp"
+#include "supertux/globals.hpp"
 #include "supertux/mainloop.hpp"
 #include "supertux/resources.hpp"
-#include "supertux/title.hpp"
+#include "supertux/title_screen.hpp"
 #include "util/file_system.hpp"
 #include "util/gettext.hpp"
 #include "video/drawing_context.hpp"
@@ -44,13 +50,6 @@ namespace supertux_apple {
 
 namespace { DrawingContext *context_pointer; }
 
-SDL_Surface* g_screen;
-JoystickKeyboardController* g_main_controller = 0;
-TinyGetText::DictionaryManager dictionary_manager;
-
-int SCREEN_WIDTH;
-int SCREEN_HEIGHT;
-
 static void init_config()
 {
   g_config = new Config();
@@ -63,12 +62,15 @@ static void init_config()
 
 static void init_tinygettext()
 {
+  tinygettext::Log::set_log_info_callback(0);
+  dictionary_manager.set_filesystem(std::auto_ptr<tinygettext::FileSystem>(new PhysFSFileSystem));
+
   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( g_config->locale );
+    dictionary_manager.set_language(tinygettext::Language::from_name(g_config->locale));
   }
 }
 
@@ -519,6 +521,16 @@ static inline void timelog(const char* )
 }
 #endif
 
+std::istream* physfs_open_file(const char* name)
+{
+  return new IFileStream(name);
+}
+
+void physfs_free_list(char** name)
+{
+  PHYSFS_freeList(name);
+}
+
 int supertux_main(int argc, char** argv)
 {
   int result = 0;