Skip to content

Commit

Permalink
Add version label to main menu
Browse files Browse the repository at this point in the history
This adds a version label which displays the value of a project property.
The project property can be overriden using an override.cfg file.
This'll come in handy when we publish our releases, so we can display the actual version number in the main menu.

WIP #18
  • Loading branch information
Thierry Lacour committed Jul 15, 2021
1 parent 54e5169 commit 8cc4f2e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
24 changes: 20 additions & 4 deletions Scenes/MainMenu.tscn
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]

[ext_resource path="res://Scripts/Version.gd" type="Script" id=1]
[ext_resource path="res://addons/gut/fonts/AnonymousPro-Bold.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://addons/gut/fonts/CourierPrime-Bold.ttf" type="DynamicFontData" id=5]
[ext_resource path="res://Scripts/Menu.gd" type="Script" id=6]
Expand Down Expand Up @@ -27,6 +28,20 @@ transform = Transform2D( 1, 0, 0, 1, 0, 400 )
autoScroll = true
autoScrollSpeed = 200

[node name="Version" type="Label" parent="."]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = -24.0
margin_right = 57.0
margin_bottom = -10.0
text = "{version}"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="MenuOptions" type="VBoxContainer" parent="."]
anchor_top = 0.5
anchor_bottom = 0.5
Expand All @@ -51,7 +66,7 @@ __meta__ = {
[node name="Start" type="Button" parent="MenuOptions"]
margin_top = 63.0
margin_right = 248.0
margin_bottom = 110.0
margin_bottom = 119.0
rect_min_size = Vector2( 122, 47 )
size_flags_horizontal = 7
size_flags_vertical = 7
Expand All @@ -61,9 +76,9 @@ flat = true
align = 0

[node name="Exit" type="Button" parent="MenuOptions"]
margin_top = 114.0
margin_top = 123.0
margin_right = 248.0
margin_bottom = 161.0
margin_bottom = 179.0
rect_min_size = Vector2( 122, 47 )
size_flags_horizontal = 7
size_flags_vertical = 7
Expand All @@ -76,6 +91,7 @@ __meta__ = {
}

[node name="SceneTransitionRect" parent="." instance=ExtResource( 7 )]
visible = false
anchor_top = 0.5
anchor_right = 0.0
anchor_bottom = 0.5
Expand Down
4 changes: 4 additions & 0 deletions Scripts/Version.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends Label

func _ready():
text = ProjectSettings.get_setting("global/version")
4 changes: 4 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ window/stretch/aspect="expand"

enabled=PoolStringArray( )

[global]

version="local"

[input]

move_right={
Expand Down

0 comments on commit 8cc4f2e

Please sign in to comment.