fixed menu color problem
This commit is contained in:
parent
bb034108c8
commit
036c42b5bc
4 changed files with 168 additions and 158 deletions
68
gmtk_2024/control.gd
Normal file
68
gmtk_2024/control.gd
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
var display_text = """
|
||||||
|
SYSTEM INITIALIZATION...
|
||||||
|
---------------------------------------
|
||||||
|
PLACEHOLDER BOOT SEQUENCE
|
||||||
|
COPYRIGHT PLACEHOLDER
|
||||||
|
|
||||||
|
> CPU:
|
||||||
|
> MEMORY:
|
||||||
|
> STORAGE:
|
||||||
|
> GPU:
|
||||||
|
|
||||||
|
>> WARNING:
|
||||||
|
>> RECOMMENDED ACTION:
|
||||||
|
|
||||||
|
SYSTEM READY.
|
||||||
|
PRESS START TO INITIATE.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
var current_text = ""
|
||||||
|
var char_index = 0
|
||||||
|
var typing_speed = 0.05
|
||||||
|
var fast_typing_speed = 0.005
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
for hbox in $VBoxContainer/VBoxContainer3.get_children():
|
||||||
|
hbox.visible = false
|
||||||
|
|
||||||
|
_start_typing()
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if Input.is_action_pressed("ui_accept") or Input.is_action_pressed("click"):
|
||||||
|
typing_speed = fast_typing_speed
|
||||||
|
else:
|
||||||
|
typing_speed = 0.05
|
||||||
|
|
||||||
|
func _start_typing() -> void:
|
||||||
|
current_text = ""
|
||||||
|
char_index = 0
|
||||||
|
_update_text()
|
||||||
|
|
||||||
|
func _update_text() -> void:
|
||||||
|
if char_index < display_text.length():
|
||||||
|
current_text += display_text[char_index]
|
||||||
|
$VBoxContainer/VBoxContainer2/Label.text = current_text
|
||||||
|
char_index += 1
|
||||||
|
await get_tree().create_timer(typing_speed).timeout
|
||||||
|
_update_text()
|
||||||
|
else:
|
||||||
|
_show_menu_options()
|
||||||
|
|
||||||
|
func _show_menu_options() -> void:
|
||||||
|
for hbox in $VBoxContainer/VBoxContainer3.get_children():
|
||||||
|
hbox.visible = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_start_button_pressed() -> void:
|
||||||
|
print("Start Button Clicked")
|
||||||
|
|
||||||
|
func _on_credits_button_pressed() -> void:
|
||||||
|
print("Credits Button Clicked")
|
||||||
|
|
||||||
|
func _on_quit_button_pressed() -> void:
|
||||||
|
$VBoxContainer/VBoxContainer2/Label.text += "\nBye!"
|
||||||
|
await get_tree().create_timer(0.5).timeout
|
||||||
|
get_tree().quit()
|
99
gmtk_2024/menu/main_menu/MainMenu.tscn
Normal file
99
gmtk_2024/menu/main_menu/MainMenu.tscn
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
[gd_scene load_steps=5 format=3 uid="uid://1h2urto6y63r"]
|
||||||
|
|
||||||
|
[ext_resource type="FontFile" uid="uid://d3pbvdemdbxes" path="res://CommodoreSixtyFour.ttf" id="1_1tx2i"]
|
||||||
|
[ext_resource type="Script" path="res://control.gd" id="2_deavt"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_vnp6n"]
|
||||||
|
|
||||||
|
[sub_resource type="Theme" id="Theme_p2nm6"]
|
||||||
|
default_font = ExtResource("1_1tx2i")
|
||||||
|
Button/colors/font_color = Color(0, 1, 0, 1)
|
||||||
|
Label/colors/font_color = Color(0, 1, 0, 1)
|
||||||
|
Label/colors/font_outline_color = Color(0, 0, 0, 1)
|
||||||
|
Label/colors/font_shadow_color = Color(0, 0, 0, 0)
|
||||||
|
Label/constants/line_spacing = 3
|
||||||
|
Label/constants/outline_size = 0
|
||||||
|
Label/constants/shadow_offset_x = 1
|
||||||
|
Label/constants/shadow_offset_y = 1
|
||||||
|
Label/constants/shadow_outline_size = 1
|
||||||
|
Label/font_sizes/font_size = 16
|
||||||
|
Label/styles/normal = SubResource("StyleBoxEmpty_vnp6n")
|
||||||
|
|
||||||
|
[node name="MainMenu" type="MarginContainer"]
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme = SubResource("Theme_p2nm6")
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="Control" type="Control" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
script = ExtResource("2_deavt")
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="Control"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
|
||||||
|
[node name="VBoxContainer2" type="VBoxContainer" parent="Control/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer2"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="VBoxContainer3" type="VBoxContainer" parent="Control/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="Control/VBoxContainer/VBoxContainer3"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(8, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_fonts/font = ExtResource("1_1tx2i")
|
||||||
|
text = ">"
|
||||||
|
|
||||||
|
[node name="start" type="Button" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "start"
|
||||||
|
flat = true
|
||||||
|
|
||||||
|
[node name="HBoxContainer2" type="HBoxContainer" parent="Control/VBoxContainer/VBoxContainer3"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer2"]
|
||||||
|
custom_minimum_size = Vector2(8, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_fonts/font = ExtResource("1_1tx2i")
|
||||||
|
text = ">"
|
||||||
|
|
||||||
|
[node name="credits" type="Button" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer2"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "credits"
|
||||||
|
flat = true
|
||||||
|
|
||||||
|
[node name="HBoxContainer3" type="HBoxContainer" parent="Control/VBoxContainer/VBoxContainer3"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer3"]
|
||||||
|
custom_minimum_size = Vector2(8, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_fonts/font = ExtResource("1_1tx2i")
|
||||||
|
text = ">"
|
||||||
|
|
||||||
|
[node name="quit" type="Button" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer3"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "quit"
|
||||||
|
flat = true
|
||||||
|
|
||||||
|
[connection signal="pressed" from="Control/VBoxContainer/VBoxContainer3/HBoxContainer/start" to="Control" method="_on_start_button_pressed"]
|
||||||
|
[connection signal="pressed" from="Control/VBoxContainer/VBoxContainer3/HBoxContainer2/credits" to="Control" method="_on_credits_button_pressed"]
|
||||||
|
[connection signal="pressed" from="Control/VBoxContainer/VBoxContainer3/HBoxContainer3/quit" to="Control" method="_on_quit_button_pressed"]
|
|
@ -1,157 +0,0 @@
|
||||||
[gd_scene load_steps=3 format=3 uid="uid://dpiyhpt7it05x"]
|
|
||||||
|
|
||||||
[ext_resource type="FontFile" uid="uid://d3pbvdemdbxes" path="res://CommodoreSixtyFour.ttf" id="1_4eeva"]
|
|
||||||
|
|
||||||
[sub_resource type="GDScript" id="GDScript_0d3dd"]
|
|
||||||
script/source = "extends Control
|
|
||||||
|
|
||||||
var display_text = \"\"\"
|
|
||||||
SYSTEM INITIALIZATION...
|
|
||||||
---------------------------------------
|
|
||||||
PLACEHOLDER BOOT SEQUENCE
|
|
||||||
COPYRIGHT PLACEHOLDER
|
|
||||||
|
|
||||||
> CPU:
|
|
||||||
> MEMORY:
|
|
||||||
> STORAGE:
|
|
||||||
> GPU:
|
|
||||||
|
|
||||||
>> WARNING:
|
|
||||||
>> RECOMMENDED ACTION:
|
|
||||||
|
|
||||||
SYSTEM READY.
|
|
||||||
PRESS START TO INITIATE.
|
|
||||||
|
|
||||||
\"\"\"
|
|
||||||
|
|
||||||
var current_text = \"\"
|
|
||||||
var char_index = 0
|
|
||||||
var typing_speed = 0.05
|
|
||||||
var fast_typing_speed = 0.01
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
modulate = Color(0, 0, 0)
|
|
||||||
|
|
||||||
$VBoxContainer/Label.add_theme_color_override(\"font_color\", Color(0, 1, 0))
|
|
||||||
|
|
||||||
$VBoxContainer/Label.set_custom_minimum_size(Vector2(20, 0))
|
|
||||||
|
|
||||||
for button in $VBoxContainer/VBoxContainer2.get_children():
|
|
||||||
if button is Button:
|
|
||||||
button.visible = false
|
|
||||||
button.add_theme_color_override(\"font_color\", Color(0, 1, 0))
|
|
||||||
button.add_theme_stylebox_override(\"normal\", StyleBoxEmpty.new())
|
|
||||||
|
|
||||||
_start_typing()
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
if Input.is_action_pressed(\"ui_accept\") or Input.is_action_pressed(\"click\"):
|
|
||||||
typing_speed = fast_typing_speed
|
|
||||||
else:
|
|
||||||
typing_speed = 0.05
|
|
||||||
|
|
||||||
func _start_typing() -> void:
|
|
||||||
current_text = \"\"
|
|
||||||
char_index = 0
|
|
||||||
_update_text()
|
|
||||||
|
|
||||||
func _update_text() -> void:
|
|
||||||
if char_index < display_text.length():
|
|
||||||
current_text += display_text[char_index]
|
|
||||||
$VBoxContainer/Label.text = current_text
|
|
||||||
char_index += 1
|
|
||||||
await get_tree().create_timer(typing_speed).timeout
|
|
||||||
_update_text()
|
|
||||||
else:
|
|
||||||
_show_menu_options()
|
|
||||||
|
|
||||||
func _show_menu_options() -> void:
|
|
||||||
for button in $VBoxContainer/VBoxContainer2.get_children():
|
|
||||||
button.visible = true
|
|
||||||
|
|
||||||
func _on_start_button_pressed() -> void:
|
|
||||||
print(\"Start Button Clicked\")
|
|
||||||
|
|
||||||
func _on_credits_button_pressed() -> void:
|
|
||||||
print(\"Credits Button Clicked\")
|
|
||||||
|
|
||||||
func _on_quit_button_pressed() -> void:
|
|
||||||
$VBoxContainer/Label.text += \"\\nBye!\"
|
|
||||||
await get_tree().create_timer(1).timeout
|
|
||||||
get_tree().quit()
|
|
||||||
"
|
|
||||||
|
|
||||||
[node name="MainMenu" type="MarginContainer"]
|
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="."]
|
|
||||||
visible = false
|
|
||||||
layout_mode = 2
|
|
||||||
color = Color(0, 0, 0, 1)
|
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="."]
|
|
||||||
layout_mode = 2
|
|
||||||
script = SubResource("GDScript_0d3dd")
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control"]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_right = 40.0
|
|
||||||
offset_bottom = 40.0
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="Control/VBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_colors/font_color = Color(0, 1, 0, 1)
|
|
||||||
theme_override_fonts/font = ExtResource("1_4eeva")
|
|
||||||
|
|
||||||
[node name="VBoxContainer2" type="VBoxContainer" parent="Control/VBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="Control/VBoxContainer/VBoxContainer2"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer2/HBoxContainer"]
|
|
||||||
custom_minimum_size = Vector2(8, 0)
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_fonts/font = ExtResource("1_4eeva")
|
|
||||||
text = ">"
|
|
||||||
|
|
||||||
[node name="start" type="Button" parent="Control/VBoxContainer/VBoxContainer2/HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_fonts/font = ExtResource("1_4eeva")
|
|
||||||
text = "start"
|
|
||||||
|
|
||||||
[node name="HBoxContainer2" type="HBoxContainer" parent="Control/VBoxContainer/VBoxContainer2"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer2/HBoxContainer2"]
|
|
||||||
custom_minimum_size = Vector2(8, 0)
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_fonts/font = ExtResource("1_4eeva")
|
|
||||||
text = ">"
|
|
||||||
|
|
||||||
[node name="credits" type="Button" parent="Control/VBoxContainer/VBoxContainer2/HBoxContainer2"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_fonts/font = ExtResource("1_4eeva")
|
|
||||||
text = "credits"
|
|
||||||
|
|
||||||
[node name="HBoxContainer3" type="HBoxContainer" parent="Control/VBoxContainer/VBoxContainer2"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer2/HBoxContainer3"]
|
|
||||||
custom_minimum_size = Vector2(8, 0)
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_fonts/font = ExtResource("1_4eeva")
|
|
||||||
text = ">"
|
|
||||||
|
|
||||||
[node name="quit" type="Button" parent="Control/VBoxContainer/VBoxContainer2/HBoxContainer3"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_fonts/font = ExtResource("1_4eeva")
|
|
||||||
text = "quit"
|
|
||||||
|
|
||||||
[connection signal="pressed" from="Control/VBoxContainer/VBoxContainer2/HBoxContainer/start" to="Control" method="_on_start_button_pressed"]
|
|
||||||
[connection signal="pressed" from="Control/VBoxContainer/VBoxContainer2/HBoxContainer2/credits" to="Control" method="_on_credits_button_pressed"]
|
|
||||||
[connection signal="pressed" from="Control/VBoxContainer/VBoxContainer2/HBoxContainer3/quit" to="Control" method="_on_quit_button_pressed"]
|
|
|
@ -11,7 +11,7 @@ config_version=5
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="GMTK_2024"
|
config/name="GMTK_2024"
|
||||||
run/main_scene="res://menu/main_menu/main_menu.tscn"
|
run/main_scene="res://menu/main_menu/MainMenu.tscn"
|
||||||
config/features=PackedStringArray("4.3", "GL Compatibility")
|
config/features=PackedStringArray("4.3", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue