diff --git a/project.godot b/project.godot index 022c1d2..de9d5b0 100644 --- a/project.godot +++ b/project.godot @@ -12,6 +12,7 @@ config_version=5 config/name="GFOLF 2" config/description="GFOLF: Combat Golf Action" +config/version="0.0.0" run/main_scene="res://src/game/game.tscn" config/project_settings_override="user://settings.godot" config/features=PackedStringArray("4.3", "Forward Plus") diff --git a/src/game/game.tscn b/src/game/game.tscn index 5340ea8..011d726 100644 --- a/src/game/game.tscn +++ b/src/game/game.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=10 format=3 uid="uid://cefit4bc8akbb"] +[gd_scene load_steps=11 format=3 uid="uid://cefit4bc8akbb"] [ext_resource type="Script" path="res://src/game/game.gd" id="1_4qa87"] [ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="2_y3adf"] [ext_resource type="Script" path="res://src/ui/decorations/rumbler.gd" id="3_3vfdb"] [ext_resource type="Script" path="res://src/ui/game_viewport_container.gd" id="3_rmm5i"] [ext_resource type="Script" path="res://src/game/game_viewport.gd" id="5_v2qv5"] +[ext_resource type="Script" path="res://src/util/debug_version_info.gd" id="6_42bd1"] [sub_resource type="Animation" id="Animation_c3dlb"] length = 0.001 @@ -161,6 +162,47 @@ libraries = { "": SubResource("AnimationLibrary_1s0w0") } +[node name="DebugOverlay" type="Control" parent="RootControl"] +z_index = 129 +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 + +[node name="MarginContainer" type="MarginContainer" parent="RootControl/DebugOverlay"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +theme_override_constants/margin_left = 16 +theme_override_constants/margin_top = 16 +theme_override_constants/margin_right = 16 +theme_override_constants/margin_bottom = 16 + +[node name="BuildInfo" type="HBoxContainer" parent="RootControl/DebugOverlay/MarginContainer"] +modulate = Color(1, 1, 1, 0.392157) +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 + +[node name="Label" type="Label" parent="RootControl/DebugOverlay/MarginContainer/BuildInfo"] +layout_mode = 2 +theme_type_variation = &"DebugText" +text = "PREVIEW BUILD -" + +[node name="DebugVersionInfo" type="Label" parent="RootControl/DebugOverlay/MarginContainer/BuildInfo"] +unique_name_in_owner = true +layout_mode = 2 +theme_type_variation = &"DebugText" +text = "0.0.0" +script = ExtResource("6_42bd1") + [node name="Rumbler" type="Control" parent="RootControl"] unique_name_in_owner = true layout_mode = 1 diff --git a/src/game/game_settings.gd b/src/game/game_settings.gd index 2314954..e87c83c 100644 --- a/src/game/game_settings.gd +++ b/src/game/game_settings.gd @@ -1,6 +1,8 @@ class_name GameSettingsType extends Node ## Container for project settings, for quick runtime access. +var version: String + var settings_file: String var audio_bus_file: String @@ -27,6 +29,8 @@ func _init() -> void: func _read_settings() -> void: + version = ProjectSettings.get_setting("application/config/version") + settings_file = ProjectSettings.get_setting("application/config/project_settings_override") audio_bus_file = ProjectSettings.get_setting("game/audio/buses/override_bus_layout") diff --git a/src/ui/main_theme.tres b/src/ui/main_theme.tres index e4c4615..d4631fd 100644 --- a/src/ui/main_theme.tres +++ b/src/ui/main_theme.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" load_steps=10 format=3 uid="uid://diodjft5u2cck"] +[gd_resource type="Theme" load_steps=11 format=3 uid="uid://diodjft5u2cck"] [ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="1_3rv2b"] [ext_resource type="FontFile" uid="uid://comihs66wounx" path="res://assets/fonts/Dokdo/Dokdo-Regular.ttf" id="1_eha6a"] @@ -41,6 +41,10 @@ corner_radius_bottom_right = 3 corner_radius_bottom_left = 3 corner_detail = 5 +[sub_resource type="SystemFont" id="SystemFont_3ttu2"] +font_names = PackedStringArray("Monospace") +generate_mipmaps = true + [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ynsl8"] content_margin_left = 36.0 content_margin_top = 8.0 @@ -103,6 +107,12 @@ DeathScreenLabel/base_type = &"RichTextLabel" DeathScreenLabel/colors/default_color = Color(0.611765, 0.133333, 0.133333, 1) DeathScreenLabel/colors/font_outline_color = Color(0, 0, 0, 1) DeathScreenLabel/fonts/normal_font = ExtResource("1_eha6a") +DebugText/base_type = &"Label" +DebugText/colors/font_color = Color(1, 1, 1, 1) +DebugText/colors/font_outline_color = Color(0, 0, 0, 1) +DebugText/constants/outline_size = 4 +DebugText/font_sizes/font_size = 12 +DebugText/fonts/font = SubResource("SystemFont_3ttu2") HeaderLarge/constants/outline_size = 8 HeaderLarge/font_sizes/font_size = 28 HeaderMedium/constants/outline_size = 6 diff --git a/src/util/debug_version_info.gd b/src/util/debug_version_info.gd new file mode 100644 index 0000000..faac1e2 --- /dev/null +++ b/src/util/debug_version_info.gd @@ -0,0 +1,22 @@ +extends Label +## Label showing debug info about the game version. + +## Branch info will not be printed on any of these branches. +const IGNORED_BRANCHES := ["main"] + + +func _ready() -> void: + # Fall back on baked version info + text = Game.settings.version + + var output: Array[String] = [] + var status := OS.execute("git", ["describe", "--always", "HEAD"], output) + if status == 0: + text = output[0].strip_edges() + + output = [] + status = OS.execute("git", ["branch", "--show-current"], output) + if status == 0: + var branch_name := output[0].strip_edges() + if branch_name and not branch_name in IGNORED_BRANCHES: + text += " (%s)" % branch_name