extends Control

const DEMO_SCENE := "res://scenes/demo.tscn"
const CONFIG_SCENE := "res://scenes/config.tscn"
const PONG_SCENE := "res://scenes/pong.tscn"
const COLOR_GAME_SCENE := "res://scenes/color_game.tscn"
const SPACE_SHOOTER_SCENE := "res://scenes/space_shooter.tscn"

@onready var demo_button: Button = $CenterBox/DemoButton
@onready var config_button: Button = $CenterBox/ConfigButton
@onready var pong_button: Button = $CenterBox/PongButton
@onready var color_game_button: Button = $CenterBox/ColorGameButton
@onready var space_shooter_button: Button = $CenterBox/SpaceShooterButton
@onready var exit_button: Button = $CenterBox/ExitButton


func _ready() -> void:
	demo_button.pressed.connect(func(): _open_scene(DEMO_SCENE))
	config_button.pressed.connect(func(): _open_scene(CONFIG_SCENE))
	pong_button.pressed.connect(func(): _open_scene(PONG_SCENE))
	color_game_button.pressed.connect(func(): _open_scene(COLOR_GAME_SCENE))
	space_shooter_button.pressed.connect(func(): _open_scene(SPACE_SHOOTER_SCENE))
	exit_button.pressed.connect(_exit_game)


func _open_scene(path: String) -> void:
	get_tree().change_scene_to_file(path)


func _exit_game() -> void:
	get_tree().quit()
