diff --git a/.idea/.idea.Ecosystem/.idea/libraries/GdSdk.xml b/.idea/.idea.Ecosystem/.idea/libraries/GdSdk.xml new file mode 100644 index 0000000..72a9c1b --- /dev/null +++ b/.idea/.idea.Ecosystem/.idea/libraries/GdSdk.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/scenes/HUD/hud.tscn b/scenes/HUD/hud.tscn new file mode 100644 index 0000000..5c37956 --- /dev/null +++ b/scenes/HUD/hud.tscn @@ -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"] diff --git a/scenes/HUD/information_panel.gd b/scenes/HUD/information_panel.gd new file mode 100644 index 0000000..4c3baeb --- /dev/null +++ b/scenes/HUD/information_panel.gd @@ -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() \ No newline at end of file diff --git a/scenes/HUD/information_panel.gd.uid b/scenes/HUD/information_panel.gd.uid new file mode 100644 index 0000000..193ee9f --- /dev/null +++ b/scenes/HUD/information_panel.gd.uid @@ -0,0 +1 @@ +uid://cm0m3up5ufny2 diff --git a/scenes/main/hud.gd b/scenes/main/hud.gd new file mode 100644 index 0000000..610e045 --- /dev/null +++ b/scenes/main/hud.gd @@ -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 "" diff --git a/scenes/main/hud.gd.uid b/scenes/main/hud.gd.uid new file mode 100644 index 0000000..247d34b --- /dev/null +++ b/scenes/main/hud.gd.uid @@ -0,0 +1 @@ +uid://ce6mehx86c03f