class_name MainMenu
extends Control


@onready var start_button: Button = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Button
@onready var settings_button: Button = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Button2
@onready var exit_button: Button = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Button3
@onready var settings_menu: Control = $Settings_Menu
@onready var margin_container: MarginContainer = $MarginContainer


@onready var start_level = preload("res://Main_menu/main_menu.tscn") as PackedScene

func _ready():
	hanlde_signal_connections()

func on_start_pressed()-> void:
	print("scene changed!")
	get_tree().change_scene_to_packed(start_level)

func on_settings_pressed()->void:
	margin_container.visible = false
	settings_menu.set_process(true)
	settings_menu.visible = true

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

func exited_settings() -> void:
	margin_container.visible = true
	settings_menu.visible = false
	

	
func hanlde_signal_connections() ->void:
	start_button.button_down.connect(on_start_pressed)
	settings_button.button_down.connect(on_settings_pressed)
	exit_button.button_down.connect(exited_game)
	settings_menu.exit_options_menu.connect(exited_settings)
