win32 main

This commit is contained in:
Eduardo Bart 2011-05-16 20:56:57 -03:00
parent 2d3add1b36
commit c5b462d5b9
2 changed files with 14 additions and 2 deletions

View File

@ -111,7 +111,7 @@ SET(SOURCES
IF(WIN32)
SET(SOURCES ${SOURCES} src/framework/platform/win32platform.cpp)
SET(ADDITIONAL_LIBRARIES ws2_32)
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501 -DWIN32_NO_CONSOLE)
ELSE(WIN32)
SET(SOURCES ${SOURCES} src/framework/platform/x11platform.cpp)
SET(ADDITIONAL_LIBRARIES pthread GLU)

View File

@ -75,8 +75,20 @@ void saveConfigs()
g_configs.save();
}
#ifdef WIN32_NO_CONSOLE
#include <windows.h>
int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument,int nCmdShow)
{
std::vector<std::string> args;
boost::split(args, lpszArgument, boost::is_any_of(" "));
#else
int main(int argc, const char *argv[])
{
std::vector<std::string> args;
for(int i=0;i<argc;++i)
args.push_back(argv[i]);
#endif
// install our signal handler
signal(SIGTERM, signal_handler);
signal(SIGINT, signal_handler);
@ -88,7 +100,7 @@ int main(int argc, const char *argv[])
std::srand(std::time(NULL));
// init resources
g_resources.init(argv[0]);
g_resources.init(args[0].c_str());
if(g_resources.setWriteDir(Platform::getAppUserDir()))
g_resources.addToSearchPath(Platform::getAppUserDir());
g_resources.addToSearchPath("data");