X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsupertux.cpp;h=c29d7f3b7ca9c122832469720245ddf21c964c33;hb=935c2f6a2a27248de63fba86b74a724675761487;hp=6d17be69789a99dbd5bb5ac9bc6fc3bd8522794e;hpb=03fe5c560a616e7d38a8b1d5d11bfe4675fa8896;p=supertux.git diff --git a/src/supertux.cpp b/src/supertux.cpp index 6d17be697..c29d7f3b7 100644 --- a/src/supertux.cpp +++ b/src/supertux.cpp @@ -19,46 +19,75 @@ // 02111-1307, USA. #include -#include +#include #include - #include -#include "exceptions.h" +#include "utils/exceptions.h" #include "defines.h" -#include "globals.h" -#include "setup.h" +#include "app/globals.h" +#include "app/setup.h" #include "intro.h" #include "title.h" #include "gameloop.h" #include "leveleditor.h" -#include "screen/screen.h" +#include "video/screen.h" #include "worldmap.h" #include "resources.h" -#include "screen/texture.h" -#include "tile.h" +#include "video/surface.h" +#include "tile_manager.h" +#include "app/gettext.h" +#include "player.h" +#include "misc.h" +#include "utils/configfile.h" int main(int argc, char * argv[]) { +#ifndef DEBUG try { - st_directory_setup(); - parseargs(argc, argv); +#endif + config = new MyConfig; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + bind_textdomain_codeset(PACKAGE, "ISO-8859-1"); + + Setup::info(PACKAGE_NAME,PACKAGE,PACKAGE_VERSION); + + Setup::directories(); + Setup::parseargs(argc, argv); - st_audio_setup(); - st_video_setup(); - st_joystick_setup(); - st_general_setup(); + Setup::audio(); + Setup::video(SCREEN_W,SCREEN_H); + Setup::joystick(); + Setup::general(); st_menu(); loadshared(); - if (launch_leveleditor_mode && level_startup_file) + if (launch_leveleditor_mode) { - // TODO - // leveleditor(level_startup_file); + LevelEditor leveleditor; + + if(level_startup_file) + leveleditor.run(level_startup_file); + else + leveleditor.run(); + } + else if (launch_worldmap_mode && level_startup_file) + { + // hack to make it possible for someone to give an absolute path + std::string str(level_startup_file); + unsigned int i = str.find_last_of("/", str.size()); + if(i != std::string::npos) + str.erase(0, i+1); + + WorldMapNS::WorldMap worldmap; + worldmap.loadmap(str); + worldmap.display(); } else if (level_startup_file) { - GameSession session(level_startup_file, 1, ST_GL_LOAD_LEVEL_FILE); + GameSession session(level_startup_file, ST_GL_LOAD_LEVEL_FILE); session.run(); } else @@ -67,15 +96,17 @@ int main(int argc, char * argv[]) } SDL_FillRect(screen, 0, 0); - SDL_Flip(screen); + //SDL_Flip(screen); unloadshared(); - st_general_free(); + Setup::general_free(); + st_menu_free(); TileManager::destroy_instance(); #ifdef DEBUG Surface::debug_check(); #endif - st_shutdown(); + Termination::shutdown(); +#ifndef DEBUG // we want to see the backtrace in gdb when in debug mode } catch (SuperTuxException &e) { @@ -85,6 +116,7 @@ int main(int argc, char * argv[]) { std:: cerr << "Unhandled exception: " << e.what() << std::endl; } +#endif return 0; }