mirror of
https://github.com/isledecomp/LEGOIslandRebuilder.git
synced 2024-11-23 15:48:03 -05:00
app: added command line handling
This commit is contained in:
parent
269f7793b0
commit
572afe8619
1 changed files with 33 additions and 5 deletions
30
src/app.cpp
30
src/app.cpp
|
@ -1,19 +1,47 @@
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
|
#include "launcher.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
CRebuilderApp g_AppInstance;
|
CRebuilderApp g_AppInstance;
|
||||||
|
|
||||||
CRebuilderApp::CRebuilderApp()
|
CRebuilderApp::CRebuilderApp()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CRebuilderApp::InitInstance()
|
BOOL CRebuilderApp::InitInstance()
|
||||||
{
|
{
|
||||||
|
bool run_only = false;
|
||||||
|
|
||||||
|
char *tokens = strtok(m_lpCmdLine, " ");
|
||||||
|
while (tokens) {
|
||||||
|
if (!strcmp(tokens, "--run") || !strcmp(tokens, "-r")) {
|
||||||
|
run_only = true;
|
||||||
|
} else if (!strcmp(tokens, "--help") || !strcmp(tokens, "-h")) {
|
||||||
|
::MessageBoxA(0, "LEGO Island Rebuilder\n"
|
||||||
|
"\n"
|
||||||
|
"Supported arguments:\n"
|
||||||
|
"\n"
|
||||||
|
"--help, -h\n"
|
||||||
|
"Displays this help page.\n"
|
||||||
|
"\n"
|
||||||
|
"--run, -r\n"
|
||||||
|
"Run LEGO Island immediately with the last used configuration.",
|
||||||
|
"Command Line Argument Help", 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
tokens = strtok(NULL, " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!run_only) {
|
||||||
m_pMainWnd = new CRebuilderWindow();
|
m_pMainWnd = new CRebuilderWindow();
|
||||||
m_pMainWnd->ShowWindow(m_nCmdShow);
|
m_pMainWnd->ShowWindow(m_nCmdShow);
|
||||||
m_pMainWnd->UpdateWindow();
|
m_pMainWnd->UpdateWindow();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
Launcher::Launch(NULL);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue