HUD Rework and integration
This commit is contained in:
9
.idea/.idea.Ecosystem/.idea/libraries/GdSdk.xml
generated
Normal file
9
.idea/.idea.Ecosystem/.idea/libraries/GdSdk.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="GdSdk" type="GdScript">
|
||||||
|
<CLASSES />
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES>
|
||||||
|
<root url="file://$APPLICATION_HOME_DIR$/plugins/rider-gdscript/sdk/extracted/4.4.1" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
121
scenes/HUD/hud.tscn
Normal file
121
scenes/HUD/hud.tscn
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
[gd_scene load_steps=4 format=3 uid="uid://djgeio24bm6i4"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://ce6mehx86c03f" path="res://scenes/main/hud.gd" id="1_jjobl"]
|
||||||
|
[ext_resource type="Script" uid="uid://8vkyddmxqfaf" path="res://scenes/HUD/menu_bar.gd" id="2_epp0c"]
|
||||||
|
[ext_resource type="Script" uid="uid://cmoqidhmxlccq" path="res://scenes/HUD/options_menu.gd" id="3_r7rnh"]
|
||||||
|
|
||||||
|
[node name="HUD" type="CanvasLayer"]
|
||||||
|
script = ExtResource("1_jjobl")
|
||||||
|
|
||||||
|
[node name="MenuBar" type="MenuBar" parent="."]
|
||||||
|
anchors_preset = 10
|
||||||
|
anchor_right = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
script = ExtResource("2_epp0c")
|
||||||
|
|
||||||
|
[node name="Entity" type="PopupMenu" parent="MenuBar"]
|
||||||
|
auto_translate_mode = 1
|
||||||
|
size = Vector2i(109, 100)
|
||||||
|
|
||||||
|
[node name="Spawn" type="PopupMenu" parent="MenuBar"]
|
||||||
|
auto_translate_mode = 1
|
||||||
|
size = Vector2i(109, 100)
|
||||||
|
item_count = 2
|
||||||
|
item_0/text = "Fly"
|
||||||
|
item_0/id = 0
|
||||||
|
item_1/text = "Bumblebee"
|
||||||
|
item_1/id = 1
|
||||||
|
|
||||||
|
[node name="Options" type="PopupMenu" parent="MenuBar"]
|
||||||
|
auto_translate_mode = 1
|
||||||
|
item_count = 2
|
||||||
|
item_0/text = "Camera"
|
||||||
|
item_0/id = 0
|
||||||
|
item_1/text = "World"
|
||||||
|
item_1/id = 1
|
||||||
|
script = ExtResource("3_r7rnh")
|
||||||
|
|
||||||
|
[node name="Camera" type="PopupMenu" parent="MenuBar/Options"]
|
||||||
|
auto_translate_mode = 1
|
||||||
|
item_count = 2
|
||||||
|
item_0/text = "Speed"
|
||||||
|
item_0/id = 0
|
||||||
|
item_1/text = "Position"
|
||||||
|
item_1/id = 1
|
||||||
|
|
||||||
|
[node name="World" type="PopupMenu" parent="MenuBar/Options"]
|
||||||
|
auto_translate_mode = 1
|
||||||
|
item_count = 1
|
||||||
|
item_0/text = "Generate"
|
||||||
|
item_0/id = 0
|
||||||
|
|
||||||
|
[node name="Info" type="PopupMenu" parent="MenuBar"]
|
||||||
|
auto_translate_mode = 1
|
||||||
|
item_count = 2
|
||||||
|
item_0/text = "Camera"
|
||||||
|
item_0/id = 0
|
||||||
|
item_1/text = "World"
|
||||||
|
item_1/id = 1
|
||||||
|
|
||||||
|
[node name="SpawnMenuButton" type="MenuButton" parent="."]
|
||||||
|
visible = false
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_top = -31.0
|
||||||
|
offset_right = 60.0
|
||||||
|
grow_vertical = 0
|
||||||
|
text = "Spawn"
|
||||||
|
item_count = 2
|
||||||
|
popup/item_0/text = "Fly"
|
||||||
|
popup/item_0/id = 0
|
||||||
|
popup/item_1/text = "Bumblebee"
|
||||||
|
popup/item_1/id = 1
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="."]
|
||||||
|
visible = false
|
||||||
|
anchors_preset = 7
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -42.5
|
||||||
|
offset_top = -31.0
|
||||||
|
offset_right = 42.5
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
text = "Spawn Fly"
|
||||||
|
|
||||||
|
[node name="GenerateWorldButton" type="Button" parent="."]
|
||||||
|
anchors_preset = 3
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -131.0
|
||||||
|
offset_top = -31.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
text = "Regenerate World"
|
||||||
|
|
||||||
|
[node name="InformationPanel" type="MarginContainer" parent="."]
|
||||||
|
anchors_preset = 12
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="InformationPanel"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="InformationPanel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="EntityInformationContainer" type="VBoxContainer" parent="InformationPanel/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="NameLabel" type="Label" parent="InformationPanel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[connection signal="index_pressed" from="MenuBar/Options" to="MenuBar" method="options_index_pressed"]
|
||||||
29
scenes/HUD/information_panel.gd
Normal file
29
scenes/HUD/information_panel.gd
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
extends MarginContainer
|
||||||
|
|
||||||
|
@onready var NameLabel: Label = $VBoxContainer/NameLabel
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
defaultInfoPanel()
|
||||||
|
ShowInfoPanel()
|
||||||
|
|
||||||
|
func BuildInfoPanel(source: Node2D) -> void:
|
||||||
|
NameLabel.text = source.name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func defaultInfoPanel() -> void:
|
||||||
|
NameLabel.text = "Nothing to show..."
|
||||||
|
|
||||||
|
|
||||||
|
func worldInfoPanel() -> void:
|
||||||
|
NameLabel.text = "World"
|
||||||
|
var sizeLabel: Label = Label.new()
|
||||||
|
sizeLabel.text = "Viewportsize: {size}".format({"size": get_viewport_rect().size})
|
||||||
|
$VBoxContainer/HBoxContainer/EntityInformationContainer.add_child(sizeLabel)
|
||||||
|
|
||||||
|
func ShowInfoPanel() -> void:
|
||||||
|
show()
|
||||||
|
|
||||||
|
|
||||||
|
func HideInfoPanel() -> void:
|
||||||
|
hide()
|
||||||
1
scenes/HUD/information_panel.gd.uid
Normal file
1
scenes/HUD/information_panel.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cm0m3up5ufny2
|
||||||
18
scenes/main/hud.gd
Normal file
18
scenes/main/hud.gd
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
extends CanvasLayer
|
||||||
|
|
||||||
|
@onready var InfoMenu = $MenuBar/Info
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta: float) -> void:
|
||||||
|
# pass
|
||||||
|
|
||||||
|
func GetMenuPressed(index) -> String:
|
||||||
|
if index == 0: return "Camera"
|
||||||
|
elif index == 1: return "World"
|
||||||
|
else: return ""
|
||||||
1
scenes/main/hud.gd.uid
Normal file
1
scenes/main/hud.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://ce6mehx86c03f
|
||||||
Reference in New Issue
Block a user