00001 // 00002 // $Id: periapsis.cpp 2 2008-03-01 20:58:50Z kulibali $ 00003 // 00004 // Copyright (c) 2008, The Periapsis Project. All rights reserved. 00005 // 00006 // Redistribution and use in source and binary forms, with or without 00007 // modification, are permitted provided that the following conditions are 00008 // met: 00009 // 00010 // * Redistributions of source code must retain the above copyright notice, 00011 // this list of conditions and the following disclaimer. 00012 // 00013 // * Redistributions in binary form must reproduce the above copyright 00014 // notice, this list of conditions and the following disclaimer in the 00015 // documentation and/or other materials provided with the distribution. 00016 // 00017 // * Neither the name of the The Periapsis Project nor the names of its 00018 // contributors may be used to endorse or promote products derived from 00019 // this software without specific prior written permission. 00020 // 00021 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 00022 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00023 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00024 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 00025 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00026 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00027 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00028 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00029 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00030 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00031 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 // 00033 00034 #include "periapsis_app.hpp" 00035 00036 #include "data/exception.hpp" 00037 #include "data/log.hpp" 00038 #include "data/broker.hpp" 00039 #include "data/cache.hpp" 00040 00041 // 00042 00043 #ifdef WIN32 00044 #pragma warning (disable : 4996) 00045 #define WIN32_LEAN_AND_MEAN 00046 #include <windows.h> 00047 #endif 00048 00049 // 00050 00051 extern "C" { 00052 00053 int SDL_main(int argc, char *argv[]) 00054 { 00055 int res = 0; 00056 00057 try 00058 { 00059 #ifdef DEBUG 00060 // print debug output by default 00061 gsgl::data::debug_log_target debug_log; 00062 #endif 00063 00064 // create the application 00065 periapsis::periapsis_app app(L"Periapsis", argc, const_cast<const char **>(argv)); 00066 00067 // run the application 00068 app.run(); 00069 } 00070 catch (gsgl::exception & e) 00071 { 00072 #if defined(__APPLE__) 00073 short code; 00074 StandardAlert(kAlertStopAlert, "\pError", msg.p_string(), 0, &code); 00075 #elif defined(WIN32) 00076 MessageBox(0, e.get_message(), L"Error", MB_OK | MB_ICONERROR); 00077 #else 00078 #error Alert message box unimplemented! 00079 #endif 00080 00081 res = 1; 00082 } 00083 catch (...) 00084 { 00085 res = 1; 00086 } 00087 00088 return res; 00089 } // SDL_main() 00090 00091 } // extern "C"