Merge branch 'game-arg' of git://github.com/jb-perrier/FlaxEngine into jb-perrier-game-arg

This commit is contained in:
Wojtek Figat
2021-05-24 18:35:13 +02:00
7 changed files with 85 additions and 5 deletions

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);
@@ -137,6 +154,7 @@ bool CommandLine::Parse(const Char* cmdLine)
PARSE_ARG_SWITCH("-build ", Build);
PARSE_BOOL_SWITCH("-skipcompile ", SkipCompile);
PARSE_BOOL_SWITCH("-shaderdebug ", ShaderDebug);
PARSE_ARG_OPT_SWITCH("-play ", Play);
#endif

View File

@@ -164,6 +164,11 @@ public:
/// </summary>
Nullable<bool> ShaderDebug;
/// <summary>
/// -play !guid! ( Scene to play, can be empty to use default )
/// </summary>
Nullable<String> Play;
#endif
};