aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/global.gd43
-rw-r--r--client/menu/settings.gd3
-rw-r--r--client/project.godot5
3 files changed, 40 insertions, 11 deletions
diff --git a/client/global.gd b/client/global.gd
index 042752cc..2a8d243f 100644
--- a/client/global.gd
+++ b/client/global.gd
@@ -17,6 +17,8 @@
#
extends Node
+signal settings_changed()
+
# Each setting contains a dictionary with the following keys:
# "type": The type of the setting. Can be "toggle", "line", "range", "dropdown", or "dropdown_preset"
# "value": The value of the setting. When using "dropdown", this contains an int
@@ -37,6 +39,8 @@ var languages := [tr("System default"), "en", "de"]
var default_settings := {
"language": DropdownSetting.new(tr("Language"), 0, languages),
+ "aa": DropdownSetting.new(tr("Anti-aliasing"), 2, [tr("Disabled"), "FXAA", "MSAA 2x", "MSAA 4x"]),
+ "taa": ToggleSetting.new(tr("Temporal Anti-Aliasing"), false),
"fullscreen": ToggleSetting.new(tr("Fullscreen"), false),
"touch_controls": ToggleSetting.new(tr("Enable touch screen conrols"), DisplayServer.is_touchscreen_available()),
"interpolate_camera_rotation": ToggleSetting.new(tr("Interpolate the camera rotation"), true),
@@ -55,14 +59,13 @@ var settings: Dictionary
var server_url = ""
var error_message = ""
-func _init():
- profile = load_dict("user://profile", default_profile)
- load_settings("user://settings")
- update_fullscreen()
- update_language()
-
var focused_node: Control
+
func _ready():
+ profile = load_dict("user://profile", default_profile)
+ load_settings("user://settings")
+ apply_settings()
+
get_viewport().gui_focus_changed.connect(Sound.play_hover_maybe)
get_viewport().gui_focus_changed.connect(func (node): focused_node = node)
@@ -72,6 +75,34 @@ func _input(_event):
save_settings()
update_fullscreen()
+func apply_settings():
+ update_fullscreen()
+ update_language()
+
+ # Anti-aliasing
+ match get_setting("aa"):
+ 0:
+ get_viewport().msaa_2d = Viewport.MSAA_DISABLED
+ get_viewport().msaa_3d = Viewport.MSAA_DISABLED
+ get_viewport().screen_space_aa = Viewport.SCREEN_SPACE_AA_DISABLED
+ 1:
+ get_viewport().msaa_2d = Viewport.MSAA_DISABLED
+ get_viewport().msaa_3d = Viewport.MSAA_DISABLED
+ get_viewport().screen_space_aa = Viewport.SCREEN_SPACE_AA_FXAA
+ 2:
+ get_viewport().msaa_2d = Viewport.MSAA_2X
+ get_viewport().msaa_3d = Viewport.MSAA_2X
+ get_viewport().screen_space_aa = Viewport.SCREEN_SPACE_AA_DISABLED
+ 3:
+ get_viewport().msaa_2d = Viewport.MSAA_4X
+ get_viewport().msaa_3d = Viewport.MSAA_4X
+ get_viewport().screen_space_aa = Viewport.SCREEN_SPACE_AA_DISABLED
+
+ # Temporal Anti-aliasing
+ get_viewport().use_taa = get_setting("taa")
+
+ emit_signal("settings_changed")
+
func update_language():
var lang_idx: int = get_setting("language")
var lang = languages[lang_idx]
diff --git a/client/menu/settings.gd b/client/menu/settings.gd
index efd462ca..1835d620 100644
--- a/client/menu/settings.gd
+++ b/client/menu/settings.gd
@@ -19,8 +19,7 @@ extends Menu
func _on_back_pressed():
Global.save_settings()
- Global.update_language()
- Global.update_fullscreen()
+ Global.apply_settings()
exit()
func _ready():
diff --git a/client/project.godot b/client/project.godot
index 48b6523e..d1518e25 100644
--- a/client/project.godot
+++ b/client/project.godot
@@ -148,6 +148,5 @@ locale/translations_pot_files=PackedStringArray("res://menu/main_menu.tscn", "re
[rendering]
textures/vram_compression/import_etc2_astc=true
-anti_aliasing/quality/msaa_2d=2
-anti_aliasing/quality/msaa_3d=2
-anti_aliasing/quality/use_taa=true
+anti_aliasing/quality/msaa_2d=1
+anti_aliasing/quality/msaa_3d=1