diff options
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/main/main.cpp b/main/main.cpp index 04375666a9..9096b935c2 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -74,6 +74,7 @@ #include "performance.h" #include "translation.h" #include "version.h" +#include "version_hash.gen.h" static ProjectSettings *globals = NULL; static Engine *engine = NULL; @@ -122,6 +123,14 @@ static String unescape_cmdline(const String &p_str) { return p_str.replace("%20", " "); } +static String get_full_version_string() { + + String hash = String(VERSION_HASH); + if (hash.length() != 0) + hash = "." + hash.left(7); + return String(VERSION_MKSTRING) + hash; +} + //#define DEBUG_INIT #ifdef DEBUG_INIT @@ -132,7 +141,7 @@ static String unescape_cmdline(const String &p_str) { void Main::print_help(const char *p_binary) { - OS::get_singleton()->print(VERSION_FULL_NAME " - https://godotengine.org\n"); + print_line(String(_MKSTR(VERSION_NAME)) + " v" + get_full_version_string() + " - https://godotengine.org"); OS::get_singleton()->print("(c) 2007-2017 Juan Linietsky, Ariel Manzur.\n"); OS::get_singleton()->print("(c) 2014-2017 Godot Engine contributors.\n"); OS::get_singleton()->print("\n"); @@ -141,6 +150,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print("General options:\n"); OS::get_singleton()->print(" -h, --help Display this help message.\n"); + OS::get_singleton()->print(" --version Display the version string.\n"); OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n"); OS::get_singleton()->print(" --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n"); OS::get_singleton()->print("\n"); @@ -195,7 +205,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" --time-scale <scale> Force time scale (higher values are faster, 1.0 is normal speed).\n"); OS::get_singleton()->print(" --disable-render-loop Disable render loop so rendering only occurs when called explicitly from script.\n"); OS::get_singleton()->print(" --disable-crash-handler Disable crash handler when supported by the platform code.\n"); - OS::get_singleton()->print(" --fixed-fps <fps> Forces a fixed ratio between process and fixed_process timing, for use when precision is required, or when rendering to video files. Setting this will disable real-time syncronization, so that run speed is only capped by performance\n"); + OS::get_singleton()->print(" --fixed-fps <fps> Force a fixed number of frames per second. This setting disables real-time synchronization.\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Standalone tools:\n"); @@ -203,7 +213,7 @@ void Main::print_help(const char *p_binary) { #ifdef TOOLS_ENABLED OS::get_singleton()->print(" --export <target> Export the project using the given export target.\n"); OS::get_singleton()->print(" --export-debug Use together with --export, enables debug mode for the template.\n"); - OS::get_singleton()->print(" --doctool <file> Dump the whole engine API to <file> in XML format. If <file> exists, it will be merged.\n"); + OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n"); OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n"); #ifdef DEBUG_METHODS_ENABLED OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n"); @@ -268,7 +278,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph while (I) { I->get() = unescape_cmdline(I->get().strip_escapes()); - //print_line("CMD: "+I->get()); I = I->next(); } @@ -318,6 +327,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph show_help = true; goto error; + } else if (I->get() == "--version") { + + print_line(get_full_version_string()); + goto error; + } else if (I->get() == "--resolution") { // force resolution if (I->next()) { @@ -990,8 +1004,10 @@ Error Main::setup2(Thread::ID p_main_tid_override) { #endif } +#ifdef TOOLS_ENABLED Ref<Image> icon = memnew(Image(app_icon_png)); OS::get_singleton()->set_icon(icon); +#endif } MAIN_PRINT("Main: DCC"); @@ -1082,6 +1098,7 @@ bool Main::start() { ERR_FAIL_COND_V(!_start_success, false); + bool hasicon = false; bool editor = false; String doc_tool; List<String> removal_docs; @@ -1519,8 +1536,10 @@ bool Main::start() { if (iconpath != "") { Ref<Image> icon; icon.instance(); - if (icon->load(iconpath) == OK) + if (icon->load(iconpath) == OK) { OS::get_singleton()->set_icon(icon); + hasicon = true; + } } } } @@ -1537,6 +1556,11 @@ bool Main::start() { #endif } + if (!hasicon) { + Ref<Image> icon = memnew(Image(app_icon_png)); + OS::get_singleton()->set_icon(icon); + } + OS::get_singleton()->set_main_loop(main_loop); return true; |