diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-10-03 12:51:49 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-10-03 12:51:49 +0200 |
commit | 5442988a8ccecb9c323fc98557391a15ff245b87 (patch) | |
tree | 1864a03602291e2c495a8846b80ec90414060f61 /UI | |
parent | c8bd14d6feeca72fc96b895c9382ebc16a1caf55 (diff) |
next commit
Diffstat (limited to 'UI')
23 files changed, 457 insertions, 3 deletions
diff --git a/UI/Assets/ButtonBackground.kra b/UI/Assets/ButtonBackground.kra Binary files differnew file mode 100644 index 0000000..01cc26c --- /dev/null +++ b/UI/Assets/ButtonBackground.kra diff --git a/UI/Assets/ButtonBackground.kra~ b/UI/Assets/ButtonBackground.kra~ Binary files differnew file mode 100644 index 0000000..064553c --- /dev/null +++ b/UI/Assets/ButtonBackground.kra~ diff --git a/UI/Assets/ButtonBlocker.png b/UI/Assets/ButtonBlocker.png Binary files differnew file mode 100644 index 0000000..ec22fe8 --- /dev/null +++ b/UI/Assets/ButtonBlocker.png diff --git a/UI/Assets/ButtonBlocker.png.import b/UI/Assets/ButtonBlocker.png.import new file mode 100644 index 0000000..a6911b5 --- /dev/null +++ b/UI/Assets/ButtonBlocker.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://nypt5ybs2yjf" +path="res://.godot/imported/ButtonBlocker.png-d66206ffe9f20f0f85ae0b6c22af2b39.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonBlocker.png" +dest_files=["res://.godot/imported/ButtonBlocker.png-d66206ffe9f20f0f85ae0b6c22af2b39.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/UI/Assets/ButtonDigger.png b/UI/Assets/ButtonDigger.png Binary files differnew file mode 100644 index 0000000..7ee9cfc --- /dev/null +++ b/UI/Assets/ButtonDigger.png diff --git a/UI/Assets/ButtonDigger.png.import b/UI/Assets/ButtonDigger.png.import new file mode 100644 index 0000000..09303ad --- /dev/null +++ b/UI/Assets/ButtonDigger.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bg118k8yia0bf" +path="res://.godot/imported/ButtonDigger.png-cf1dd6a1dee88b883e19f2a938ecbc0f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonDigger.png" +dest_files=["res://.godot/imported/ButtonDigger.png-cf1dd6a1dee88b883e19f2a938ecbc0f.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/UI/Assets/ButtonFloater.png b/UI/Assets/ButtonFloater.png Binary files differnew file mode 100644 index 0000000..d0e64e3 --- /dev/null +++ b/UI/Assets/ButtonFloater.png diff --git a/UI/Assets/ButtonFloater.png.import b/UI/Assets/ButtonFloater.png.import new file mode 100644 index 0000000..a0b7c01 --- /dev/null +++ b/UI/Assets/ButtonFloater.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://61yuhqwes5hw" +path="res://.godot/imported/ButtonFloater.png-364d4a5ae4f59f72e8dbcd6e4acdf464.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonFloater.png" +dest_files=["res://.godot/imported/ButtonFloater.png-364d4a5ae4f59f72e8dbcd6e4acdf464.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/UI/Assets/ButtonMiner.png b/UI/Assets/ButtonMiner.png Binary files differnew file mode 100644 index 0000000..bb68cea --- /dev/null +++ b/UI/Assets/ButtonMiner.png diff --git a/UI/Assets/ButtonMiner.png.import b/UI/Assets/ButtonMiner.png.import new file mode 100644 index 0000000..a53d8fe --- /dev/null +++ b/UI/Assets/ButtonMiner.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c0hcl4yvb02wx" +path="res://.godot/imported/ButtonMiner.png-0b2051c793e78ca1483fddf34f005852.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonMiner.png" +dest_files=["res://.godot/imported/ButtonMiner.png-0b2051c793e78ca1483fddf34f005852.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/UI/Assets/ButtonMinus.png b/UI/Assets/ButtonMinus.png Binary files differnew file mode 100644 index 0000000..7b92c6e --- /dev/null +++ b/UI/Assets/ButtonMinus.png diff --git a/UI/Assets/ButtonMinus.png.import b/UI/Assets/ButtonMinus.png.import new file mode 100644 index 0000000..800ee7a --- /dev/null +++ b/UI/Assets/ButtonMinus.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dg3qtw0fdjmt5" +path="res://.godot/imported/ButtonMinus.png-075f05033dd6f4e8e4951b5b8912d54d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonMinus.png" +dest_files=["res://.godot/imported/ButtonMinus.png-075f05033dd6f4e8e4951b5b8912d54d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/UI/Assets/ButtonPlus.png b/UI/Assets/ButtonPlus.png Binary files differnew file mode 100644 index 0000000..6f6cdfa --- /dev/null +++ b/UI/Assets/ButtonPlus.png diff --git a/UI/Assets/ButtonPlus.png.import b/UI/Assets/ButtonPlus.png.import new file mode 100644 index 0000000..8d2e06b --- /dev/null +++ b/UI/Assets/ButtonPlus.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://wreo4yu472g8" +path="res://.godot/imported/ButtonPlus.png-c9cec6fda7ce360ae8e870c082ee9ece.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonPlus.png" +dest_files=["res://.godot/imported/ButtonPlus.png-c9cec6fda7ce360ae8e870c082ee9ece.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/UI/Assets/Minimal3x5.ttf b/UI/Assets/Minimal3x5.ttf Binary files differnew file mode 100755 index 0000000..3024b74 --- /dev/null +++ b/UI/Assets/Minimal3x5.ttf diff --git a/UI/Assets/Minimal3x5.ttf.import b/UI/Assets/Minimal3x5.ttf.import new file mode 100644 index 0000000..14b7f6a --- /dev/null +++ b/UI/Assets/Minimal3x5.ttf.import @@ -0,0 +1,34 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://crgfw6f835m3m" +path="res://.godot/imported/Minimal3x5.ttf-dc2b1be58f03aff5eeaba82a04186949.fontdata" + +[deps] + +source_file="res://UI/Assets/Minimal3x5.ttf" +dest_files=["res://.godot/imported/Minimal3x5.ttf-dc2b1be58f03aff5eeaba82a04186949.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/UI/Assets/Minimal5x5Monospaced.ttf b/UI/Assets/Minimal5x5Monospaced.ttf Binary files differnew file mode 100755 index 0000000..8ef9fa1 --- /dev/null +++ b/UI/Assets/Minimal5x5Monospaced.ttf diff --git a/UI/Assets/Minimal5x5Monospaced.ttf.import b/UI/Assets/Minimal5x5Monospaced.ttf.import new file mode 100644 index 0000000..fb4b92d --- /dev/null +++ b/UI/Assets/Minimal5x5Monospaced.ttf.import @@ -0,0 +1,34 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://cj1xpi1laoqjn" +path="res://.godot/imported/Minimal5x5Monospaced.ttf-a0848cfd04130d05a79e1d59149440f6.fontdata" + +[deps] + +source_file="res://UI/Assets/Minimal5x5Monospaced.ttf" +dest_files=["res://.godot/imported/Minimal5x5Monospaced.ttf-a0848cfd04130d05a79e1d59149440f6.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/UI/Assets/Minimal5x7.ttf b/UI/Assets/Minimal5x7.ttf Binary files differnew file mode 100755 index 0000000..7372987 --- /dev/null +++ b/UI/Assets/Minimal5x7.ttf diff --git a/UI/Assets/Minimal5x7.ttf.import b/UI/Assets/Minimal5x7.ttf.import new file mode 100644 index 0000000..1285d08 --- /dev/null +++ b/UI/Assets/Minimal5x7.ttf.import @@ -0,0 +1,34 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://deqwl54q7v6ss" +path="res://.godot/imported/Minimal5x7.ttf-06e99207940c6ab1948789ba6cea9b9b.fontdata" + +[deps] + +source_file="res://UI/Assets/Minimal5x7.ttf" +dest_files=["res://.godot/imported/Minimal5x7.ttf-06e99207940c6ab1948789ba6cea9b9b.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/UI/HUD.tscn b/UI/HUD.tscn index 5d4ac5b..b060ce3 100644 --- a/UI/HUD.tscn +++ b/UI/HUD.tscn @@ -1,13 +1,128 @@ -[gd_scene load_steps=2 format=3 uid="uid://d0mlxe0gcctle"] +[gd_scene load_steps=9 format=3 uid="uid://d0mlxe0gcctle"] [ext_resource type="Script" path="res://UI/hud.gd" id="1_rpghv"] +[ext_resource type="Texture2D" uid="uid://nypt5ybs2yjf" path="res://UI/Assets/ButtonBlocker.png" id="2_6o4l1"] +[ext_resource type="Theme" uid="uid://lpvaxe35v64b" path="res://UI/theme.tres" id="2_he3is"] +[ext_resource type="Texture2D" uid="uid://bg118k8yia0bf" path="res://UI/Assets/ButtonDigger.png" id="3_585t4"] +[ext_resource type="Texture2D" uid="uid://wreo4yu472g8" path="res://UI/Assets/ButtonPlus.png" id="4_dku02"] +[ext_resource type="Texture2D" uid="uid://c0hcl4yvb02wx" path="res://UI/Assets/ButtonMiner.png" id="5_5j5y4"] +[ext_resource type="Texture2D" uid="uid://dg3qtw0fdjmt5" path="res://UI/Assets/ButtonMinus.png" id="5_ybavg"] +[ext_resource type="Texture2D" uid="uid://61yuhqwes5hw" path="res://UI/Assets/ButtonFloater.png" id="6_qnbw6"] [node name="HUD" type="CanvasLayer"] script = ExtResource("1_rpghv") [node name="Score" type="Label" parent="."] unique_name_in_owner = true +texture_filter = 1 offset_left = 4.0 -offset_right = 14.0 -offset_bottom = 23.0 +offset_top = 4.0 +offset_right = 10.0 +offset_bottom = 14.0 +theme = ExtResource("2_he3is") text = "0" + +[node name="Speed" type="Label" parent="."] +unique_name_in_owner = true +texture_filter = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -8.0 +offset_top = 4.0 +offset_right = -4.0 +offset_bottom = 14.0 +grow_horizontal = 0 +theme = ExtResource("2_he3is") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 0 +theme = ExtResource("2_he3is") +theme_override_constants/separation = 0 + +[node name="ButtonBlocker" type="TextureRect" parent="HBoxContainer"] +texture_filter = 1 +custom_minimum_size = Vector2(16, 16) +layout_mode = 2 +mouse_default_cursor_shape = 2 +texture = ExtResource("2_6o4l1") +stretch_mode = 5 + +[node name="ButtonDigger" type="TextureRect" parent="HBoxContainer"] +texture_filter = 1 +custom_minimum_size = Vector2(16, 16) +layout_mode = 2 +mouse_default_cursor_shape = 2 +texture = ExtResource("3_585t4") +stretch_mode = 5 + +[node name="ButtonMiner" type="TextureRect" parent="HBoxContainer"] +texture_filter = 1 +custom_minimum_size = Vector2(16, 16) +layout_mode = 2 +mouse_default_cursor_shape = 2 +texture = ExtResource("5_5j5y4") +stretch_mode = 5 + +[node name="ButtonBasher" type="TextureRect" parent="HBoxContainer"] +texture_filter = 1 +custom_minimum_size = Vector2(16, 16) +layout_mode = 2 +mouse_default_cursor_shape = 2 +texture = ExtResource("3_585t4") +stretch_mode = 5 + +[node name="ButtonFloater" type="TextureRect" parent="HBoxContainer"] +texture_filter = 1 +custom_minimum_size = Vector2(16, 16) +layout_mode = 2 +mouse_default_cursor_shape = 2 +texture = ExtResource("6_qnbw6") +stretch_mode = 5 + +[node name="ButtonBuilder" type="TextureRect" parent="HBoxContainer"] +texture_filter = 1 +custom_minimum_size = Vector2(16, 16) +layout_mode = 2 +mouse_default_cursor_shape = 2 +texture = ExtResource("3_585t4") +stretch_mode = 5 + +[node name="ButtonClimber" type="TextureRect" parent="HBoxContainer"] +texture_filter = 1 +custom_minimum_size = Vector2(16, 16) +layout_mode = 2 +mouse_default_cursor_shape = 2 +texture = ExtResource("3_585t4") +stretch_mode = 5 + +[node name="ButtonPlus" type="TextureRect" parent="HBoxContainer"] +texture_filter = 1 +custom_minimum_size = Vector2(16, 16) +layout_mode = 2 +mouse_default_cursor_shape = 2 +texture = ExtResource("4_dku02") +stretch_mode = 5 + +[node name="ButtonMinus" type="TextureRect" parent="HBoxContainer"] +texture_filter = 1 +custom_minimum_size = Vector2(16, 16) +layout_mode = 2 +mouse_default_cursor_shape = 2 +texture = ExtResource("5_ybavg") +stretch_mode = 5 + +[connection signal="gui_input" from="HBoxContainer/ButtonBlocker" to="." method="_on_button_blocker_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonDigger" to="." method="_on_button_digger_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonMiner" to="." method="_on_button_miner_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonBasher" to="." method="_on_button_digger_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonFloater" to="." method="_on_button_digger_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonBuilder" to="." method="_on_button_digger_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonClimber" to="." method="_on_button_digger_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonPlus" to="." method="_on_button_plus_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonMinus" to="." method="_on_button_minus_gui_input"] @@ -5,3 +5,29 @@ func _ready() -> void: Game.score_changed.connect(func(): %Score.text = str(Game.score) ) + + Game.speed_changed.connect(func(): + %Speed.text = str(Game.speed).pad_decimals(1) + "x" + ) + + +func _on_button_blocker_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + Game.selected_unit_type = preload("res://Units/Blocker.tscn") + +func _on_button_digger_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + Game.selected_unit_type = preload("res://Units/Digger.tscn") + +func _on_button_miner_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + Game.selected_unit_type = preload("res://Units/Miner.tscn") + + +func _on_button_plus_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + Game.speed = min(Game.speed + 0.5, 5) + +func _on_button_minus_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + Game.speed = max(Game.speed - 0.5, 0.5) diff --git a/UI/theme.tres b/UI/theme.tres new file mode 100644 index 0000000..151ae16 --- /dev/null +++ b/UI/theme.tres @@ -0,0 +1,7 @@ +[gd_resource type="Theme" load_steps=2 format=3 uid="uid://lpvaxe35v64b"] + +[ext_resource type="FontFile" uid="uid://deqwl54q7v6ss" path="res://UI/Assets/Minimal5x7.ttf" id="1_vykgj"] + +[resource] +Label/font_sizes/font_size = 16 +Label/fonts/font = ExtResource("1_vykgj") |