diff options
author | George L. Albany <Megacake1234@gmail.com> | 2023-02-12 16:09:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-12 16:09:17 +0100 |
commit | c0d8a4ac3723021c95da9674c3bc0eea511ee3a0 (patch) | |
tree | 4ca4a0835cb833fbba1983f0e8de5fa66227b86e /game/src/OptionMenu/SettingNodes | |
parent | 537938683b748dbf5fcd78276aa823f168f715f1 (diff) | |
parent | 3798205c740e7e2faf2594866cb497260012508c (diff) |
Merge pull request #7 from Spartan322/feature/usable-ui
Diffstat (limited to 'game/src/OptionMenu/SettingNodes')
-rw-r--r-- | game/src/OptionMenu/SettingNodes/SettingHSlider.gd | 20 | ||||
-rw-r--r-- | game/src/OptionMenu/SettingNodes/SettingOptionButton.gd | 22 |
2 files changed, 42 insertions, 0 deletions
diff --git a/game/src/OptionMenu/SettingNodes/SettingHSlider.gd b/game/src/OptionMenu/SettingNodes/SettingHSlider.gd new file mode 100644 index 0000000..da9348f --- /dev/null +++ b/game/src/OptionMenu/SettingNodes/SettingHSlider.gd @@ -0,0 +1,20 @@ +extends HSlider +class_name SettingHSlider + +@export +var section_name : String = "Setting" + +@export +var setting_name : String = "SettingHSlider" + +@export +var default_value : float = 0 + +func load_setting(file : ConfigFile): + value = file.get_value(section_name, setting_name, default_value) + +func save_setting(file : ConfigFile): + file.set_value(section_name, setting_name, value) + +func reset_setting(): + value = default_value diff --git a/game/src/OptionMenu/SettingNodes/SettingOptionButton.gd b/game/src/OptionMenu/SettingNodes/SettingOptionButton.gd new file mode 100644 index 0000000..46fc825 --- /dev/null +++ b/game/src/OptionMenu/SettingNodes/SettingOptionButton.gd @@ -0,0 +1,22 @@ +extends OptionButton +class_name SettingOptionButton + +@export +var section_name : String = "Setting" + +@export +var setting_name : String = "SettingOptionMenu" + +@export +var default_value : int = 0 + +func load_setting(file : ConfigFile): + selected = file.get_value(section_name, setting_name, default_value) + item_selected.emit(selected) + +func save_setting(file : ConfigFile): + file.set_value(section_name, setting_name, selected) + +func reset_setting(): + selected = default_value + item_selected.emit(selected) |