mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 14:05:39 +00:00
Add L1 and R1 tabs navigation
This commit is contained in:
parent
8855762fd5
commit
1227ad6ee0
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
|
@ -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="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="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"]
|
||||
|
@ -105,8 +106,11 @@ grow_vertical = 2
|
|||
[node name="TabContainer" type="TabContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
tab_alignment = 1
|
||||
current_tab = 4
|
||||
script = ExtResource("3_id6l4")
|
||||
|
||||
[node name="System" type="Control" parent="MarginContainer/TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/TabContainer/System"]
|
||||
|
@ -447,7 +451,6 @@ text = "Move User Files"
|
|||
layout_mode = 2
|
||||
|
||||
[node name="Network" type="Control" parent="MarginContainer/TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/TabContainer/Network"]
|
||||
|
|
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)
|
||||
]
|
||||
}
|
||||
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]
|
||||
|
||||
|
|
Loading…
Reference in a new issue