HELP!! I need help figuring out how to make a toggle for fullscreen and windowed.
I have tried YouTube, Google, and chat-GPT. (The project defaults to fullscreen) Here’s the code
“”
extends Node
var screen = true
func _process(_delta):
if screen == true:
DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_FULLSCREEN, 0)
if Input.is_action_just_pressed("fullscreen"):
screen = false
else:
DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_WINDOWED, 0)
if Input.is_action_just_pressed("fullscreen"):
screen = true
“”
(and yes I have gone to settings and turned on globals for the script)
Hello @gertkeno, I saw your response and tried the code you placed. It worked, but the code does not work with fullscreen as the default. (Which is the problem.) Here’s the error that Godot says.
‘’’
E 0:00:03:0624 affine_invert: Condition “det == 0” is true.
<C++ Source> core/math/transform_2d.cpp:51 @ affine_invert()
‘’’
When the game starts in fullscreen the first time pressing f11 it does nothing the second time it crashes the window(but not the game). And gives the same error.