win32 main
This commit is contained in:
parent
2d3add1b36
commit
c5b462d5b9
|
@ -111,7 +111,7 @@ SET(SOURCES
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(SOURCES ${SOURCES} src/framework/platform/win32platform.cpp)
|
SET(SOURCES ${SOURCES} src/framework/platform/win32platform.cpp)
|
||||||
SET(ADDITIONAL_LIBRARIES ws2_32)
|
SET(ADDITIONAL_LIBRARIES ws2_32)
|
||||||
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
|
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501 -DWIN32_NO_CONSOLE)
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
SET(SOURCES ${SOURCES} src/framework/platform/x11platform.cpp)
|
SET(SOURCES ${SOURCES} src/framework/platform/x11platform.cpp)
|
||||||
SET(ADDITIONAL_LIBRARIES pthread GLU)
|
SET(ADDITIONAL_LIBRARIES pthread GLU)
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -75,8 +75,20 @@ void saveConfigs()
|
||||||
g_configs.save();
|
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[])
|
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
|
// install our signal handler
|
||||||
signal(SIGTERM, signal_handler);
|
signal(SIGTERM, signal_handler);
|
||||||
signal(SIGINT, signal_handler);
|
signal(SIGINT, signal_handler);
|
||||||
|
@ -88,7 +100,7 @@ int main(int argc, const char *argv[])
|
||||||
std::srand(std::time(NULL));
|
std::srand(std::time(NULL));
|
||||||
|
|
||||||
// init resources
|
// init resources
|
||||||
g_resources.init(argv[0]);
|
g_resources.init(args[0].c_str());
|
||||||
if(g_resources.setWriteDir(Platform::getAppUserDir()))
|
if(g_resources.setWriteDir(Platform::getAppUserDir()))
|
||||||
g_resources.addToSearchPath(Platform::getAppUserDir());
|
g_resources.addToSearchPath(Platform::getAppUserDir());
|
||||||
g_resources.addToSearchPath("data");
|
g_resources.addToSearchPath("data");
|
||||||
|
|
Loading…
Reference in New Issue