mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-02-16 19:35:39 +00:00
Merge pull request #641 from cipi1965/feat/godot-configurator-popup
Add popup PoC to Godot Configurator
This commit is contained in:
commit
0268c2af57
19
tools/configurator/components/popup.gd
Normal file
19
tools/configurator/components/popup.gd
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
var content = null
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
if (content != null):
|
||||||
|
$Panel/VBoxContainer/ContentContainer.add_child(content)
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func set_content(new_content):
|
||||||
|
content = load(new_content).instantiate()
|
||||||
|
|
||||||
|
func _on_back_pressed():
|
||||||
|
queue_free()
|
39
tools/configurator/components/popup.tscn
Normal file
39
tools/configurator/components/popup.tscn
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://ixg127wfv7wo"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://components/popup.gd" id="1_ck1vn"]
|
||||||
|
|
||||||
|
[node name="Popup" 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_ck1vn")
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 0
|
||||||
|
text = "Back"
|
||||||
|
|
||||||
|
[node name="ContentContainer" type="Panel" parent="Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[connection signal="pressed" from="Panel/VBoxContainer/Button" to="." method="_on_back_pressed"]
|
|
@ -19,3 +19,9 @@ func findElements(node: Node, className: String, result: Array = []) -> Array:
|
||||||
|
|
||||||
func _on_control_mouse_entered(control: Node):
|
func _on_control_mouse_entered(control: Node):
|
||||||
control.grab_focus()
|
control.grab_focus()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_quickresume_advanced_pressed():
|
||||||
|
var popup = load("res://components/popup.tscn").instantiate() as Control
|
||||||
|
popup.set_content("res://popup_content_test.tscn")
|
||||||
|
$Background.add_child(popup)
|
||||||
|
|
|
@ -104,11 +104,9 @@ grow_vertical = 2
|
||||||
[node name="TabContainer" type="TabContainer" parent="Background/MarginContainer"]
|
[node name="TabContainer" type="TabContainer" parent="Background/MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
tab_alignment = 1
|
tab_alignment = 1
|
||||||
current_tab = 7
|
|
||||||
script = ExtResource("3_id6l4")
|
script = ExtResource("3_id6l4")
|
||||||
|
|
||||||
[node name="System" type="MarginContainer" parent="Background/MarginContainer/TabContainer"]
|
[node name="System" type="MarginContainer" parent="Background/MarginContainer/TabContainer"]
|
||||||
visible = false
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/margin_right = 240
|
theme_override_constants/margin_right = 240
|
||||||
|
|
||||||
|
@ -719,6 +717,7 @@ size_flags_vertical = 1
|
||||||
text = "|| ------( )--------"
|
text = "|| ------( )--------"
|
||||||
|
|
||||||
[node name="About" type="MarginContainer" parent="Background/MarginContainer/TabContainer"]
|
[node name="About" type="MarginContainer" parent="Background/MarginContainer/TabContainer"]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/margin_right = 240
|
theme_override_constants/margin_right = 240
|
||||||
|
|
||||||
|
@ -907,3 +906,5 @@ frame_progress = 0.299789
|
||||||
sprite_frames = SubResource("SpriteFrames_p8gbs")
|
sprite_frames = SubResource("SpriteFrames_p8gbs")
|
||||||
animation = &"speech"
|
animation = &"speech"
|
||||||
frame_progress = 0.664627
|
frame_progress = 0.664627
|
||||||
|
|
||||||
|
[connection signal="pressed" from="Background/MarginContainer/TabContainer/System/ScrollContainer/VBoxContainer/game_control_container/GridContainer/Button" to="." method="_on_quickresume_advanced_pressed"]
|
||||||
|
|
15
tools/configurator/popup_content_test.tscn
Normal file
15
tools/configurator/popup_content_test.tscn
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[gd_scene format=3 uid="uid://bihon3xtx45y7"]
|
||||||
|
|
||||||
|
[node name="PopupContentTest" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
offset_right = 12.0
|
||||||
|
offset_bottom = 8.0
|
||||||
|
text = "Test"
|
Loading…
Reference in a new issue