Add optional command line argument define.

This commit is contained in:
Jean-Baptiste Perrier
2021-05-20 17:13:36 +02:00
parent 2c51f79c0a
commit a69fa0b00d

View File

@@ -102,6 +102,23 @@ bool CommandLine::Parse(const Char* cmdLine)
*(end - len) = 0; \
end -= len; \
}
#define PARSE_ARG_OPT_SWITCH(text, field) \
pos = (Char*)StringUtils::FindIgnoreCase(buffer.Get(), TEXT(text)); \
if (pos) \
{ \
len = ARRAY_COUNT(text) - 1; \
if (ParseArg(pos + len, argStart, argEnd)) \
Options.field = String::Empty; \
else \
{ \
Options.field = String(argStart, static_cast<int32>(argEnd - argStart)); \
len = static_cast<int32>((argEnd - pos) + 1); \
Platform::MemoryCopy(pos, pos + len, (end - pos - len) * 2); \
*(end - len) = 0; \
end -= len; \
} \
}
PARSE_BOOL_SWITCH("-windowed ", Windowed);
PARSE_BOOL_SWITCH("-fullscreen ", Fullscreen);