#include "system/system.h" #include "mx/args.h" #include #include #include int main(int argc, char **argv) { try { #ifdef WIN int sys_w=640, sys_h=480; #else int sys_w=-1, sys_h=-1; #endif mx::mxArgs argmx(argc, argv); std::string root_path = argmx.testForItem("--root"); if(root_path != "") { chdir(root_path.c_str()); } std::string inst = argmx.testForItem("--install"); if(inst != "") { std::cout << "installing [ " << inst << " ]\n"; char data[256]; #ifdef WIN sprintf(data, "mxp-i.exe --install=%s", inst.c_str()); #else sprintf(data,"mxp-i --install=%s", inst.c_str()); #endif system(data); std::cout << " done.\n"; } std::string str_w = argmx.testForItem("--width"); std::string str_h = argmx.testForItem("--height"); std::string str_r = argmx.testForItem("--resize"); if(str_w != "" && str_h != "") { sys_w=atoi(str_w.c_str()); sys_h=atoi(str_h.c_str()); if(str_r == "") { std::cerr << " error forget argument resize.. if setting manul window size\n"; return EXIT_FAILURE; } } else str_r = "true"; std::string full = ""; Uint32 flags = 0; full = argmx.testForItem("--full"); if(full == "true") flags = SDL_FULLSCREEN | SDL_NOFRAME; std::string exec = argmx.testForItem("--exec"); es::mainSystem sys(exec, sys_w,sys_h, flags); #ifndef WIN if(str_r == "true") sys.resize = true; else sys.resize = false; #else sys.resize = false; #endif return sys.messageLoop(); } catch( mx::mxException &e ) { e.printError(std::cerr); return EXIT_FAILURE; } catch( std::exception &e ) { std::cerr << e.what() << "\n"; return EXIT_FAILURE; } catch (...) { std::cerr << "Error unknown exepction...\n"; return EXIT_FAILURE; } return 0; }