summaryrefslogtreecommitdiff
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp71
1 files changed, 32 insertions, 39 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 75c4433b41..a99e1c409d 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -641,6 +641,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
bool found_project = false;
#endif
+ String default_renderer = "";
+ String renderer_hints = "";
+
packed_data = PackedData::get_singleton();
if (!packed_data) {
packed_data = memnew(PackedData);
@@ -1306,14 +1309,33 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// possibly be worth changing the default from vulkan to something lower spec,
// for the project manager, depending on how smooth the fallback is.
- GLOBAL_DEF_RST("rendering/driver/driver_name", "vulkan");
// this list is hard coded, which makes it more difficult to add new backends.
// can potentially be changed to more of a plugin system at a later date.
+
+ // Start with Vulkan, which will be the default if enabled.
+#ifdef VULKAN_ENABLED
+ renderer_hints = "vulkan";
+#endif
+
+ // And OpenGL3 next, or first if Vulkan is disabled.
+#ifdef GLES3_ENABLED
+ if (!renderer_hints.is_empty()) {
+ renderer_hints += ",";
+ }
+ renderer_hints += "opengl3";
+#endif
+ if (renderer_hints.is_empty()) {
+ ERR_PRINT("No rendering driver available.");
+ }
+
+ default_renderer = renderer_hints.get_slice(",", 0);
+ GLOBAL_DEF_RST("rendering/driver/driver_name", default_renderer);
+
ProjectSettings::get_singleton()->set_custom_property_info("rendering/driver/driver_name",
PropertyInfo(Variant::STRING,
"rendering/driver/driver_name",
- PROPERTY_HINT_ENUM, "vulkan,opengl3"));
+ PROPERTY_HINT_ENUM, renderer_hints));
// if not set on the command line
if (rendering_driver.is_empty()) {
@@ -1328,35 +1350,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// always convert to lower case for consistency in the code
rendering_driver = rendering_driver.to_lower();
- GLOBAL_DEF_BASIC("display/window/size/viewport_width", 1024);
- ProjectSettings::get_singleton()->set_custom_property_info("display/window/size/viewport_width",
- PropertyInfo(Variant::INT, "display/window/size/viewport_width",
- PROPERTY_HINT_RANGE,
- "0,7680,1,or_greater")); // 8K resolution
-
- GLOBAL_DEF_BASIC("display/window/size/viewport_height", 600);
- ProjectSettings::get_singleton()->set_custom_property_info("display/window/size/viewport_height",
- PropertyInfo(Variant::INT, "display/window/size/viewport_height",
- PROPERTY_HINT_RANGE,
- "0,4320,1,or_greater")); // 8K resolution
-
- GLOBAL_DEF_BASIC("display/window/size/resizable", true);
- GLOBAL_DEF_BASIC("display/window/size/borderless", false);
- GLOBAL_DEF_BASIC("display/window/size/fullscreen", false);
- GLOBAL_DEF("display/window/size/always_on_top", false);
- GLOBAL_DEF("display/window/size/window_width_override", 0);
- ProjectSettings::get_singleton()->set_custom_property_info("display/window/size/window_width_override",
- PropertyInfo(Variant::INT,
- "display/window/size/window_width_override",
- PROPERTY_HINT_RANGE,
- "0,7680,1,or_greater")); // 8K resolution
- GLOBAL_DEF("display/window/size/window_height_override", 0);
- ProjectSettings::get_singleton()->set_custom_property_info("display/window/size/window_height_override",
- PropertyInfo(Variant::INT,
- "display/window/size/window_height_override",
- PROPERTY_HINT_RANGE,
- "0,4320,1,or_greater")); // 8K resolution
-
if (use_custom_res) {
if (!force_res) {
window_size.width = GLOBAL_GET("display/window/size/viewport_width");
@@ -2156,8 +2149,8 @@ bool Main::start() {
doc.generate(doc_base);
DocTools docsrc;
- Map<String, String> doc_data_classes;
- Set<String> checked_paths;
+ HashMap<String, String> doc_data_classes;
+ RBSet<String> checked_paths;
print_line("Loading docs...");
for (int i = 0; i < _doc_data_class_path_count; i++) {
@@ -2196,7 +2189,7 @@ bool Main::start() {
print_line("Merging docs...");
doc.merge_from(docsrc);
- for (Set<String>::Element *E = checked_paths.front(); E; E = E->next()) {
+ for (RBSet<String>::Element *E = checked_paths.front(); E; E = E->next()) {
print_line("Erasing old docs at: " + E->get());
err = DocTools::erase_classes(E->get());
ERR_FAIL_COND_V_MSG(err != OK, false, "Error erasing old docs at: " + E->get() + ": " + itos(err));
@@ -2329,11 +2322,11 @@ bool Main::start() {
if (!project_manager && !editor) { // game
if (!game_path.is_empty() || !script.is_empty()) {
//autoload
- OrderedHashMap<StringName, ProjectSettings::AutoloadInfo> autoloads = ProjectSettings::get_singleton()->get_autoload_list();
+ HashMap<StringName, ProjectSettings::AutoloadInfo> autoloads = ProjectSettings::get_singleton()->get_autoload_list();
//first pass, add the constants so they exist before any script is loaded
- for (OrderedHashMap<StringName, ProjectSettings::AutoloadInfo>::Element E = autoloads.front(); E; E = E.next()) {
- const ProjectSettings::AutoloadInfo &info = E.get();
+ for (const KeyValue<StringName, ProjectSettings::AutoloadInfo> &E : autoloads) {
+ const ProjectSettings::AutoloadInfo &info = E.value;
if (info.is_singleton) {
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
@@ -2344,8 +2337,8 @@ bool Main::start() {
//second pass, load into global constants
List<Node *> to_add;
- for (OrderedHashMap<StringName, ProjectSettings::AutoloadInfo>::Element E = autoloads.front(); E; E = E.next()) {
- const ProjectSettings::AutoloadInfo &info = E.get();
+ for (const KeyValue<StringName, ProjectSettings::AutoloadInfo> &E : autoloads) {
+ const ProjectSettings::AutoloadInfo &info = E.value;
Ref<Resource> res = ResourceLoader::load(info.path);
ERR_CONTINUE_MSG(res.is_null(), "Can't autoload: " + info.path);