1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

[Headless] Add --headless switch (no rendering, no audio).

Also remove now unused "--no-window" option, and relative OS getter and
setter.
This commit is contained in:
Fabio Alessandrelli
2021-08-03 16:59:18 +02:00
parent 80fc90e82a
commit 09386ba9fd
6 changed files with 10 additions and 23 deletions

View File

@@ -326,9 +326,10 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --text-driver <driver> Text driver (Fonts, BiDi, shaping)\n");
OS::get_singleton()->print(" --headless Enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script.\n");
OS::get_singleton()->print("\n");
#ifndef SERVER_ENABLED
OS::get_singleton()->print("Display options:\n");
OS::get_singleton()->print(" -f, --fullscreen Request fullscreen mode.\n");
OS::get_singleton()->print(" -m, --maximized Request a maximized window.\n");
@@ -337,11 +338,9 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --resolution <W>x<H> Request window resolution.\n");
OS::get_singleton()->print(" --position <X>,<Y> Request window position.\n");
OS::get_singleton()->print(" --low-dpi Force low-DPI mode (macOS and Windows only).\n");
OS::get_singleton()->print(" --no-window Disable window creation (Windows only). Useful together with --script.\n");
OS::get_singleton()->print(" --single-window Use a single window (no separate subwindows).\n");
OS::get_singleton()->print(" --tablet-driver Pen tablet input driver.\n");
OS::get_singleton()->print("\n");
#endif
OS::get_singleton()->print("Debug options:\n");
OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n");
@@ -352,7 +351,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --gpu-abort Abort on GPU errors (usually validation layer errors), may help see the problem if your system freezes.\n");
#endif
OS::get_singleton()->print(" --remote-debug <uri> Remote debug (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007).\n");
#if defined(DEBUG_ENABLED) && !defined(SERVER_ENABLED)
#if defined(DEBUG_ENABLED)
OS::get_singleton()->print(" --debug-collisions Show collision shapes when running the scene.\n");
OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n");
#endif
@@ -728,7 +727,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing video driver argument, aborting.\n");
goto error;
}
#ifndef SERVER_ENABLED
} else if (I->get() == "-f" || I->get() == "--fullscreen") { // force fullscreen
init_fullscreen = true;
@@ -818,10 +816,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--low-dpi") { // force low DPI (macOS only)
force_lowdpi = true;
} else if (I->get() == "--no-window") { // disable window creation (Windows only)
} else if (I->get() == "--headless") { // enable headless mode (no audio, no rendering).
audio_driver = "Dummy";
display_driver = "headless";
OS::get_singleton()->set_no_window_mode(true);
#endif
} else if (I->get() == "--profiling") { // enable profiling
use_debug_profiler = true;