47 lines
1.7 KiB
GDScript
47 lines
1.7 KiB
GDScript
extends Control
|
|
|
|
@onready var grid: GridContainer = $Columns
|
|
|
|
signal main_menu
|
|
|
|
const CREDIT_LABELS_LINKS := {
|
|
"Godot Engine" : ["Godot Team : godotengine.org", "https://godotengine.org"],
|
|
"Ship and Enemies" : ["bart : opengameart.org", "https://opengameart.org/content/i-are-spaceship-16x16-space-sprites"],
|
|
"Starry Background" : ["Kutejnikov : opengameart.org", "https://opengameart.org/content/space-9"],
|
|
"Laser Sound" : ["dklon : opengameart.org", "https://opengameart.org/content/laser-fire"],
|
|
"Explosion Sounds" : ["TeamAlpha : opengameart.org", "https://opengameart.org/content/8-bitnes-explosion-sound-effecs"],
|
|
"Extra Life Jingle" : ["Mrthenoronha : freesound.org", "https://freesound.org/people/Mrthenoronha/sounds/518306/"]
|
|
}
|
|
|
|
const LEFT_COL_WIDTH := 350
|
|
const RIGHT_COL_WIDTH := 350
|
|
|
|
func _ready() -> void:
|
|
$Back.pressed.connect(_emit_back)
|
|
|
|
# center the grid
|
|
grid.anchor_left = 0.5
|
|
grid.anchor_right = 0.5
|
|
grid.offset_left = int(-(LEFT_COL_WIDTH + RIGHT_COL_WIDTH) / 2.0)
|
|
grid.offset_right = int((LEFT_COL_WIDTH + RIGHT_COL_WIDTH) / 2.0)
|
|
|
|
for btn_name in CREDIT_LABELS_LINKS.keys():
|
|
var display_text = CREDIT_LABELS_LINKS[btn_name][0]
|
|
var link: String = CREDIT_LABELS_LINKS[btn_name][1]
|
|
|
|
var label = Label.new()
|
|
label.text = btn_name
|
|
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
|
label.custom_minimum_size.x = LEFT_COL_WIDTH
|
|
grid.add_child(label)
|
|
|
|
var button = Button.new()
|
|
button.text = display_text
|
|
button.focus_mode = Control.FOCUS_NONE
|
|
button.custom_minimum_size.x = RIGHT_COL_WIDTH
|
|
var link_local := link
|
|
button.pressed.connect(func(): OS.shell_open(link_local))
|
|
grid.add_child(button)
|
|
|
|
func _emit_back():
|
|
emit_signal("main_menu")
|