X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsupertux.cpp;h=06cbbe73302928ddeb0ad267c8f074e0c2461b8d;hb=8e0bad9f82ccbc811a18edd7ce6c6f69c5bca082;hp=c9e22aa8460f103aea7f3d821f95f0bbd9607a6a;hpb=e46856769374c870a8c998ad530d018ec0ad6814;p=supertux.git diff --git a/src/supertux.cpp b/src/supertux.cpp index c9e22aa84..06cbbe733 100644 --- a/src/supertux.cpp +++ b/src/supertux.cpp @@ -17,52 +17,66 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. +#include #include -#include +#include #include - #include -#include "exceptions.h" +#include -#include "defines.h" -#include "globals.h" -#include "setup.h" -#include "intro.h" +#include "app/globals.h" +#include "app/setup.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 "gettext.h" +#include "video/surface.h" +#include "tile_manager.h" +#include "app/gettext.h" +#include "misc.h" +#include "utils/configfile.h" int main(int argc, char * argv[]) { #ifndef DEBUG try { #endif - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - bind_textdomain_codeset(PACKAGE, "ISO-8859-1"); - - st_directory_setup(); - parseargs(argc, argv); + config = new MyConfig; + + Setup::init(PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION); + + Setup::parseargs(argc, argv); - st_audio_setup(); - st_video_setup(); - st_joystick_setup(); - st_general_setup(); + Setup::audio(); + Setup::video(800, 600); + 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) { @@ -74,24 +88,15 @@ int main(int argc, char * argv[]) title(); } - SDL_FillRect(screen, 0, 0); - //SDL_Flip(screen); - unloadshared(); - st_general_free(); - TileManager::destroy_instance(); - #ifdef DEBUG + Setup::general_free(); + st_menu_free(); +#ifdef DEBUG Surface::debug_check(); - #endif - st_shutdown(); +#endif + Termination::shutdown(); #ifndef DEBUG // we want to see the backtrace in gdb when in debug mode - } - catch (SuperTuxException &e) - { - std::cerr << "Unhandled SuperTux exception:\n " << e.what_file() << ":" << e.what_line() << ": " << e.what() << std::endl; - } - catch (std::exception &e) - { + } catch (std::exception &e) { std:: cerr << "Unhandled exception: " << e.what() << std::endl; } #endif