summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/editor/editor_node.cpp13
-rw-r--r--tools/editor/editor_scale.cpp9
-rw-r--r--tools/editor/editor_scale.h2
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/project_manager.cpp15
5 files changed, 38 insertions, 3 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 72d5e496d9..4d92ffcc50 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -5256,6 +5256,19 @@ EditorNode::EditorNode() {
// load settings
if (!EditorSettings::get_singleton())
EditorSettings::create();
+ {
+ int dpi_mode = EditorSettings::get_singleton()->get("global/hdpi_mode");
+ print_line("DPI MODE: "+itos(dpi_mode));
+ if (dpi_mode==0) {
+ editor_set_hidpi( OS::get_singleton()->get_screen_dpi(0) > 150 );
+ } else if (dpi_mode==2) {
+ editor_set_hidpi(true);
+ } else {
+ editor_set_hidpi(false);
+ }
+ }
+
+
ResourceLoader::set_abort_on_missing_resources(false);
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));
diff --git a/tools/editor/editor_scale.cpp b/tools/editor/editor_scale.cpp
index ecb1e1816f..c332acc0ca 100644
--- a/tools/editor/editor_scale.cpp
+++ b/tools/editor/editor_scale.cpp
@@ -1,7 +1,14 @@
#include "editor_scale.h"
#include "os/os.h"
+static bool editor_hidpi=false;
+
+void editor_set_hidpi(bool p_hidpi) {
+
+ editor_hidpi=p_hidpi;
+}
+
bool editor_is_hidpi() {
- return OS::get_singleton()->get_screen_dpi(0) > 150;
+ return editor_hidpi;
}
diff --git a/tools/editor/editor_scale.h b/tools/editor/editor_scale.h
index 0f0e90595c..a60cf00f0a 100644
--- a/tools/editor/editor_scale.h
+++ b/tools/editor/editor_scale.h
@@ -1,7 +1,7 @@
#ifndef EDITOR_SCALE_H
#define EDITOR_SCALE_H
-
+void editor_set_hidpi(bool p_hidpi);
bool editor_is_hidpi();
#define EDSCALE (editor_is_hidpi() ? 2 : 1)
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 9dd00688c9..8b1b73d5d7 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -493,6 +493,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["global/editor_language"]=PropertyInfo(Variant::STRING,"global/editor_language",PROPERTY_HINT_ENUM,lang_hint,PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED);
}
+ set("global/hdpi_mode",0);
+ hints["global/hdpi_mode"]=PropertyInfo(Variant::INT,"global/hdpi_mode",PROPERTY_HINT_ENUM,"Auto,LoDPI,HiDPI",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED);
set("global/show_script_in_scene_tabs",false);
set("global/font_size",14);
hints["global/font_size"]=PropertyInfo(Variant::INT,"global/font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED);
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index af57d5264e..ca5e1ab0f3 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -45,8 +45,9 @@
#include "io/resource_saver.h"
#include "editor_icons.h"
+#include "editor_fonts.h"
-
+#include "editor_scale.h"
class NewProjectDialog : public ConfirmationDialog {
@@ -829,6 +830,17 @@ ProjectManager::ProjectManager() {
if (!EditorSettings::get_singleton())
EditorSettings::create();
+ {
+ int dpi_mode = EditorSettings::get_singleton()->get("global/hdpi_mode");
+ if (dpi_mode==0) {
+ editor_set_hidpi( OS::get_singleton()->get_screen_dpi(0) > 150 );
+ } else if (dpi_mode==2) {
+ editor_set_hidpi(true);
+ } else {
+ editor_set_hidpi(false);
+ }
+ }
+
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));
set_area_as_parent_rect();
@@ -836,6 +848,7 @@ ProjectManager::ProjectManager() {
Ref<Theme> theme = Ref<Theme>( memnew( Theme ) );
set_theme(theme);
editor_register_icons(theme);
+ editor_register_fonts(theme);
String global_font = EditorSettings::get_singleton()->get("global/font");
if (global_font!="") {