mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 14:05:39 +00:00
Implemented Rekku help text from element description
This commit is contained in:
parent
1212c2cd7a
commit
590f40e831
|
@ -1,18 +1,13 @@
|
|||
extends RichTextLabel
|
||||
|
||||
var selected_element
|
||||
@onready var helper_text_node = self
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
# Get a reference to the helper_text node
|
||||
var helper_text_node = $bubble/helper_text
|
||||
# Connect the signal that gets fired on every focus change
|
||||
get_viewport().connect("gui_focus_changed", _on_focus_changed)
|
||||
|
||||
# Ensure that the helper_text node exists before trying to access it
|
||||
if helper_text_node != null:
|
||||
# Set the text of the helper_text node only if the element is selected and has the 'description' variable
|
||||
if selected_element != null and selected_element.has("description"):
|
||||
helper_text_node.text = selected_element.description
|
||||
func _on_focus_changed(selected_element:Control) -> void:
|
||||
if selected_element != null and selected_element.has_meta("description"):
|
||||
helper_text_node.text = selected_element.get_meta("description")
|
||||
else:
|
||||
helper_text_node.text = ""
|
||||
else:
|
||||
print("Error: helper_text node not found!")
|
||||
helper_text_node.text = "Hey, there's no description"
|
||||
|
|
|
@ -130,6 +130,7 @@ layout_mode = 2
|
|||
theme_override_constants/h_separation = 128
|
||||
button_pressed = true
|
||||
text = "Quick Resume"
|
||||
metadata/description = "This is a test description set to this element"
|
||||
|
||||
[node name="Button" type="Button" parent="MarginContainer/TabContainer/System/ScrollContainer/VBoxContainer/game_control_container/GridContainer"]
|
||||
layout_mode = 2
|
||||
|
@ -140,6 +141,7 @@ text = "Advanced"
|
|||
layout_mode = 2
|
||||
theme_override_constants/h_separation = 256
|
||||
text = "Rewind"
|
||||
metadata/description = "This is another description. Very long text anyone? Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
|
||||
|
||||
[node name="Button2" type="Button" parent="MarginContainer/TabContainer/System/ScrollContainer/VBoxContainer/game_control_container/GridContainer"]
|
||||
layout_mode = 2
|
||||
|
|
Loading…
Reference in a new issue