// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Core/Types/String.h"
#include "Engine/Core/Types/Nullable.h"
///
/// Command line options helper.
///
class CommandLine
{
public:
struct OptionsData
{
///
/// The command line.
///
const Char* CmdLine = nullptr;
///
/// -widowed (use windowed mode)
///
Nullable Windowed;
///
/// -fullscreen (use fullscreen)
///
Nullable Fullscreen;
///
/// -vsync (enable vertical synchronization)
///
Nullable VSync;
///
/// -novsync (disable vertical synchronization)
///
Nullable NoVSync;
///
/// -nolog (disable output log file)
///
Nullable NoLog;
///
/// -std (redirect log to standard output)
///
Nullable Std;
#if !BUILD_RELEASE
///
/// -debug !ip:port! (Mono debugger address)
///
Nullable DebuggerAddress;
///
/// -debugwait (instructs Mono debugger to wait for client attach for 5 seconds)
///
Nullable WaitForDebugger;
#endif
#if PLATFORM_HAS_HEADLESS_MODE
///
/// -headless (Run without windows, used by CL)
///
Nullable Headless;
#endif
///
/// -d3d12 (forces to use DirectX 12 rendering backend if available)
///
Nullable D3D12;
///
/// -d3d11 (forces to use DirectX 11 rendering backend if available)
///
Nullable D3D11;
///
/// -d3d10 (forces to use DirectX 10 rendering backend if available)
///
Nullable D3D10;
///
/// -null (forces to use Null rendering backend if available)
///
Nullable Null;
///
/// -vulkan (forces to use Vulkan rendering backend if available)
///
Nullable Vulkan;
///
/// -nvidia (hints to use NVIDIA GPU if available)
///
Nullable NVIDIA;
///
/// -amd (hints to use AMD GPU if available)
///
Nullable AMD;
///
/// -intel (hints to use Intel GPU if available)
///
Nullable Intel;
///
/// -monolog (enables advanced debugging for Mono runtime)
///
Nullable MonoLog;
///
/// -mute (disables audio playback and uses Null Audio Backend)
///
Nullable Mute;
///
/// -lowdpi (disables High DPI awareness support)
///
Nullable LowDPI;
#if USE_EDITOR
///
/// -project !path! (Startup project path)
///
String Project;
///
/// -new (generates the project files inside the specified project folder or uses current workspace folder)
///
Nullable NewProject;
///
/// -genprojectfiles (generates the scripts project files)
///
Nullable GenProjectFiles;
///
/// -clearcache (clear project cache folder)
///
Nullable ClearCache;
///
/// -clearcooker (clear Game Cooker cache folder)
///
Nullable ClearCookerCache;
///
/// The build preset (-build !preset.target! or -build !preset!) (run game building on startup and exit app on end).
///
Nullable Build;
///
/// -skipcompile (skips the scripts compilation on editor startup, useful when launching engine from IDE)
///
Nullable SkipCompile;
///
/// -shaderdebug (enables debugging data generation for shaders and disables shader compiler optimizations)
///
Nullable ShaderDebug;
///
/// -play !guid! ( Scene to play, can be empty to use default )
///
Nullable Play;
#endif
};
///
/// The input options.
///
static OptionsData Options;
public:
///
/// Parses the input command line.
///
/// The command line.
/// True if failed, otherwise false.
static bool Parse(const Char* cmdLine);
};