add fullscreen and quitting managers

This commit is contained in:
Teatov 2024-10-05 19:40:28 +10:00
parent 174e28d2c2
commit e59b67bd14
3 changed files with 35 additions and 0 deletions

View File

@ -21,6 +21,8 @@ config/icon="res://icon.svg"
[autoload]
CursorManager="*res://scripts/globals/cursor_manager.gd"
FullscreenManager="*res://scripts/globals/fullscreen_manager.gd"
QuittingManager="*res://scripts/globals/quitting_manager.gd"
[debug]
@ -44,3 +46,17 @@ mouse_cursor/custom_image_hotspot=Vector2(32, 32)
import/fbx2gltf/enabled=false
import/blender/enabled=false
[input]
menu={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
toggle_fullscreen={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194342,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":true,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}

View File

@ -0,0 +1,14 @@
extends Node
var is_fullscreen: bool = false
func _input(event: InputEvent) -> void:
if event.is_action_pressed("toggle_fullscreen"):
toggle_fullscreen()
func toggle_fullscreen() -> void:
is_fullscreen = !is_fullscreen
if is_fullscreen:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)

View File

@ -0,0 +1,5 @@
extends Node
func _input(event: InputEvent) -> void:
if event.is_action_pressed("menu"):
get_tree().quit()