extends Node3D

func _ready():
	# initialize with capture mouse mode
	Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
	Engine.max_fps = 60

func _unhandled_input(event):
	if event.is_action_released("toggle_fullscreen"):
		toggle_fullscreen()


func toggle_fullscreen() -> void:
	if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN or \
		DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
		DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
		DisplayServer.window_set_size(Vector2(1280, 720))
	else:
		DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)
