From c1ffeed23e75d09ecb507ec3321ec6b545cd24b9 Mon Sep 17 00:00:00 2001 From: Christoph Daniel Schulze Date: Sun, 8 Mar 2020 17:02:24 +0100 Subject: [PATCH] Add version label. --- glider/project.godot | 1 + glider/scenes/Menu/MainMenu.gd | 3 +++ glider/scenes/Menu/MainMenu.tscn | 33 ++++++++++++++++++++++++-------- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/glider/project.godot b/glider/project.godot index 8af88f1..87a49de 100644 --- a/glider/project.godot +++ b/glider/project.godot @@ -103,6 +103,7 @@ run/main_scene="res://scenes/Root/Root.tscn" boot_splash/image="res://scenes/Root/splash.png" boot_splash/bg_color=Color( 1, 1, 1, 1 ) config/icon="res://icon.png" +config/version="0.1.0" [autoload] diff --git a/glider/scenes/Menu/MainMenu.gd b/glider/scenes/Menu/MainMenu.gd index 8cf25d5..b86ff2d 100644 --- a/glider/scenes/Menu/MainMenu.gd +++ b/glider/scenes/Menu/MainMenu.gd @@ -7,6 +7,7 @@ extends State onready var _menu_animation := $MenuAnimation onready var _menu := $Menu onready var _aircraft_animation := $Menu/Graphics/AircraftAnimation +onready var _version_label := $Menu/Graphics/VersionLabel onready var _play_button := $Menu/Controls/NewGameButton @@ -17,6 +18,8 @@ func _ready() -> void: set_yield_on_pause(true) _menu.modulate = Color.transparent + _version_label.text = "v" + ProjectSettings.get("application/config/version") + #################################################################################### # State Lifecycle diff --git a/glider/scenes/Menu/MainMenu.tscn b/glider/scenes/Menu/MainMenu.tscn index dbcdaa6..7d0f56d 100644 --- a/glider/scenes/Menu/MainMenu.tscn +++ b/glider/scenes/Menu/MainMenu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=12 format=2] [ext_resource path="res://scenes/Clouds/Clouds.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/World/Sky.tscn" type="PackedScene" id=2] @@ -22,8 +22,13 @@ tracks/0/keys = { "times": PoolRealArray( 0, 1.5, 3 ) } -[sub_resource type="Animation" id=2] -resource_name = "FadeMenu" +[sub_resource type="DynamicFontData" id=2] +font_path = "res://themes/FutilePro.ttf" + +[sub_resource type="DynamicFont" id=3] +font_data = SubResource( 2 ) + +[sub_resource type="Animation" id=4] length = 0.2 tracks/0/type = "value" tracks/0/path = NodePath("Menu:modulate") @@ -38,8 +43,7 @@ tracks/0/keys = { "values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ] } -[sub_resource type="Animation" id=3] -resource_name = "PresentMenu" +[sub_resource type="Animation" id=5] length = 0.8 tracks/0/type = "value" tracks/0/path = NodePath("Menu/Graphics/Title:position") @@ -94,7 +98,6 @@ tracks/3/keys = { script = ExtResource( 4 ) [node name="Menu" type="Node2D" parent="."] -modulate = Color( 1, 1, 1, 0 ) [node name="Graphics" type="Node2D" parent="Menu"] @@ -127,6 +130,20 @@ margin_top = -100.0 margin_right = 1644.0 margin_bottom = 657.0 +[node name="VersionLabel" type="Label" parent="Menu/Graphics"] +margin_left = 690.435 +margin_top = 438.691 +margin_right = 925.435 +margin_bottom = 525.691 +custom_fonts/font = SubResource( 3 ) +text = "0.1.0 +" +align = 2 +valign = 2 +__meta__ = { +"_edit_use_anchors_": false +} + [node name="Controls" type="VBoxContainer" parent="Menu"] anchor_right = 0.658 margin_left = 310.0 @@ -151,7 +168,7 @@ margin_bottom = 116.0 text = "Exit" [node name="MenuAnimation" type="AnimationPlayer" parent="."] -anims/FadeMenu = SubResource( 2 ) -anims/PresentMenu = SubResource( 3 ) +anims/FadeMenu = SubResource( 4 ) +anims/PresentMenu = SubResource( 5 ) [connection signal="pressed" from="Menu/Controls/NewGameButton" to="." method="_on_NewGameButton_pressed"] [connection signal="pressed" from="Menu/Controls/QuitButton" to="." method="_on_QuitButton_pressed"]