aboutsummaryrefslogtreecommitdiff
path: root/client/gui/menus/settings
diff options
context:
space:
mode:
Diffstat (limited to 'client/gui/menus/settings')
-rw-r--r--client/gui/menus/settings/button_setting.gd30
-rw-r--r--client/gui/menus/settings/button_setting.gd.uid1
-rw-r--r--client/gui/menus/settings/dropdown_setting.gd36
-rw-r--r--client/gui/menus/settings/dropdown_setting.gd.uid1
-rw-r--r--client/gui/menus/settings/game_setting.gd46
-rw-r--r--client/gui/menus/settings/game_setting.gd.uid1
-rw-r--r--client/gui/menus/settings/input/input_manager.gd101
-rw-r--r--client/gui/menus/settings/input/input_manager.gd.uid1
-rw-r--r--client/gui/menus/settings/input/input_setting.gd39
-rw-r--r--client/gui/menus/settings/input/input_setting.gd.uid1
-rw-r--r--client/gui/menus/settings/input/input_value_node.gd74
-rw-r--r--client/gui/menus/settings/input/input_value_node.gd.uid1
-rw-r--r--client/gui/menus/settings/input/input_value_node.tscn24
-rw-r--r--client/gui/menus/settings/number_setting.gd41
-rw-r--r--client/gui/menus/settings/number_setting.gd.uid1
-rw-r--r--client/gui/menus/settings/path_setting.gd64
-rw-r--r--client/gui/menus/settings/path_setting.gd.uid1
-rw-r--r--client/gui/menus/settings/preset_row.gd46
-rw-r--r--client/gui/menus/settings/preset_row.gd.uid1
-rw-r--r--client/gui/menus/settings/range_setting.gd44
-rw-r--r--client/gui/menus/settings/range_setting.gd.uid1
-rw-r--r--client/gui/menus/settings/settings.gd40
-rw-r--r--client/gui/menus/settings/settings.gd.uid1
-rw-r--r--client/gui/menus/settings/settings.tscn61
-rw-r--r--client/gui/menus/settings/settings_category.gd49
-rw-r--r--client/gui/menus/settings/settings_category.gd.uid1
-rw-r--r--client/gui/menus/settings/settings_root.gd40
-rw-r--r--client/gui/menus/settings/settings_root.gd.uid1
-rw-r--r--client/gui/menus/settings/settings_row.gd37
-rw-r--r--client/gui/menus/settings/settings_row.gd.uid1
-rw-r--r--client/gui/menus/settings/settings_row.tscn40
-rw-r--r--client/gui/menus/settings/text_setting.gd38
-rw-r--r--client/gui/menus/settings/text_setting.gd.uid1
-rw-r--r--client/gui/menus/settings/toggle_setting.gd31
-rw-r--r--client/gui/menus/settings/toggle_setting.gd.uid1
35 files changed, 897 insertions, 0 deletions
diff --git a/client/gui/menus/settings/button_setting.gd b/client/gui/menus/settings/button_setting.gd
new file mode 100644
index 00000000..fff8c184
--- /dev/null
+++ b/client/gui/menus/settings/button_setting.gd
@@ -0,0 +1,30 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name ButtonSetting
+extends GameSetting
+
+var callback
+
+func _init(new_id: String, new_default, callback_):
+ callback = callback_
+ super (new_id, new_default)
+
+func create_row():
+ var row = super ()
+ row.value_node = Button.new()
+ row.value_node.text = tr(nskey + ".button_label")
+ row.value_node.pressed.connect(callback)
+ return row
diff --git a/client/gui/menus/settings/button_setting.gd.uid b/client/gui/menus/settings/button_setting.gd.uid
new file mode 100644
index 00000000..cf0a8d95
--- /dev/null
+++ b/client/gui/menus/settings/button_setting.gd.uid
@@ -0,0 +1 @@
+uid://dku75bw31ux1k
diff --git a/client/gui/menus/settings/dropdown_setting.gd b/client/gui/menus/settings/dropdown_setting.gd
new file mode 100644
index 00000000..514df666
--- /dev/null
+++ b/client/gui/menus/settings/dropdown_setting.gd
@@ -0,0 +1,36 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name DropdownSetting
+extends GameSetting
+
+var options: Array
+
+func _init(new_id: String, new_default, new_options: Array):
+ super(new_id, new_default)
+ options = new_options
+
+func create_row():
+ var row = super()
+ row.value_node = OptionButton.new()
+ row.value_node.clip_text = true
+ for i in options: row.value_node.add_item(tr(nskey + "." + i))
+ Settings.hook_changed_init(key, true,
+ func(value):
+ if is_instance_valid(row):
+ row.value_node.select(options.find(value))
+ )
+ row.value_node.item_selected.connect(func(item): Global.set_setting(key, options[item]))
+ return row
diff --git a/client/gui/menus/settings/dropdown_setting.gd.uid b/client/gui/menus/settings/dropdown_setting.gd.uid
new file mode 100644
index 00000000..409bf3ab
--- /dev/null
+++ b/client/gui/menus/settings/dropdown_setting.gd.uid
@@ -0,0 +1 @@
+uid://cjqswo4mwbvon
diff --git a/client/gui/menus/settings/game_setting.gd b/client/gui/menus/settings/game_setting.gd
new file mode 100644
index 00000000..1c04ad3b
--- /dev/null
+++ b/client/gui/menus/settings/game_setting.gd
@@ -0,0 +1,46 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name GameSetting
+extends Object
+
+var default
+var key: String
+var nskey: String
+
+func _init(new_id: String, new_default = null):
+ default = new_default
+ key = new_id
+
+func set_parent(parent: GameSetting):
+ if parent != null: key = parent.key + "." + key
+ nskey = "c.settings." + key
+
+func create_row():
+ var row = preload("res://gui/menus/settings/settings_row.tscn").instantiate()
+ row.description = tr(nskey)
+ row.reset.connect(func(): Global.set_setting(key, default))
+ return row
+
+func check():
+ if default != null:
+ if not key in Global.settings:
+ Global.set_setting_unchecked(key, default)
+ if typeof(default) != typeof(Global.settings[key]):
+ Global.set_setting_unchecked(key, default)
+
+func changed_keys():
+ if Global.get_setting(key) != default: return [key]
+ else: return []
diff --git a/client/gui/menus/settings/game_setting.gd.uid b/client/gui/menus/settings/game_setting.gd.uid
new file mode 100644
index 00000000..99d79bee
--- /dev/null
+++ b/client/gui/menus/settings/game_setting.gd.uid
@@ -0,0 +1 @@
+uid://cyy8l32i44l63
diff --git a/client/gui/menus/settings/input/input_manager.gd b/client/gui/menus/settings/input/input_manager.gd
new file mode 100644
index 00000000..e3158a03
--- /dev/null
+++ b/client/gui/menus/settings/input/input_manager.gd
@@ -0,0 +1,101 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+extends Node
+
+enum EventType {
+ KEYBOARD,
+ JOYPAD,
+ TOUCH,
+ OTHER
+}
+
+var default_input_map = {}
+var input_map: Dictionary
+
+func _init():
+ default_input_map = get_input_map()
+ input_map = default_input_map.duplicate(true)
+
+func get_input_map() -> Dictionary:
+ var actions = InputMap.get_actions().filter(func isBuiltIn(k: String): return !k.begins_with("ui_"))
+ var kb = {}
+ for a in actions:
+ var input_events: Array[InputEvent] = InputMap.action_get_events(a).duplicate(true)
+ kb[a] = input_events
+ return kb
+
+func get_events(action_name: String) -> Array:
+ if not input_map.has(action_name):
+ push_error("Tried to get action %s in input map which does not exist" % action_name)
+ return []
+ return input_map[action_name]
+
+func settings() -> Array:
+ var entries := []
+ for k in input_map.keys(): entries.append(InputSetting.new(k))
+ return entries
+
+func change_input_map_action(action_name: String, events: Array, save: bool = true):
+ if !InputMap.has_action(action_name):
+ push_error("Action %s does not exist" % action_name, false)
+ return
+ # Erase previous keybindings
+ InputMap.action_erase_events(action_name)
+ # Add new keybindings
+ for e in events:
+ InputMap.action_add_event(action_name, e)
+
+ if save:
+ # Update input map dictionary
+ input_map = get_input_map()
+ # Save settings
+ Global.set_setting("input_map", input_map.duplicate(true))
+
+func apply_input_map(new_input_map: Dictionary):
+ # Load into input map dictionary
+ for k in new_input_map.keys():
+ input_map[k] = []
+ for a in new_input_map[k]:
+ input_map[k].append(a)
+
+ # Apply keybindings
+ for k in input_map.keys():
+ change_input_map_action(k, input_map[k], false)
+
+func reset_input_map():
+ Global.set_setting("input_map", default_input_map.duplicate())
+ apply_input_map(Global.get_setting("input_map"))
+
+func get_event_type(input_event: InputEvent) -> EventType:
+ if input_event is InputEventKey or input_event is InputEventMouseButton:
+ return EventType.KEYBOARD
+ elif input_event is InputEventJoypadButton or input_event is InputEventJoypadMotion:
+ return EventType.JOYPAD
+ elif input_event is InputEventScreenTouch or input_event is InputEventScreenDrag:
+ return EventType.TOUCH
+ return EventType.OTHER
+
+func display_input_event(input_event: InputEvent) -> String:
+ if input_event is InputEventKey:
+ return tr("c.settings.input.keyboard").format([OS.get_keycode_string(input_event.physical_keycode)])
+ elif input_event is InputEventMouseButton:
+ return tr("c.settings.input.mouse_button").format([input_event.button_index])
+ elif input_event is InputEventJoypadButton:
+ return tr("c.settings.input.joypad").format([input_event.button_index])
+ elif input_event is InputEventJoypadMotion:
+ return tr("c.settings.input.joypad_axis").format([input_event.axis])
+ else:
+ return tr("c.settings.input.other_event")
diff --git a/client/gui/menus/settings/input/input_manager.gd.uid b/client/gui/menus/settings/input/input_manager.gd.uid
new file mode 100644
index 00000000..678c2192
--- /dev/null
+++ b/client/gui/menus/settings/input/input_manager.gd.uid
@@ -0,0 +1 @@
+uid://bfu78iwybbu2s
diff --git a/client/gui/menus/settings/input/input_setting.gd b/client/gui/menus/settings/input/input_setting.gd
new file mode 100644
index 00000000..fa903771
--- /dev/null
+++ b/client/gui/menus/settings/input/input_setting.gd
@@ -0,0 +1,39 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name InputSetting
+extends GameSetting
+
+const INPUT_VALUE_NODE_SCENE = preload("res://gui/menus/settings/input/input_value_node.tscn")
+
+func _init(new_id: String):
+ super(new_id)
+ default = InputManager.default_input_map[new_id]
+
+func create_row():
+ var row = super()
+ row.value_node = INPUT_VALUE_NODE_SCENE.instantiate()
+ Settings.hook_changed_init(key, true,
+ func(value):
+ if is_instance_valid(row):
+ row.value_node.value = value
+ )
+ row.value_node.changed.connect(func(): Global.set_setting(key, row.value_node.value))
+ return row
+
+func changed_keys():
+ return [key]
+ # if Global.array_eq(Global.get_setting(key), default): return [key]
+ # else: return []
diff --git a/client/gui/menus/settings/input/input_setting.gd.uid b/client/gui/menus/settings/input/input_setting.gd.uid
new file mode 100644
index 00000000..7866fc2f
--- /dev/null
+++ b/client/gui/menus/settings/input/input_setting.gd.uid
@@ -0,0 +1 @@
+uid://d2xwn2u4ycpe8
diff --git a/client/gui/menus/settings/input/input_value_node.gd b/client/gui/menus/settings/input/input_value_node.gd
new file mode 100644
index 00000000..7c718e25
--- /dev/null
+++ b/client/gui/menus/settings/input/input_value_node.gd
@@ -0,0 +1,74 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+extends VBoxContainer
+class_name InputValueNode
+
+var value: Array[InputEvent] = []
+var listening := false
+
+signal changed()
+
+@onready var actions_container: VBoxContainer = $ActionsContainer
+@onready var add_button: Button = $Add
+@onready var add_text = add_button.text
+
+func _ready():
+ update()
+
+func update(fix_focus: bool = false):
+ for c in actions_container.get_children():
+ c.queue_free()
+
+ for e: InputEvent in value:
+ var description: String = InputManager.display_input_event(e)
+ var button := Button.new()
+
+ button.text = description
+ button.pressed.connect(erase_event.bind(e))
+ actions_container.add_child(button)
+
+ if fix_focus:
+ add_button.grab_focus()
+
+func erase_event(e: InputEvent):
+ value.erase(e)
+ update(true)
+ changed.emit()
+
+func _input(e: InputEvent):
+ if listening:
+ if e is InputEventKey or e is InputEventMouseButton or e is InputEventJoypadButton or e is InputEventJoypadMotion:
+ # Check if key was already added
+ for e2 in value:
+ if events_equal(e, e2): return
+
+ value.append(e)
+ _on_add_pressed()
+ update()
+ changed.emit()
+
+func events_equal(e1: InputEvent, e2: InputEvent) -> bool:
+ if e1 is InputEventKey and e2 is InputEventKey:
+ return e1.physical_keycode == e2.physical_keycode
+ if (e1 is InputEventMouseButton and e2 is InputEventMouseButton) or (e1 is InputEventJoypadButton and e2 is InputEventJoypadButton):
+ return e1.button_index == e2.button_index
+ if e1 is InputEventJoypadMotion and e2 is InputEventJoypadMotion:
+ return e1.axis == e2.axis
+ return false
+
+func _on_add_pressed() -> void:
+ listening = not listening
+ add_button.text = tr("c.settings.input.press_any_key") if listening else add_text
diff --git a/client/gui/menus/settings/input/input_value_node.gd.uid b/client/gui/menus/settings/input/input_value_node.gd.uid
new file mode 100644
index 00000000..3669b991
--- /dev/null
+++ b/client/gui/menus/settings/input/input_value_node.gd.uid
@@ -0,0 +1 @@
+uid://ckb78voiq05e3
diff --git a/client/gui/menus/settings/input/input_value_node.tscn b/client/gui/menus/settings/input/input_value_node.tscn
new file mode 100644
index 00000000..1b2e89c4
--- /dev/null
+++ b/client/gui/menus/settings/input/input_value_node.tscn
@@ -0,0 +1,24 @@
+[gd_scene load_steps=3 format=3 uid="uid://c6r0nv5daq7wc"]
+
+[ext_resource type="Script" uid="uid://ckb78voiq05e3" path="res://gui/menus/settings/input/input_value_node.gd" id="1_snxax"]
+[ext_resource type="Texture2D" uid="uid://cnfjbowd2i02r" path="res://gui/resources/icons/plus.svg" id="2_3vlvc"]
+
+[node name="InputValueNode" type="VBoxContainer"]
+offset_right = 128.0
+offset_bottom = 31.0
+theme_override_constants/separation = 0
+script = ExtResource("1_snxax")
+
+[node name="ActionsContainer" type="VBoxContainer" parent="."]
+layout_mode = 2
+theme_override_constants/separation = 0
+
+[node name="Add" type="Button" parent="."]
+custom_minimum_size = Vector2(128, 0)
+layout_mode = 2
+size_flags_vertical = 3
+text = "c.settings.input.add"
+icon = ExtResource("2_3vlvc")
+expand_icon = true
+
+[connection signal="pressed" from="Add" to="." method="_on_add_pressed"]
diff --git a/client/gui/menus/settings/number_setting.gd b/client/gui/menus/settings/number_setting.gd
new file mode 100644
index 00000000..5fa5a115
--- /dev/null
+++ b/client/gui/menus/settings/number_setting.gd
@@ -0,0 +1,41 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name NumberSetting
+extends GameSetting
+
+var placeholder: String
+var min_value: int
+var max_value: int
+
+func _init(new_id: String, new_default: int, new_min_value: int, new_max_value: int):
+ super(new_id, new_default)
+ min_value = new_min_value
+ max_value = new_max_value
+
+func create_row():
+ var row = super()
+ var input := SpinBox.new()
+ input.min_value = min_value
+ input.max_value = max_value
+
+ input.value_changed.connect(func(value): Global.set_setting(key, value as int))
+ Settings.hook_changed_init(key, true,
+ func(v):
+ if is_instance_valid(input):
+ input.value = v
+ )
+ row.value_node = input
+ return row
diff --git a/client/gui/menus/settings/number_setting.gd.uid b/client/gui/menus/settings/number_setting.gd.uid
new file mode 100644
index 00000000..4301c642
--- /dev/null
+++ b/client/gui/menus/settings/number_setting.gd.uid
@@ -0,0 +1 @@
+uid://babmw2ohuhmuk
diff --git a/client/gui/menus/settings/path_setting.gd b/client/gui/menus/settings/path_setting.gd
new file mode 100644
index 00000000..37492ed7
--- /dev/null
+++ b/client/gui/menus/settings/path_setting.gd
@@ -0,0 +1,64 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name PathSetting
+extends TextSetting
+
+var select_file_icon: Texture2D = preload("res://gui/resources/icons/select_file.svg")
+var select_dir_icon: Texture2D = preload("res://gui/resources/icons/select_directory.svg")
+
+var access: FileDialog.Access
+var file_mode: FileDialog.FileMode
+
+func _init(new_id: String,
+ new_default: String,
+ new_file_mode: FileDialog.FileMode,
+ new_placeholder: String = "",
+ new_access: FileDialog.Access = FileDialog.Access.ACCESS_FILESYSTEM
+):
+ super(new_id, new_default)
+ placeholder = new_placeholder
+ access = new_access
+ file_mode = new_file_mode
+
+func create_row():
+ var row = super ()
+ var input: LineEdit = row.value_node;
+ input.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ row.value_node = HBoxContainer.new()
+ row.value_node.add_child(input)
+ var button := Button.new()
+ button.icon = select_file_icon if file_mode == FileDialog.FileMode.FILE_MODE_OPEN_FILE else select_dir_icon
+ row.value_node.add_child(button)
+ button.pressed.connect(func():
+ var d := FileDialog.new()
+ Global.focused_menu.add_child(d)
+ d.move_to_center()
+ d.use_native_dialog = true
+ d.borderless = true
+ d.dir_selected.connect(_selected.bind(input))
+ d.file_selected.connect(_selected.bind(input))
+ d.file_mode = file_mode
+ d.access = access
+ d.show()
+ # this feels wrong
+ d.canceled.connect(d.queue_free)
+ d.confirmed.connect(d.queue_free)
+ )
+ return row
+
+func _selected(path: String, input: LineEdit):
+ input.text = path
+ input.text_changed.emit(path)
diff --git a/client/gui/menus/settings/path_setting.gd.uid b/client/gui/menus/settings/path_setting.gd.uid
new file mode 100644
index 00000000..a524b17c
--- /dev/null
+++ b/client/gui/menus/settings/path_setting.gd.uid
@@ -0,0 +1 @@
+uid://cj5jf7t771j5b
diff --git a/client/gui/menus/settings/preset_row.gd b/client/gui/menus/settings/preset_row.gd
new file mode 100644
index 00000000..f3c46a26
--- /dev/null
+++ b/client/gui/menus/settings/preset_row.gd
@@ -0,0 +1,46 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name PresetRow
+extends GameSetting
+
+var options: Dictionary
+var arr: Array[Button]
+
+func _init(id: String, options_: Dictionary):
+ super(id)
+ options = options_
+
+var prefix = ""
+func set_parent(parent):
+ super(parent)
+ if parent != null: prefix = parent.key
+
+func apply(preset_name: String):
+ var preset = options[preset_name]
+ for i in preset.keys():
+ Global.set_setting(prefix + "." + i, preset[i])
+
+func create_row():
+ var row = super()
+ row.value_node = HBoxContainer.new()
+ for i in options.keys():
+ var button := Button.new()
+ button.pressed.connect(apply.bind(i))
+ button.text = tr(nskey + "." + i)
+ row.value_node.add_child(button)
+ return row
+
+func changed_keys(): return []
diff --git a/client/gui/menus/settings/preset_row.gd.uid b/client/gui/menus/settings/preset_row.gd.uid
new file mode 100644
index 00000000..51605058
--- /dev/null
+++ b/client/gui/menus/settings/preset_row.gd.uid
@@ -0,0 +1 @@
+uid://dawqyyllgis0b
diff --git a/client/gui/menus/settings/range_setting.gd b/client/gui/menus/settings/range_setting.gd
new file mode 100644
index 00000000..b8d392a4
--- /dev/null
+++ b/client/gui/menus/settings/range_setting.gd
@@ -0,0 +1,44 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name RangeSetting
+extends GameSetting
+
+var min_value: float
+var max_value: float
+var tick_count
+var smooth: bool
+
+func _init(new_id: String, new_default: float, new_min_value: float, new_max_value: float, new_smooth: bool = true, new_tick_count = null):
+ super(new_id, new_default)
+ min_value = new_min_value
+ max_value = new_max_value
+ tick_count = new_tick_count
+ smooth = new_smooth
+
+func create_row():
+ var row = super()
+ row.value_node = HSlider.new()
+ row.value_node.min_value = min_value
+ row.value_node.max_value = max_value
+ row.value_node.tick_count = abs(max_value - min_value) if tick_count == null else tick_count
+ row.value_node.step = 0 if smooth else (1 if tick_count == null else abs(max_value - min_value) / (tick_count - 1))
+ Settings.hook_changed_init(key, true,
+ func(value):
+ if is_instance_valid(row):
+ row.value_node.value = value
+ )
+ row.value_node.value_changed.connect(func(value): Global.set_setting(key, value))
+ return row
diff --git a/client/gui/menus/settings/range_setting.gd.uid b/client/gui/menus/settings/range_setting.gd.uid
new file mode 100644
index 00000000..a4ca49a2
--- /dev/null
+++ b/client/gui/menus/settings/range_setting.gd.uid
@@ -0,0 +1 @@
+uid://civr7cckqfndj
diff --git a/client/gui/menus/settings/settings.gd b/client/gui/menus/settings/settings.gd
new file mode 100644
index 00000000..32da54cc
--- /dev/null
+++ b/client/gui/menus/settings/settings.gd
@@ -0,0 +1,40 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+extends Menu
+
+@onready var container = $OuterGap/Panel/InnerGap/VBoxContainer
+@onready var outer_gap = $OuterGap
+
+func _ready():
+ super()
+ var row = Global.settings_tree.create_row()
+ container.add_child(row)
+ container.move_child(row, 1)
+
+func _process(_dt):
+ var os := OS.get_name()
+ if os == "iOS" or os == "Android": return
+ # TODO probably bad performance, only update on change
+ var margin = max((self.size.x - 1200) / 2, 20)
+ outer_gap.add_theme_constant_override("margin_left", margin)
+ outer_gap.add_theme_constant_override("margin_right", margin)
+
+func _on_back_pressed():
+ exit()
+
+func exit():
+ Global.save_settings()
+ super()
diff --git a/client/gui/menus/settings/settings.gd.uid b/client/gui/menus/settings/settings.gd.uid
new file mode 100644
index 00000000..79b89b85
--- /dev/null
+++ b/client/gui/menus/settings/settings.gd.uid
@@ -0,0 +1 @@
+uid://bbqmsf8u5rhtn
diff --git a/client/gui/menus/settings/settings.tscn b/client/gui/menus/settings/settings.tscn
new file mode 100644
index 00000000..71549464
--- /dev/null
+++ b/client/gui/menus/settings/settings.tscn
@@ -0,0 +1,61 @@
+[gd_scene load_steps=6 format=3 uid="uid://8ic77jmadadj"]
+
+[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://gui/resources/theme/theme.tres" id="1_1vjiw"]
+[ext_resource type="Script" uid="uid://bbqmsf8u5rhtn" path="res://gui/menus/settings/settings.gd" id="2_5xn7x"]
+[ext_resource type="Script" uid="uid://byshs20og68tn" path="res://gui/components/smart_margin_container.gd" id="3_h533i"]
+[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://gui/resources/materials/dark_blur_material.tres" id="4_b0x33"]
+[ext_resource type="Script" uid="uid://cmncjc06kadpe" path="res://gui/components/blur_setup.gd" id="5_dvivs"]
+
+[node name="SettingsMenu" type="Control"]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme = ExtResource("1_1vjiw")
+script = ExtResource("2_5xn7x")
+support_anim = false
+
+[node name="OuterGap" type="MarginContainer" parent="."]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_constants/margin_left = 80
+script = ExtResource("3_h533i")
+
+[node name="Panel" type="Panel" parent="OuterGap"]
+material = ExtResource("4_b0x33")
+layout_mode = 2
+script = ExtResource("5_dvivs")
+
+[node name="InnerGap" type="MarginContainer" parent="OuterGap/Panel"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_constants/margin_left = 40
+theme_override_constants/margin_top = 40
+theme_override_constants/margin_right = 40
+theme_override_constants/margin_bottom = 40
+
+[node name="VBoxContainer" type="VBoxContainer" parent="OuterGap/Panel/InnerGap"]
+layout_mode = 2
+
+[node name="Title" type="Label" parent="OuterGap/Panel/InnerGap/VBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 0
+theme_override_font_sizes/font_size = 36
+text = "c.menu.settings"
+
+[node name="Back" type="Button" parent="OuterGap/Panel/InnerGap/VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 8
+text = "c.settings.apply"
+
+[connection signal="pressed" from="OuterGap/Panel/InnerGap/VBoxContainer/Back" to="." method="_on_back_pressed"]
diff --git a/client/gui/menus/settings/settings_category.gd b/client/gui/menus/settings/settings_category.gd
new file mode 100644
index 00000000..bf85abd9
--- /dev/null
+++ b/client/gui/menus/settings/settings_category.gd
@@ -0,0 +1,49 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name SettingsCategory
+extends GameSetting
+
+var settings: Array # Dictionary[String, GameSetting]
+
+func _init(new_id: String, new_settings: Array):
+ super(new_id)
+ settings = new_settings
+
+func set_parent(parent: GameSetting):
+ super(parent)
+ for c in settings:
+ c.set_parent(self)
+
+func create_row():
+ var row = ScrollContainerCustom.new()
+ var options = VBoxContainer.new()
+ row.name = tr(nskey)
+ row.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ options.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ row.add_child(options)
+
+ for r in settings: options.add_child(r.create_row())
+ return row
+
+func check():
+ for c in settings:
+ c.check()
+
+func changed_keys():
+ var changed = []
+ for c in settings:
+ changed.append_array(c.changed_keys())
+ return changed
diff --git a/client/gui/menus/settings/settings_category.gd.uid b/client/gui/menus/settings/settings_category.gd.uid
new file mode 100644
index 00000000..421ce213
--- /dev/null
+++ b/client/gui/menus/settings/settings_category.gd.uid
@@ -0,0 +1 @@
+uid://b8s3cqb01w3wh
diff --git a/client/gui/menus/settings/settings_root.gd b/client/gui/menus/settings/settings_root.gd
new file mode 100644
index 00000000..a9a024d8
--- /dev/null
+++ b/client/gui/menus/settings/settings_root.gd
@@ -0,0 +1,40 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+extends GameSetting
+class_name SettingsRoot
+
+var children: Array
+func _init(new_children: Array):
+ super("root")
+ children = new_children
+ for c in children:
+ c.set_parent(null)
+
+func create_row():
+ var row = TabContainer.new()
+ row.size_flags_vertical = Control.SIZE_EXPAND_FILL
+ for r in children: row.add_child(r.create_row())
+ return row
+
+func check():
+ for c in children:
+ c.check()
+
+func changed_keys():
+ var changed = []
+ for c in children:
+ changed.append_array(c.changed_keys())
+ return changed
diff --git a/client/gui/menus/settings/settings_root.gd.uid b/client/gui/menus/settings/settings_root.gd.uid
new file mode 100644
index 00000000..95a46d5e
--- /dev/null
+++ b/client/gui/menus/settings/settings_root.gd.uid
@@ -0,0 +1 @@
+uid://jonib2ixqsp7
diff --git a/client/gui/menus/settings/settings_row.gd b/client/gui/menus/settings/settings_row.gd
new file mode 100644
index 00000000..d88d49c1
--- /dev/null
+++ b/client/gui/menus/settings/settings_row.gd
@@ -0,0 +1,37 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name SettingsRow
+extends PanelContainer
+
+signal reset()
+
+@onready var value_parent = $HBoxContainer/BoxContainer
+@onready var label = $HBoxContainer/Label
+@onready var reset_button = $HBoxContainer/Reset
+
+var value_node: Node
+var description = "No value was given to the row"
+
+func _ready():
+ if value_node != null:
+ var c: Control = value_node
+ c.size_flags_vertical = Control.SIZE_EXPAND_FILL
+ c.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ label.text = description
+ value_parent.add_child(c)
+
+func _on_reset_pressed():
+ reset.emit()
diff --git a/client/gui/menus/settings/settings_row.gd.uid b/client/gui/menus/settings/settings_row.gd.uid
new file mode 100644
index 00000000..a6dea492
--- /dev/null
+++ b/client/gui/menus/settings/settings_row.gd.uid
@@ -0,0 +1 @@
+uid://b3m1f76o5qo68
diff --git a/client/gui/menus/settings/settings_row.tscn b/client/gui/menus/settings/settings_row.tscn
new file mode 100644
index 00000000..09378ab6
--- /dev/null
+++ b/client/gui/menus/settings/settings_row.tscn
@@ -0,0 +1,40 @@
+[gd_scene load_steps=7 format=3 uid="uid://o5e5vpem8w0k"]
+
+[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://gui/resources/theme/theme.tres" id="1_iij3k"]
+[ext_resource type="Script" uid="uid://b3m1f76o5qo68" path="res://gui/menus/settings/settings_row.gd" id="2_l8i7p"]
+[ext_resource type="FontFile" uid="uid://5ixo6b3bd3km" path="res://gui/resources/fonts/font-josefin-sans.woff2" id="3_7k5da"]
+[ext_resource type="Texture2D" uid="uid://cucnmy0j5n8l8" path="res://gui/resources/icons/reset.svg" id="4_bj3dr"]
+
+[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_pk3rs"]
+content_margin_left = 16.0
+
+[sub_resource type="FontVariation" id="FontVariation_o6i7s"]
+base_font = ExtResource("3_7k5da")
+
+[node name="SettingsRow" type="PanelContainer"]
+offset_right = 105.0
+offset_bottom = 23.0
+size_flags_horizontal = 3
+theme = ExtResource("1_iij3k")
+script = ExtResource("2_l8i7p")
+
+[node name="HBoxContainer" type="HBoxContainer" parent="."]
+layout_mode = 2
+
+[node name="Label" type="Label" parent="HBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+theme_override_styles/normal = SubResource("StyleBoxEmpty_pk3rs")
+
+[node name="BoxContainer" type="BoxContainer" parent="HBoxContainer"]
+custom_minimum_size = Vector2(300, 50)
+layout_mode = 2
+alignment = 2
+
+[node name="Reset" type="Button" parent="HBoxContainer"]
+layout_mode = 2
+theme_override_fonts/font = SubResource("FontVariation_o6i7s")
+theme_override_font_sizes/font_size = 24
+icon = ExtResource("4_bj3dr")
+
+[connection signal="pressed" from="HBoxContainer/Reset" to="." method="_on_reset_pressed"]
diff --git a/client/gui/menus/settings/text_setting.gd b/client/gui/menus/settings/text_setting.gd
new file mode 100644
index 00000000..8e2b6bec
--- /dev/null
+++ b/client/gui/menus/settings/text_setting.gd
@@ -0,0 +1,38 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name TextSetting
+extends GameSetting
+
+var placeholder: String
+
+func _init(new_id: String, new_default: String, new_placeholder: String = ""):
+ super(new_id, new_default)
+ placeholder = new_placeholder
+
+func create_row():
+ var row = super()
+ var input := LineEdit.new()
+ input.placeholder_text = placeholder
+ input.text_changed.connect(func(text): Global.set_setting(key, text))
+ Settings.hook_changed_init(key, true,
+ func(text):
+ if is_instance_valid(input):
+ var pos = input.caret_column
+ input.text = text
+ input.caret_column = pos
+ )
+ row.value_node = input
+ return row
diff --git a/client/gui/menus/settings/text_setting.gd.uid b/client/gui/menus/settings/text_setting.gd.uid
new file mode 100644
index 00000000..58ac5abe
--- /dev/null
+++ b/client/gui/menus/settings/text_setting.gd.uid
@@ -0,0 +1 @@
+uid://3rgucgbbt135
diff --git a/client/gui/menus/settings/toggle_setting.gd b/client/gui/menus/settings/toggle_setting.gd
new file mode 100644
index 00000000..abcb7f4a
--- /dev/null
+++ b/client/gui/menus/settings/toggle_setting.gd
@@ -0,0 +1,31 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name ToggleSetting
+extends GameSetting
+
+func _init(new_id: String, new_default: bool):
+ super(new_id, new_default)
+
+func create_row():
+ var row = super()
+ row.value_node = CheckButton.new()
+ row.value_node.pressed.connect(func(): Global.set_setting(key, row.value_node.button_pressed))
+ Settings.hook_changed_init(key, true,
+ func(value):
+ if is_instance_valid(row):
+ row.value_node.button_pressed = value
+ )
+ return row
diff --git a/client/gui/menus/settings/toggle_setting.gd.uid b/client/gui/menus/settings/toggle_setting.gd.uid
new file mode 100644
index 00000000..1d2ca55b
--- /dev/null
+++ b/client/gui/menus/settings/toggle_setting.gd.uid
@@ -0,0 +1 @@
+uid://cojnv8bmv6aw5