Skip to content

Commit

Permalink
created a basic settings layout connected to the setting manager
Browse files Browse the repository at this point in the history
  • Loading branch information
ninetailsrabbit committed Oct 22, 2024
1 parent ba3bcec commit a091008
Show file tree
Hide file tree
Showing 7 changed files with 486 additions and 16 deletions.
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ config_version=5

config/name="IndieBlueprint"
config/description="is a comprehensive Godot project template designed to streamline your development process. It includes essential features, optimized settings, and best practices to help you create amazing indie game"
config/version="1.0.0"
config/version="1.0.5"
run/main_scene="res://scenes/entry_point/game-entry_point.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://icon.svg"
Expand Down
10 changes: 10 additions & 0 deletions ui/menus/components/checkbox/inverted_mouse_checkbox.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class_name ReverseMouseCheckbox extends CheckBox


func _ready() -> void:
button_pressed = SettingsManager.get_accessibility_section(GameSettings.ReversedMouseSetting)
toggled.connect(on_reverse_mouse_changed)


func on_reverse_mouse_changed(enabled: bool) -> void:
SettingsManager.update_accessibility_section(GameSettings.ReversedMouseSetting, enabled)
2 changes: 1 addition & 1 deletion ui/menus/components/panel/input_action_keybinding.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func setup(_action: StringName, _keybinding: InputEvent) -> void:
func display_keybindings() -> void:
if not action.is_empty() and keybinding:
action_label.text = tr(action.to_upper())
input_key_label.text = keybinding.as_text()
input_key_label.text = keybinding.as_text().replace("(Physical)", "").strip_edges()


func update_keybinding(new_event: InputEvent) -> void:
Expand Down
6 changes: 3 additions & 3 deletions ui/menus/components/panel/input_remap_panel.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
extends Control
extends PanelContainer

const InputActionKeybindingScene = preload("res://ui/menus/components/panel/input_action_keybinding.tscn")

@export var include_ui_actions: bool = false

@onready var action_list: VBoxContainer = %ActionListVboxContainer
@onready var reset_to_default_button: Button = $PanelContainer/MarginContainer/ActionListVboxContainer/ResetToDefaultButton
@onready var reset_to_default_button: Button = $MarginContainer/ActionListVboxContainer/ResetToDefaultButton

var is_remapping: bool = false:
set(value):
Expand Down Expand Up @@ -78,7 +78,7 @@ func on_reset_to_default_pressed() -> void:
var default_input_map_actions: Dictionary = GameSettings.DefaultSettings[GameSettings.DefaultInputMapActionsSetting]

if not default_input_map_actions.is_empty():
for input_action_keybinding: HBoxContainer in NodeTraversal.find_nodes_of_type(action_list, HBoxContainer.new()):
for input_action_keybinding: InputActionKeybindingDisplay in NodeTraversal.find_nodes_of_custom_class(action_list, InputActionKeybindingDisplay):
var current_action: StringName = StringName(input_action_keybinding.action)

if default_input_map_actions.has(current_action):
Expand Down
17 changes: 6 additions & 11 deletions ui/menus/components/panel/input_remap_panel.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,27 @@
[ext_resource type="Script" path="res://ui/menus/components/panel/input_remap_panel.gd" id="1_fw2mc"]
[ext_resource type="PackedScene" uid="uid://lxbuehwddqs" path="res://ui/menus/components/panel/input_action_keybinding.tscn" id="2_uyeiq"]

[node name="InputRemapPanel" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_fw2mc")

[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
[node name="PanelContainer" type="PanelContainer"]
offset_right = 500.0
offset_bottom = 65.0
script = ExtResource("1_fw2mc")

[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 15
theme_override_constants/margin_top = 15
theme_override_constants/margin_right = 15
theme_override_constants/margin_bottom = 15

[node name="ActionListVboxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
[node name="ActionListVboxContainer" type="VBoxContainer" parent="MarginContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_constants/separation = 20

[node name="InputActionKeybinding" parent="PanelContainer/MarginContainer/ActionListVboxContainer" instance=ExtResource("2_uyeiq")]
[node name="InputActionKeybinding" parent="MarginContainer/ActionListVboxContainer" instance=ExtResource("2_uyeiq")]
layout_mode = 2

[node name="ResetToDefaultButton" type="Button" parent="PanelContainer/MarginContainer/ActionListVboxContainer"]
[node name="ResetToDefaultButton" type="Button" parent="MarginContainer/ActionListVboxContainer"]
layout_mode = 2
size_flags_horizontal = 4
text = "RESET_TO_DEFAULT"
20 changes: 20 additions & 0 deletions ui/menus/components/slider/screen_brightness_slider.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class_name ScreenBrightnessSlider extends HSlider


func _enter_tree() -> void:
name = "ScreenBrightnessSlider"

min_value = 0.0
max_value = 1.0
step = 0.01

drag_ended.connect(on_brightness_changed)


func _ready() -> void:
value = SettingsManager.get_accessibility_section(GameSettings.ScreenBrightnessSetting)



func on_brightness_changed(brightness: float) -> void:
SettingsManager.update_accessibility_section(GameSettings.ScreenBrightnessSetting, brightness)
Loading

0 comments on commit a091008

Please sign in to comment.