mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-04-10 19:15:12 +00:00
Improve UI navigation on Godot Configurator
Merge pull request #634 from cipi1965/feat/godot-configurator-fix-focus
This commit is contained in:
commit
5ccaee0b13
34
tools/configurator/TabContainer.gd
Normal file
34
tools/configurator/TabContainer.gd
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
extends TabContainer
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if (event.is_action_pressed("next_tab")):
|
||||||
|
self.select_next_available()
|
||||||
|
focusFirstFocusableChild()
|
||||||
|
|
||||||
|
if (event.is_action_pressed("previous_tab")):
|
||||||
|
self.select_previous_available()
|
||||||
|
focusFirstFocusableChild()
|
||||||
|
|
||||||
|
func focusFirstFocusableChild():
|
||||||
|
var children = findElements(get_current_tab_control(), "Control")
|
||||||
|
for n: Control in children:
|
||||||
|
if (n.focus_mode == FOCUS_ALL):
|
||||||
|
n.grab_focus.call_deferred()
|
||||||
|
break
|
||||||
|
|
||||||
|
func findElements(node: Node, className: String, result: Array = []) -> Array:
|
||||||
|
if node.is_class(className):
|
||||||
|
result.push_back(node)
|
||||||
|
for child in node.get_children():
|
||||||
|
result = findElements(child, className, result)
|
||||||
|
return result
|
0
tools/configurator/main.gd
Executable file → Normal file
0
tools/configurator/main.gd
Executable file → Normal file
30
tools/configurator/main.tscn
Executable file → Normal file
30
tools/configurator/main.tscn
Executable file → Normal file
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=17 format=3 uid="uid://61f6m4r1mpan"]
|
[gd_scene load_steps=18 format=3 uid="uid://61f6m4r1mpan"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://bv6vh33cnfaw4" path="res://icon.svg" id="1_axfei"]
|
[ext_resource type="Texture2D" uid="uid://bv6vh33cnfaw4" path="res://icon.svg" id="1_axfei"]
|
||||||
[ext_resource type="Script" path="res://main.gd" id="1_obpq7"]
|
[ext_resource type="Script" path="res://main.gd" id="1_obpq7"]
|
||||||
|
[ext_resource type="Script" path="res://TabContainer.gd" id="3_id6l4"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dig4pco500pyt" path="res://res/configurator.mp3" id="3_xivj6"]
|
[ext_resource type="AudioStream" uid="uid://dig4pco500pyt" path="res://res/configurator.mp3" id="3_xivj6"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dx0u5hiwxfgu5" path="res://res/pixel_ui_theme/8x8_ui_elements.png" id="4_2tuu4"]
|
[ext_resource type="Texture2D" uid="uid://dx0u5hiwxfgu5" path="res://res/pixel_ui_theme/8x8_ui_elements.png" id="4_2tuu4"]
|
||||||
[ext_resource type="Script" path="res://Rekku.gd" id="4_nqqx3"]
|
[ext_resource type="Script" path="res://Rekku.gd" id="4_nqqx3"]
|
||||||
|
@ -105,8 +106,11 @@ grow_vertical = 2
|
||||||
[node name="TabContainer" type="TabContainer" parent="MarginContainer"]
|
[node name="TabContainer" type="TabContainer" parent="MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
tab_alignment = 1
|
tab_alignment = 1
|
||||||
|
current_tab = 4
|
||||||
|
script = ExtResource("3_id6l4")
|
||||||
|
|
||||||
[node name="System" type="TabBar" parent="MarginContainer/TabContainer"]
|
[node name="System" type="Control" parent="MarginContainer/TabContainer"]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/TabContainer/System"]
|
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/TabContainer/System"]
|
||||||
|
@ -115,6 +119,7 @@ offset_left = 21.0
|
||||||
offset_top = 23.0
|
offset_top = 23.0
|
||||||
offset_right = 745.0
|
offset_right = 745.0
|
||||||
offset_bottom = 436.0
|
offset_bottom = 436.0
|
||||||
|
follow_focus = true
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/System/ScrollContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/System/ScrollContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
@ -179,7 +184,7 @@ layout_mode = 2
|
||||||
disabled = true
|
disabled = true
|
||||||
text = "Advanced"
|
text = "Advanced"
|
||||||
|
|
||||||
[node name="Graphics" type="TabBar" parent="MarginContainer/TabContainer"]
|
[node name="Graphics" type="Control" parent="MarginContainer/TabContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
@ -190,6 +195,7 @@ offset_top = 23.0
|
||||||
offset_right = 748.0
|
offset_right = 748.0
|
||||||
offset_bottom = 455.0
|
offset_bottom = 455.0
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
follow_focus = true
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/Graphics/ScrollContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/Graphics/ScrollContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
@ -269,7 +275,7 @@ layout_mode = 2
|
||||||
disabled = true
|
disabled = true
|
||||||
text = "TATE Mode (coming soon)"
|
text = "TATE Mode (coming soon)"
|
||||||
|
|
||||||
[node name="Controls" type="TabBar" parent="MarginContainer/TabContainer"]
|
[node name="Controls" type="Control" parent="MarginContainer/TabContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
@ -278,6 +284,7 @@ layout_mode = 0
|
||||||
offset_left = 17.0
|
offset_left = 17.0
|
||||||
offset_right = 751.0
|
offset_right = 751.0
|
||||||
offset_bottom = 494.0
|
offset_bottom = 494.0
|
||||||
|
follow_focus = true
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/Controls/ScrollContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/Controls/ScrollContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
@ -330,7 +337,7 @@ button_pressed = true
|
||||||
text = "Hotkey Activation Sound (coming soon)
|
text = "Hotkey Activation Sound (coming soon)
|
||||||
"
|
"
|
||||||
|
|
||||||
[node name="Tools" type="TabBar" parent="MarginContainer/TabContainer"]
|
[node name="Tools" type="Control" parent="MarginContainer/TabContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
@ -340,6 +347,7 @@ offset_left = 27.0
|
||||||
offset_top = 22.0
|
offset_top = 22.0
|
||||||
offset_right = 748.0
|
offset_right = 748.0
|
||||||
offset_bottom = 470.0
|
offset_bottom = 470.0
|
||||||
|
follow_focus = true
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/Tools/ScrollContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/Tools/ScrollContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
@ -442,8 +450,7 @@ text = "Move User Files"
|
||||||
[node name="game_control_container2" type="VBoxContainer" parent="MarginContainer/TabContainer/Tools/ScrollContainer/VBoxContainer"]
|
[node name="game_control_container2" type="VBoxContainer" parent="MarginContainer/TabContainer/Tools/ScrollContainer/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Network" type="TabBar" parent="MarginContainer/TabContainer"]
|
[node name="Network" type="Control" parent="MarginContainer/TabContainer"]
|
||||||
visible = false
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/TabContainer/Network"]
|
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/TabContainer/Network"]
|
||||||
|
@ -452,6 +459,7 @@ offset_left = 21.0
|
||||||
offset_top = 8.0
|
offset_top = 8.0
|
||||||
offset_right = 750.0
|
offset_right = 750.0
|
||||||
offset_bottom = 464.0
|
offset_bottom = 464.0
|
||||||
|
follow_focus = true
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/Network/ScrollContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/Network/ScrollContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
@ -594,7 +602,7 @@ layout_mode = 2
|
||||||
disabled = true
|
disabled = true
|
||||||
text = "Start FTP Server"
|
text = "Start FTP Server"
|
||||||
|
|
||||||
[node name="Troubleshoot" type="TabBar" parent="MarginContainer/TabContainer"]
|
[node name="Troubleshoot" type="Control" parent="MarginContainer/TabContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
@ -647,7 +655,7 @@ text = "All Emulators"
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Full RetroDECK Reset"
|
text = "Full RetroDECK Reset"
|
||||||
|
|
||||||
[node name="Configurator" type="TabBar" parent="MarginContainer/TabContainer"]
|
[node name="Configurator" type="Control" parent="MarginContainer/TabContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
@ -657,6 +665,7 @@ offset_left = 21.0
|
||||||
offset_top = 23.0
|
offset_top = 23.0
|
||||||
offset_right = 750.0
|
offset_right = 750.0
|
||||||
offset_bottom = 436.0
|
offset_bottom = 436.0
|
||||||
|
follow_focus = true
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/Configurator/ScrollContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/TabContainer/Configurator/ScrollContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
@ -714,12 +723,11 @@ text = "Menu music
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "|| ------( )--------"
|
text = "|| ------( )--------"
|
||||||
|
|
||||||
[node name="About" type="TabBar" parent="MarginContainer/TabContainer"]
|
[node name="About" type="Control" parent="MarginContainer/TabContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Icon" type="Sprite2D" parent="MarginContainer/TabContainer/About"]
|
[node name="Icon" type="Sprite2D" parent="MarginContainer/TabContainer/About"]
|
||||||
visible = false
|
|
||||||
position = Vector2(152, 83.5)
|
position = Vector2(152, 83.5)
|
||||||
scale = Vector2(0.515625, 0.503906)
|
scale = Vector2(0.515625, 0.503906)
|
||||||
texture = ExtResource("1_axfei")
|
texture = ExtResource("1_axfei")
|
||||||
|
|
10
tools/configurator/project.godot
Executable file → Normal file
10
tools/configurator/project.godot
Executable file → Normal file
|
@ -66,6 +66,16 @@ quit={
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":81,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":81,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
next_tab={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
previous_tab={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue