init game files
This commit is contained in:
94
scripts/ui/MainMenu.gd
Normal file
94
scripts/ui/MainMenu.gd
Normal file
@@ -0,0 +1,94 @@
|
||||
class_name MainMenu
|
||||
extends CanvasLayer
|
||||
|
||||
## MainMenu - Main menu screen
|
||||
|
||||
signal start_game
|
||||
signal quit_game
|
||||
|
||||
# UI Components
|
||||
var title_label: Label
|
||||
var start_button: Button
|
||||
var options_button: Button
|
||||
var quit_button: Button
|
||||
var version_label: Label
|
||||
|
||||
func _ready() -> void:
|
||||
_create_menu()
|
||||
|
||||
func _create_menu() -> void:
|
||||
# Background
|
||||
var bg = ColorRect.new()
|
||||
add_child(bg)
|
||||
bg.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
bg.color = Color(0.08, 0.08, 0.12)
|
||||
|
||||
# Center container
|
||||
var center = CenterContainer.new()
|
||||
add_child(center)
|
||||
center.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
|
||||
var vbox = VBoxContainer.new()
|
||||
center.add_child(vbox)
|
||||
vbox.add_theme_constant_override("separation", 20)
|
||||
|
||||
# Title
|
||||
title_label = Label.new()
|
||||
title_label.text = "FF-TCG Digital"
|
||||
title_label.add_theme_font_size_override("font_size", 48)
|
||||
title_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
vbox.add_child(title_label)
|
||||
|
||||
# Subtitle
|
||||
var subtitle = Label.new()
|
||||
subtitle.text = "Final Fantasy Trading Card Game"
|
||||
subtitle.add_theme_font_size_override("font_size", 18)
|
||||
subtitle.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
subtitle.add_theme_color_override("font_color", Color(0.6, 0.6, 0.7))
|
||||
vbox.add_child(subtitle)
|
||||
|
||||
# Spacer
|
||||
var spacer = Control.new()
|
||||
spacer.custom_minimum_size = Vector2(0, 40)
|
||||
vbox.add_child(spacer)
|
||||
|
||||
# Start button
|
||||
start_button = _create_menu_button("Start Game")
|
||||
vbox.add_child(start_button)
|
||||
start_button.pressed.connect(_on_start_pressed)
|
||||
|
||||
# Options button (placeholder)
|
||||
options_button = _create_menu_button("Options")
|
||||
options_button.disabled = true
|
||||
vbox.add_child(options_button)
|
||||
|
||||
# Quit button
|
||||
quit_button = _create_menu_button("Quit")
|
||||
vbox.add_child(quit_button)
|
||||
quit_button.pressed.connect(_on_quit_pressed)
|
||||
|
||||
# Version label at bottom
|
||||
version_label = Label.new()
|
||||
version_label.text = "v0.1.0 - Development Build"
|
||||
version_label.add_theme_font_size_override("font_size", 12)
|
||||
version_label.add_theme_color_override("font_color", Color(0.4, 0.4, 0.5))
|
||||
add_child(version_label)
|
||||
version_label.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
version_label.offset_left = -200
|
||||
version_label.offset_top = -30
|
||||
version_label.offset_right = -10
|
||||
version_label.offset_bottom = -10
|
||||
|
||||
func _create_menu_button(text: String) -> Button:
|
||||
var button = Button.new()
|
||||
button.text = text
|
||||
button.custom_minimum_size = Vector2(200, 50)
|
||||
button.add_theme_font_size_override("font_size", 20)
|
||||
return button
|
||||
|
||||
func _on_start_pressed() -> void:
|
||||
start_game.emit()
|
||||
|
||||
func _on_quit_pressed() -> void:
|
||||
quit_game.emit()
|
||||
get_tree().quit()
|
||||
Reference in New Issue
Block a user