tli/scripts/globals/fullscreen_manager.gd

21 lines
463 B
GDScript

extends Node
var is_fullscreen: bool = false
func _ready() -> void:
process_mode = Node.PROCESS_MODE_ALWAYS
func _input(event: InputEvent) -> void:
if event.is_action_pressed("toggle_fullscreen"):
_toggle_fullscreen()
func _toggle_fullscreen() -> void:
is_fullscreen = not is_fullscreen
if is_fullscreen:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)