summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp48
1 files changed, 30 insertions, 18 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 5fd3786af9..bb6ab11362 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -157,6 +157,7 @@ static bool show_help = false;
static bool auto_quit = false;
static OS::ProcessID editor_pid = 0;
#ifdef TOOLS_ENABLED
+static bool found_project = false;
static bool auto_build_solutions = false;
static String debug_server_uri;
static int converter_max_kb_file = 4 * 1024; // 4MB
@@ -707,11 +708,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Vector<String> breakpoints;
bool use_custom_res = true;
bool force_res = false;
-#ifdef TOOLS_ENABLED
- bool found_project = false;
-#endif
String default_renderer = "";
+ String default_renderer_mobile = "";
String renderer_hints = "";
packed_data = PackedData::get_singleton();
@@ -1519,6 +1518,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// Start with RenderingDevice-based backends. Should be included if any RD driver present.
#ifdef VULKAN_ENABLED
renderer_hints = "forward_plus,mobile";
+ default_renderer_mobile = "mobile";
#endif
// And Compatibility next, or first if Vulkan is disabled.
@@ -1527,6 +1527,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
renderer_hints += ",";
}
renderer_hints += "gl_compatibility";
+ if (default_renderer_mobile.is_empty()) {
+ default_renderer_mobile = "gl_compatibility";
+ }
#endif
if (renderer_hints.is_empty()) {
ERR_PRINT("No renderers available.");
@@ -1618,7 +1621,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
default_renderer = renderer_hints.get_slice(",", 0);
GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method", default_renderer);
- GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method.mobile", default_renderer);
+ GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method.mobile", default_renderer_mobile);
GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method.web", "gl_compatibility"); // This is a bit of a hack until we have WebGPU support.
ProjectSettings::get_singleton()->set_custom_property_info("rendering/renderer/rendering_method",
@@ -1672,13 +1675,19 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (bool(GLOBAL_GET("display/window/size/borderless"))) {
window_flags |= DisplayServer::WINDOW_FLAG_BORDERLESS_BIT;
}
- if (bool(GLOBAL_GET("display/window/size/fullscreen"))) {
- window_mode = DisplayServer::WINDOW_MODE_FULLSCREEN;
- }
-
if (bool(GLOBAL_GET("display/window/size/always_on_top"))) {
window_flags |= DisplayServer::WINDOW_FLAG_ALWAYS_ON_TOP_BIT;
}
+ if (bool(GLOBAL_GET("display/window/size/transparent"))) {
+ window_flags |= DisplayServer::WINDOW_FLAG_TRANSPARENT_BIT;
+ }
+ if (bool(GLOBAL_GET("display/window/size/extend_to_title"))) {
+ window_flags |= DisplayServer::WINDOW_FLAG_EXTEND_TO_TITLE_BIT;
+ }
+ if (bool(GLOBAL_GET("display/window/size/no_focus"))) {
+ window_flags |= DisplayServer::WINDOW_FLAG_NO_FOCUS_BIT;
+ }
+ window_mode = (DisplayServer::WindowMode)(GLOBAL_GET("display/window/size/mode").operator int());
}
GLOBAL_DEF_RST("internationalization/rendering/force_right_to_left_layout_direction", false);
@@ -1697,13 +1706,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
if (rtm >= 0 && rtm < 3) {
-#ifdef NO_THREADS
- rtm = OS::RENDER_THREAD_UNSAFE; // No threads available on this platform.
-#else
if (editor) {
rtm = OS::RENDER_THREAD_SAFE;
}
-#endif
OS::get_singleton()->_render_thread_mode = OS::RenderThreadMode(rtm);
}
@@ -1770,10 +1775,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
PropertyInfo(Variant::INT, "physics/common/physics_ticks_per_second",
PROPERTY_HINT_RANGE, "1,1000,1"));
Engine::get_singleton()->set_physics_jitter_fix(GLOBAL_DEF("physics/common/physics_jitter_fix", 0.5));
- Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/settings/fps/force_fps", 0));
- ProjectSettings::get_singleton()->set_custom_property_info("debug/settings/fps/force_fps",
+ Engine::get_singleton()->set_max_fps(GLOBAL_DEF("application/run/max_fps", 0));
+ ProjectSettings::get_singleton()->set_custom_property_info("application/run/max_fps",
PropertyInfo(Variant::INT,
- "debug/settings/fps/force_fps",
+ "application/run/max_fps",
PROPERTY_HINT_RANGE, "0,1000,1"));
GLOBAL_DEF("debug/settings/stdout/print_fps", false);
@@ -1803,6 +1808,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
"0,33200,1,or_greater")); // No negative numbers
GLOBAL_DEF("display/window/ios/hide_home_indicator", true);
+ GLOBAL_DEF("display/window/ios/hide_status_bar", true);
+ GLOBAL_DEF("display/window/ios/suppress_ui_gesture", true);
GLOBAL_DEF("input_devices/pointing/ios/touch_delay", 0.15);
ProjectSettings::get_singleton()->set_custom_property_info("input_devices/pointing/ios/touch_delay",
PropertyInfo(Variant::FLOAT,
@@ -1923,15 +1930,20 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
// Print engine name and version
print_line(String(VERSION_NAME) + " v" + get_full_version_string() + " - " + String(VERSION_WEBSITE));
-#if !defined(NO_THREADS)
if (p_main_tid_override) {
Thread::main_thread_id = p_main_tid_override;
}
-#endif
#ifdef TOOLS_ENABLED
if (editor || project_manager || cmdline_tool) {
EditorPaths::create();
+ if (found_project && EditorPaths::get_singleton()->is_self_contained()) {
+ if (ProjectSettings::get_singleton()->get_resource_path() == OS::get_singleton()->get_executable_path().get_base_dir()) {
+ ERR_PRINT("You are trying to run a self-contained editor at the same location as a project. This is not allowed, since editor files will mix with project files.");
+ OS::get_singleton()->set_exit_code(EXIT_FAILURE);
+ return FAILED;
+ }
+ }
}
#endif
@@ -2117,7 +2129,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
} else {
// Create a 1×1 transparent image. This will effectively hide the splash image.
boot_logo.instantiate();
- boot_logo->create(1, 1, false, Image::FORMAT_RGBA8);
+ boot_logo->initialize_data(1, 1, false, Image::FORMAT_RGBA8);
boot_logo->set_pixel(0, 0, Color(0, 0, 0, 0));
}