2024-11-19 15:44:47 -07:00
|
|
|
extends Control
|
|
|
|
## Menu shown in-game when the user presses pause.
|
|
|
|
|
|
|
|
@onready var menu_list: VBoxContainer = %MenuList
|
2024-11-19 15:51:42 -07:00
|
|
|
@onready var quit_confirm: CenterContainer = %QuitConfirm
|
2024-11-19 15:44:47 -07:00
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
|
|
|
|
|
|
|
|
|
|
|
func _exit_tree() -> void:
|
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
|
|
|
|
|
|
|
|
|
|
func _unhandled_key_input(event: InputEvent) -> void:
|
|
|
|
if event.is_action_pressed("pause"):
|
|
|
|
resume()
|
|
|
|
|
|
|
|
|
|
|
|
func _unhide() -> void:
|
|
|
|
menu_list.show()
|
|
|
|
|
|
|
|
|
|
|
|
func _hide() -> void:
|
|
|
|
menu_list.hide()
|
|
|
|
|
|
|
|
|
|
|
|
func resume() -> void:
|
|
|
|
queue_free()
|
|
|
|
|
|
|
|
|
|
|
|
func settings() -> void:
|
|
|
|
pass # TODO
|
|
|
|
|
|
|
|
|
|
|
|
func quit() -> void:
|
2024-11-19 15:51:42 -07:00
|
|
|
quit_confirm.show()
|
|
|
|
|
|
|
|
|
|
|
|
func cancel_quit() -> void:
|
|
|
|
quit_confirm.hide()
|
|
|
|
|
|
|
|
|
|
|
|
func confirm_quit() -> void:
|
2024-11-19 15:44:47 -07:00
|
|
|
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
|