aboutsummaryrefslogtreecommitdiff
path: root/client/menu/settings.gd
diff options
context:
space:
mode:
authormetamuffin <metamuffin@noreply.codeberg.org>2024-09-07 13:37:23 +0000
committermetamuffin <metamuffin@noreply.codeberg.org>2024-09-07 13:37:23 +0000
commit091f8ff9acf04cedf14765e9db5540c876fd7375 (patch)
tree4c115d6cb14df5d68bc72785f1020ed4ad2fb8e2 /client/menu/settings.gd
parentaf108805c8fd87a9d20a8df02072f224d2cd3417 (diff)
parent3ef379fb07df126ea09cb112801a0bef371f8811 (diff)
downloadhurrycurry-091f8ff9acf04cedf14765e9db5540c876fd7375.tar
hurrycurry-091f8ff9acf04cedf14765e9db5540c876fd7375.tar.bz2
hurrycurry-091f8ff9acf04cedf14765e9db5540c876fd7375.tar.zst
Merge pull request 'Refactor settings system and localization' (#123) from new-settings into master
Reviewed-on: https://codeberg.org/hurrycurry/hurrycurry/pulls/123
Diffstat (limited to 'client/menu/settings.gd')
-rw-r--r--client/menu/settings.gd43
1 files changed, 4 insertions, 39 deletions
diff --git a/client/menu/settings.gd b/client/menu/settings.gd
index eb143900..f035f712 100644
--- a/client/menu/settings.gd
+++ b/client/menu/settings.gd
@@ -16,52 +16,17 @@
#
extends Menu
-const SETTINGS_ROW_SCENE = preload("res://menu/settings/settings_row.tscn")
-
-@onready var settings_tabs: TabContainer = $OuterGap/Panel/InnerGap/VBoxContainer/TabContainer
+@onready var container = $OuterGap/Panel/InnerGap/VBoxContainer
func _ready():
super()
- update_rows()
+ var row = Global.settings_tree.create_row()
+ container.add_child(row)
+ container.move_child(row, 1)
func _on_back_pressed():
exit()
func exit():
Global.save_settings()
- Global.apply_settings()
super()
-
-func update_rows(fix_focus = false):
- for c in settings_tabs.get_children():
- c.queue_free()
-
- for category: SettingsCategory in Global.default_settings:
- var category_settings = category.settings
- var scroll := ScrollContainerCustom.new()
- var options := VBoxContainer.new()
- scroll.name = category.name
- scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
- settings_tabs.add_child(scroll)
- options.size_flags_horizontal = Control.SIZE_EXPAND_FILL
- scroll.add_child(options)
-
- var category_presets = category.presets
- if category_presets != null:
- for i: Preset in category_presets:
- var row: SettingsRow = SETTINGS_ROW_SCENE.instantiate()
- options.add_child(row)
- row.label.text = i.label
- row.reset_button.visible = false
- for b in i.buttons():
- row.value_parent.add_child(b)
-
- for k: String in category_settings.keys():
- var row: SettingsRow = Global.settings[k].get_row()
- options.add_child(row)
-
- if fix_focus:
- pass
- # TODO: Not implemented!
- # await get_tree().process_frame
- # Global.focus_first(self)