generated from krampus/template-godot4
38 lines
634 B
GDScript3
38 lines
634 B
GDScript3
|
extends Control
|
||
|
## Menu shown in-game when the user presses pause.
|
||
|
|
||
|
@onready var menu_list: VBoxContainer = %MenuList
|
||
|
|
||
|
|
||
|
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:
|
||
|
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
|