aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/map/auto_setup/environment_setup.gd16
-rw-r--r--client/map/auto_setup/light_setup.gd9
-rw-r--r--client/menu/setup.tscn2
-rw-r--r--client/settings.gd27
4 files changed, 26 insertions, 28 deletions
diff --git a/client/map/auto_setup/environment_setup.gd b/client/map/auto_setup/environment_setup.gd
index 49f93ccb..73c3ee32 100644
--- a/client/map/auto_setup/environment_setup.gd
+++ b/client/map/auto_setup/environment_setup.gd
@@ -22,13 +22,9 @@ func set_sky(sky_name: String):
environment.sky.sky_material = load("res://map/environment/presets/%s_sky.tres" % sky_name)
func _ready():
- pass
- #Global.settings_changed.connect(apply_settings)
-
-# TODO
-#func apply_settings():
- #environment.ssao_enabled = Global.get_setting("graphics.ssao")
- #environment.sdfgi_enabled = Global.get_setting("graphics.gi") == "sdfgi" and allow_sdfgi
- #environment.glow_enabled = Global.get_setting("graphics.glow")
- #if !Global.on_vulkan():
- #environment.environment.tonemap_exposure = 0.5
+ Settings.hook_changed_init("graphics.ssao", func (x): environment.ssao_enabled = x)
+ Settings.hook_changed_init("graphics.gi", func (x): environment.sdfgi_enabled = x == "sdfgi" and allow_sdfgi)
+ Settings.hook_changed_init("graphics.glow", func (x): environment.glow_enabled = x)
+
+ if !Global.on_vulkan():
+ environment.environment.tonemap_exposure = 0.5
diff --git a/client/map/auto_setup/light_setup.gd b/client/map/auto_setup/light_setup.gd
index b42b3662..4da2886e 100644
--- a/client/map/auto_setup/light_setup.gd
+++ b/client/map/auto_setup/light_setup.gd
@@ -19,13 +19,12 @@ class_name LightSetup
@export var completely_disable_light_if_shadows_disabled := false
func _ready():
- apply_settings()
- Global.settings_changed.connect(apply_settings)
+ Settings.hook_changed_init("graphics.shadows", apply_settings)
-func apply_settings():
+func apply_settings(setting: bool):
if completely_disable_light_if_shadows_disabled:
- visible = Global.get_setting("graphics.shadows")
- shadow_enabled = Global.get_setting("graphics.shadows")
+ visible = setting
+ shadow_enabled = setting
func set_sky(sky_name: String):
match sky_name:
diff --git a/client/menu/setup.tscn b/client/menu/setup.tscn
index 9d8e4975..53c4565e 100644
--- a/client/menu/setup.tscn
+++ b/client/menu/setup.tscn
@@ -209,8 +209,8 @@ layout_mode = 2
[node name="LineEdit" type="LineEdit" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/PositionEntry"]
custom_minimum_size = Vector2(300, 30)
layout_mode = 2
-theme_override_colors/font_color = Color(0.458824, 0, 0, 1)
theme_override_colors/font_uneditable_color = Color(0.458824, 0, 0, 1)
+theme_override_colors/font_color = Color(0.458824, 0, 0, 1)
editable = false
[node name="LineEdit2" type="Label" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/PositionEntry/LineEdit"]
diff --git a/client/settings.gd b/client/settings.gd
index 1c03ca5a..cb8f9cf0 100644
--- a/client/settings.gd
+++ b/client/settings.gd
@@ -81,8 +81,8 @@ static func get_root():
SettingsCategory.new("ui", [
DropdownSetting.new("touch_controls", 0, ["automatic", "enabled", "disabled"]),
DropdownSetting.new("language", "system", Global.languages.map(func(e): return e[1])),
- DropdownSetting.new("ui_scale_mode", "resize", ["resize", "disabled"]),
- RangeSetting.new("ui_scale_factor", 1. if not Global.on_mobile() else 1.5, 0.5, 1.5, 3),
+ DropdownSetting.new("scale_mode", "resize", ["resize", "disabled"]),
+ RangeSetting.new("scale_factor", 1. if not Global.on_mobile() else 1.5, 0.5, 1.5, 3),
]),
SettingsCategory.new("input",
InputManager.input_map_to_settings(InputManager.default_input_map)
@@ -93,12 +93,17 @@ static func get_root():
])
])
-static func hook_changed(key: String, callable):
+static func hook_changed(key: String, callable: Callable):
change_hooks[key] = callable
+static func hook_changed_init(key: String, callable: Callable):
+ hook_changed(key, callable)
+ callable.call(Global.get_setting(key))
+
static var change_hooks = {
"graphics.aa": h_aa,
"graphics.taa": h_taa,
+ "ui.scale_mode": h_scale_mode,
}
static func h_aa(mode):
@@ -123,19 +128,17 @@ static func h_aa(mode):
static func h_taa(enabled):
Global.get_viewport().use_taa = enabled
+static func h_scale_mode(mode: int):
+ match mode:
+ 0:
+ Global.get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS
+ 1:
+ Global.get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_DISABLED
+
# func apply_settings():
# update_fullscreen()
# update_language()
-# # Temporal Anti-aliasing
-
-# # UI scale mode
-# match get_setting("ui_scale_mode"):
-# 0:
-# get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS
-# 1:
-# get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_DISABLED
-
# # UI scale factor
# get_tree().root.content_scale_factor = get_setting("ui_scale_factor")