diff options
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/main/main.cpp b/main/main.cpp index e4e2616698..c294926045 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "main.h" +#include "app_icon.h" #include "core/register_core_types.h" #include "drivers/register_driver_types.h" #include "global_config.h" @@ -128,7 +129,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur.\n"); OS::get_singleton()->print("Usage: %s [options] [scene]\n", p_binary); OS::get_singleton()->print("Options:\n"); - OS::get_singleton()->print("\t-path [dir] : Path to a game, containing godot.cfg\n"); + OS::get_singleton()->print("\t-path [dir] : Path to a game, containing *.godot\n"); #ifdef TOOLS_ENABLED OS::get_singleton()->print("\t-e,-editor : Bring up the editor instead of running the scene.\n"); #endif @@ -446,6 +447,23 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else { goto error; } + } else if (I->get().ends_with(".godot")) { + String path; + String file = I->get(); + int sep = MAX(file.find_last("/"), file.find_last("\\")); + if (sep == -1) + path = "."; + else { + path = file.substr(0, sep); + } + if (OS::get_singleton()->set_cwd(path) == OK) { + + } else { + game_path = path; + } +#ifdef TOOLS_ENABLED + editor = true; +#endif } else if (I->get() == "-bp") { // /breakpoints if (I->next()) { @@ -672,7 +690,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph else input_map->load_from_globals(); //keys for game - if (video_driver == "") // specified in godot.cfg + if (video_driver == "") // specified in *.godot video_driver = GLOBAL_DEF("display/driver/name", Variant((const char *)OS::get_singleton()->get_video_driver_name(0))); if (!force_res && use_custom_res && globals->has("display/window/width")) @@ -724,7 +742,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph /* Determine Video Driver */ - if (audio_driver == "") { // specified in godot.cfg + if (audio_driver == "") { // specified in *.godot audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0)); } @@ -885,6 +903,9 @@ Error Main::setup2() { } else if (init_fullscreen) { OS::get_singleton()->set_window_fullscreen(true); } + + register_server_types(); + MAIN_PRINT("Main: Load Remaps"); Color clear = GLOBAL_DEF("rendering/viewport/default_clear_color", Color(0.3, 0.3, 0.3)); @@ -953,7 +974,6 @@ Error Main::setup2() { MAIN_PRINT("Main: Load Scene Types"); register_scene_types(); - register_server_types(); GLOBAL_DEF("display/mouse_cursor/custom_image", String()); GLOBAL_DEF("display/mouse_cursor/custom_image_hotspot", Vector2()); @@ -1232,7 +1252,7 @@ bool Main::start() { String stretch_mode = GLOBAL_DEF("display/stretch/mode", "disabled"); String stretch_aspect = GLOBAL_DEF("display/stretch/aspect", "ignore"); - Size2i stretch_size = Size2(GLOBAL_DEF("display/screen/width", 0), GLOBAL_DEF("display/screen/height", 0)); + Size2i stretch_size = Size2(GLOBAL_DEF("display/window/width", 0), GLOBAL_DEF("display/window/height", 0)); SceneTree::StretchMode sml_sm = SceneTree::STRETCH_MODE_DISABLED; if (stretch_mode == "2d") |