diff --git a/godot/boot.tscn b/godot/boot.tscn index 1f6c2a8..4f8a085 100644 --- a/godot/boot.tscn +++ b/godot/boot.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://yrr5jjbpt60l"] -[ext_resource type="PackedScene" uid="uid://e3dmisrrgqq7" path="res://testmap.tscn" id="1_3f7mp"] +[ext_resource type="PackedScene" uid="uid://73cn4swq2gc7" path="res://game_ui.tscn" id="1_g28e3"] [node name="GameRoot3D" type="GameRoot3D"] -first_boot_level = ExtResource("1_3f7mp") +first_boot_level = ExtResource("1_g28e3") diff --git a/godot/game_end_screen.tscn b/godot/game_end_screen.tscn new file mode 100644 index 0000000..ee30b12 --- /dev/null +++ b/godot/game_end_screen.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=3 format=3 uid="uid://05prvqpy0r6m"] + +[ext_resource type="PackedScene" uid="uid://73cn4swq2gc7" path="res://game_ui.tscn" id="1_c4p6k"] +[ext_resource type="PackedScene" uid="uid://e3dmisrrgqq7" path="res://testmap.tscn" id="2_qhspd"] + +[node name="Level3D" type="Level3D"] + +[node name="EndScreen" type="EndScreen" parent="."] +main_menu_scene = ExtResource("1_c4p6k") +game_scene = ExtResource("2_qhspd") + +[node name="RestartButton" type="Button" parent="EndScreen"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -78.5 +offset_top = -29.0 +offset_right = 78.5 +offset_bottom = 29.0 +grow_horizontal = 2 +grow_vertical = 2 +focus_neighbor_bottom = NodePath("../MainMenuButton") +text = "Restart" + +[node name="MainMenuButton" type="Button" parent="EndScreen"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -78.0 +offset_top = 55.0 +offset_right = 79.0 +offset_bottom = 113.0 +grow_horizontal = 2 +grow_vertical = 2 +focus_neighbor_top = NodePath("../RestartButton") +text = "Menu" diff --git a/godot/game_ui.tscn b/godot/game_ui.tscn new file mode 100644 index 0000000..852a3f3 --- /dev/null +++ b/godot/game_ui.tscn @@ -0,0 +1,46 @@ +[gd_scene load_steps=2 format=3 uid="uid://73cn4swq2gc7"] + +[ext_resource type="PackedScene" uid="uid://e3dmisrrgqq7" path="res://testmap.tscn" id="1_kul4y"] + +[node name="Level3D" type="Level3D"] + +[node name="GameUI" type="MenuUI" parent="."] +game_scene = ExtResource("1_kul4y") + +[node name="StartButton" type="Button" parent="GameUI"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -115.0 +offset_top = -57.0 +offset_right = 115.0 +offset_bottom = 57.0 +grow_horizontal = 2 +grow_vertical = 2 +focus_neighbor_bottom = NodePath("../ControlsButton") +text = "Start" + +[node name="ControlsButton" type="Button" parent="GameUI"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -115.0 +offset_top = 111.0 +offset_right = 115.0 +offset_bottom = 225.0 +grow_horizontal = 2 +grow_vertical = 2 +focus_neighbor_top = NodePath("../StartButton") +text = "Controls" + +[node name="ControlsScreen" type="Panel" parent="GameUI"] +offset_left = 32.0 +offset_top = 30.0 +offset_right = 437.0 +offset_bottom = 339.0 + +[node name="Camera3D" type="Camera3D" parent="."] diff --git a/src/end_screen.cpp b/src/end_screen.cpp new file mode 100644 index 0000000..05b3dd0 --- /dev/null +++ b/src/end_screen.cpp @@ -0,0 +1,47 @@ +#include "end_screen.hpp" +#include "godot_cpp/classes/button.hpp" +#include "godot_cpp/classes/global_constants.hpp" +#include "utils/game_root.hpp" +#include "utils/godot_macros.h" + +namespace godot { +void EndScreen::_bind_methods() { +#define CLASSNAME EndScreen + GDPROPERTY_HINTED(main_menu_scene, Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"); + GDPROPERTY_HINTED(game_scene, Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"); +} + +void EndScreen::_enter_tree() { GDGAMEONLY(); + Button *restart_button = this->get_node