Button sprites updated

This commit is contained in:
2025-12-25 00:01:08 +03:00
parent 5384fa3caa
commit 0ed500097d
19 changed files with 467 additions and 282 deletions
+6 -1
View File
@@ -3,8 +3,9 @@ extends Control
signal continue_game
signal new_game
signal quit_game
signal show_options
signal show_credits
signal quit_game
@onready var continue_button := $%ContinueButton
@@ -61,5 +62,9 @@ func _on_options_button_pressed() -> void:
show_options.emit()
func _on_credits_button_pressed() -> void:
show_credits.emit()
func _on_quit_button_pressed() -> void:
quit_game.emit()
+26 -11
View File
@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://bxlccevt52y70"]
[ext_resource type="Script" uid="uid://dixdfabe2vfsj" path="res://game/menu/main/main_menu.gd" id="1_chmv6"]
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://styles/menu_button.tres" id="2_f5okj"]
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://styles/menu_theme.tres" id="2_f5okj"]
[node name="MainMenu" type="Control"]
layout_mode = 3
@@ -9,12 +9,18 @@ anchors_preset = 0
script = ExtResource("1_chmv6")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
top_level = true
layout_mode = 0
offset_left = 100.0
offset_top = 100.0
offset_right = 179.0
offset_bottom = 236.0
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -74.0
offset_top = -94.0
offset_right = 74.0
offset_bottom = 94.0
grow_horizontal = 2
grow_vertical = 2
[node name="ContinueButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
@@ -23,7 +29,7 @@ mouse_filter = 2
theme = ExtResource("2_f5okj")
disabled = true
button_mask = 0
text = "CONTINUE"
text = "Continue"
[node name="StartButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
@@ -31,24 +37,33 @@ layout_mode = 2
mouse_filter = 2
theme = ExtResource("2_f5okj")
button_mask = 0
text = "START"
text = "New Game"
[node name="OptionsButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
mouse_filter = 2
theme = ExtResource("2_f5okj")
text = "OPTIONS"
text = "Options"
[node name="CreditsButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
z_index = 100
layout_mode = 2
mouse_filter = 2
theme = ExtResource("2_f5okj")
text = "Credits"
[node name="QuitButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
mouse_filter = 2
theme = ExtResource("2_f5okj")
text = "QUIT"
text = "Quit"
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
[connection signal="pressed" from="VBoxContainer/ContinueButton" to="." method="_on_continue_button_pressed"]
[connection signal="pressed" from="VBoxContainer/StartButton" to="." method="_on_start_button_pressed"]
[connection signal="pressed" from="VBoxContainer/OptionsButton" to="." method="_on_options_button_pressed"]
[connection signal="pressed" from="VBoxContainer/CreditsButton" to="." method="_on_credits_button_pressed"]
[connection signal="pressed" from="VBoxContainer/QuitButton" to="." method="_on_quit_button_pressed"]
+11 -14
View File
@@ -10,11 +10,10 @@ const DEFAULT_SEED_LENGTH := 16
var _seed_regex := RegEx.new()
var _random_seed := ""
@onready var seed_label : Label = $%SeedLabel
@onready var seed_edit : LineEdit = $%SeedEdit
@onready var random_edit : LineEdit = $%RandomEdit
@onready var custom_edit : LineEdit = $%CustomEdit
@onready var use_random_button : Button = $%UseRandomButton
@onready var use_custom_button : Button = $%UseCustomButton
@@ -26,7 +25,7 @@ func _init() -> void:
func _update_use_custom_button() -> void:
var disabled := seed_edit.text.is_empty()
var disabled := custom_edit.text.is_empty()
use_custom_button.disabled = disabled
use_custom_button.focus_mode = FOCUS_NONE if disabled else FOCUS_ALL
@@ -59,10 +58,10 @@ func _on_seed_edit_text_changed(new_text: String) -> void:
for text in result:
filtered_text += text.get_string()
if seed_edit.text != filtered_text:
var caret_position := seed_edit.caret_column
seed_edit.text = filtered_text
seed_edit.caret_column = min(caret_position, filtered_text.length())
if custom_edit.text != filtered_text:
var caret_position := custom_edit.caret_column
custom_edit.text = filtered_text
custom_edit.caret_column = min(caret_position, filtered_text.length())
_update_use_custom_button()
@@ -80,17 +79,15 @@ func _on_visibility_changed() -> void:
if not is_node_ready(): return
if not visible: return
_random_seed = _get_random_seed()
seed_edit.text = ""
seed_label.text = _random_seed
custom_edit.text = ""
random_edit.text = _get_random_seed()
_init_focus()
func _on_use_random_button_pressed() -> void:
_start_game(_random_seed)
_start_game(random_edit.text)
func _on_use_custom_button_pressed() -> void:
_start_game(seed_edit.text)
_start_game(custom_edit.text)
+11 -6
View File
@@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://c36n317rhv8k7"]
[ext_resource type="Script" uid="uid://dyynshvsgnepp" path="res://game/menu/main/seed_selection_menu.gd" id="1_g2smo"]
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://styles/menu_button.tres" id="2_s4s14"]
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://styles/menu_theme.tres" id="2_s4s14"]
[sub_resource type="InputEventAction" id="InputEventAction_g2smo"]
action = &"ui_cancel"
@@ -33,12 +33,17 @@ grow_horizontal = 2
grow_vertical = 2
columns = 2
[node name="SeedLabel" type="Label" parent="GridContainer"]
[node name="RandomEdit" type="LineEdit" parent="GridContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(280, 0)
layout_mode = 2
focus_mode = 0
mouse_filter = 2
theme = ExtResource("2_s4s14")
horizontal_alignment = 1
placeholder_text = "Enter seed"
alignment = 1
max_length = 16
editable = false
[node name="UseRandomButton" type="Button" parent="GridContainer"]
unique_name_in_owner = true
@@ -47,7 +52,7 @@ mouse_filter = 2
theme = ExtResource("2_s4s14")
text = "Use random seed"
[node name="SeedEdit" type="LineEdit" parent="GridContainer"]
[node name="CustomEdit" type="LineEdit" parent="GridContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(280, 0)
layout_mode = 2
@@ -76,7 +81,7 @@ text = "Main menu"
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
[connection signal="pressed" from="GridContainer/UseRandomButton" to="." method="_on_use_random_button_pressed"]
[connection signal="text_changed" from="GridContainer/SeedEdit" to="." method="_on_seed_edit_text_changed"]
[connection signal="text_submitted" from="GridContainer/SeedEdit" to="." method="_on_seed_edit_text_submitted"]
[connection signal="text_changed" from="GridContainer/CustomEdit" to="." method="_on_seed_edit_text_changed"]
[connection signal="text_submitted" from="GridContainer/CustomEdit" to="." method="_on_seed_edit_text_submitted"]
[connection signal="pressed" from="GridContainer/UseCustomButton" to="." method="_on_use_custom_button_pressed"]
[connection signal="pressed" from="GridContainer/BackButton" to="." method="_on_back_button_pressed"]
+6 -6
View File
@@ -1,10 +1,10 @@
extends Control
@onready var main_menu : Control = $MainMenu
@onready var options : Control = $Options
@onready var credits : Control = $Credits
@onready var seed_selection : Control = $SeedSelection
@onready var main_menu : Control = $%MainMenu
@onready var options : Control = $%Options
@onready var credits : Control = $%Credits
@onready var seed_selection : Control = $%SeedSelection
func _ready() -> void:
@@ -37,12 +37,12 @@ func _on_main_menu_show_options() -> void:
_show_menu(options)
func _on_options_show_credits() -> void:
func _on_main_menu_show_credits() -> void:
_show_menu(credits)
func _on_credits_back() -> void:
_show_menu(options)
_show_menu(main_menu)
func _show_main_menu() -> void:
+37 -34
View File
@@ -1,6 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://2oavbr7oaihg"]
[gd_scene load_steps=8 format=3 uid="uid://2oavbr7oaihg"]
[ext_resource type="Script" uid="uid://bqnepsuk13qo8" path="res://game/menu/main/title_screen.gd" id="1_lxdol"]
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://styles/menu_theme.tres" id="2_4xt7k"]
[ext_resource type="PackedScene" uid="uid://bxlccevt52y70" path="res://game/menu/main/main_menu.tscn" id="2_o0rbc"]
[ext_resource type="PackedScene" uid="uid://btr60idiit4y7" path="res://game/menu/common/options.tscn" id="3_88gnj"]
[ext_resource type="PackedScene" uid="uid://c3q3g2647qc27" path="res://game/menu/common/credits.tscn" id="4_w1y3c"]
@@ -9,45 +10,47 @@
[node name="TitleScreen" type="Control"]
layout_mode = 3
anchors_preset = 0
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_lxdol")
[node name="MainMenu" parent="." instance=ExtResource("2_o0rbc")]
layout_mode = 0
[node name="Options" parent="." instance=ExtResource("3_88gnj")]
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_right = 640.0
offset_bottom = 360.0
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("2_4xt7k")
[node name="Credits" parent="." instance=ExtResource("4_w1y3c")]
layout_mode = 0
[node name="MainMenu" parent="MarginContainer" instance=ExtResource("2_o0rbc")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
[node name="SeedSelection" parent="." instance=ExtResource("5_w1y3c")]
layout_mode = 0
anchors_preset = 0
anchor_right = 0.0
anchor_bottom = 0.0
offset_left = 320.0
offset_top = 190.0
offset_right = 320.0
offset_bottom = 190.0
grow_horizontal = 1
grow_vertical = 1
[node name="Options" parent="MarginContainer" instance=ExtResource("3_88gnj")]
unique_name_in_owner = true
layout_mode = 2
[node name="Credits" parent="MarginContainer" instance=ExtResource("4_w1y3c")]
unique_name_in_owner = true
layout_mode = 2
[node name="SeedSelection" parent="MarginContainer" instance=ExtResource("5_w1y3c")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
[node name="Background" parent="." instance=ExtResource("5_88gnj")]
[connection signal="continue_game" from="MainMenu" to="." method="_on_main_menu_continue_game"]
[connection signal="new_game" from="MainMenu" to="." method="_on_main_menu_new_game"]
[connection signal="quit_game" from="MainMenu" to="." method="_on_main_menu_quit_game"]
[connection signal="show_options" from="MainMenu" to="." method="_on_main_menu_show_options"]
[connection signal="back" from="Options" to="." method="_show_main_menu"]
[connection signal="show_credits" from="Options" to="." method="_on_options_show_credits"]
[connection signal="back" from="Credits" to="." method="_on_credits_back"]
[connection signal="back" from="SeedSelection" to="." method="_show_main_menu"]
[connection signal="continue_game" from="MarginContainer/MainMenu" to="." method="_on_main_menu_continue_game"]
[connection signal="new_game" from="MarginContainer/MainMenu" to="." method="_on_main_menu_new_game"]
[connection signal="quit_game" from="MarginContainer/MainMenu" to="." method="_on_main_menu_quit_game"]
[connection signal="show_credits" from="MarginContainer/MainMenu" to="." method="_on_main_menu_show_credits"]
[connection signal="show_options" from="MarginContainer/MainMenu" to="." method="_on_main_menu_show_options"]
[connection signal="back" from="MarginContainer/Options" to="." method="_show_main_menu"]
[connection signal="back" from="MarginContainer/Credits" to="." method="_on_credits_back"]
[connection signal="back" from="MarginContainer/SeedSelection" to="." method="_show_main_menu"]