add gamepad support to menus
This commit is contained in:
113
examples/ValueStepperExample.tscn
Normal file
113
examples/ValueStepperExample.tscn
Normal file
@@ -0,0 +1,113 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cw03putw85q1o"]
|
||||
|
||||
[ext_resource type="Script" path="res://examples/ValueStepperExample.gd" id="1_example"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/ui/components/ValueStepper.tscn" id="2_value_stepper"]
|
||||
|
||||
[node name="ValueStepperExample" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_example")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -200.0
|
||||
offset_top = -150.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 150.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Title" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "ValueStepper Component Examples"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Examples" type="VBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="LanguageContainer" type="HBoxContainer" parent="VBoxContainer/Examples"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="LanguageLabel" type="Label" parent="VBoxContainer/Examples/LanguageContainer"]
|
||||
custom_minimum_size = Vector2(120, 0)
|
||||
layout_mode = 2
|
||||
text = "Language:"
|
||||
|
||||
[node name="LanguageStepper" parent="VBoxContainer/Examples/LanguageContainer" instance=ExtResource("2_value_stepper")]
|
||||
layout_mode = 2
|
||||
data_source = "language"
|
||||
|
||||
[node name="DifficultyContainer" type="HBoxContainer" parent="VBoxContainer/Examples"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DifficultyLabel" type="Label" parent="VBoxContainer/Examples/DifficultyContainer"]
|
||||
custom_minimum_size = Vector2(120, 0)
|
||||
layout_mode = 2
|
||||
text = "Difficulty:"
|
||||
|
||||
[node name="DifficultyStepper" parent="VBoxContainer/Examples/DifficultyContainer" instance=ExtResource("2_value_stepper")]
|
||||
layout_mode = 2
|
||||
data_source = "difficulty"
|
||||
|
||||
[node name="ResolutionContainer" type="HBoxContainer" parent="VBoxContainer/Examples"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ResolutionLabel" type="Label" parent="VBoxContainer/Examples/ResolutionContainer"]
|
||||
custom_minimum_size = Vector2(120, 0)
|
||||
layout_mode = 2
|
||||
text = "Resolution:"
|
||||
|
||||
[node name="ResolutionStepper" parent="VBoxContainer/Examples/ResolutionContainer" instance=ExtResource("2_value_stepper")]
|
||||
layout_mode = 2
|
||||
data_source = "resolution"
|
||||
|
||||
[node name="CustomContainer" type="HBoxContainer" parent="VBoxContainer/Examples"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CustomLabel" type="Label" parent="VBoxContainer/Examples/CustomContainer"]
|
||||
custom_minimum_size = Vector2(120, 0)
|
||||
layout_mode = 2
|
||||
text = "Theme:"
|
||||
|
||||
[node name="CustomStepper" parent="VBoxContainer/Examples/CustomContainer" instance=ExtResource("2_value_stepper")]
|
||||
layout_mode = 2
|
||||
data_source = "custom"
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Instructions" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Navigation:
|
||||
• Up/Down arrows - Navigate between steppers
|
||||
• Left/Right arrows - Change values
|
||||
• Mouse clicks work on arrow buttons
|
||||
|
||||
Features:
|
||||
• Multiple data sources (language, difficulty, resolution)
|
||||
• Custom values support (theme example)
|
||||
• Gamepad/keyboard navigation
|
||||
• Visual highlighting
|
||||
• Signal-based value changes"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ResetButton" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Reset to Defaults"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/ResetButton" to="." method="_on_reset_to_defaults_pressed"]
|
||||
Reference in New Issue
Block a user