I am trying to implement a fullscreen button function and I want it to check if the game is windowed or in fullscreen.
I dont know what function does that.
Here is my attempt:
if Input.is_action_just_pressed("fullscreen") and DisplayServer.WINDOW_MODE_WINDOWED:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
elif Input.is_action_just_pressed("fullscreen") and DisplayServer.WINDOW_MODE_FULLSCREEN:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
I have made a solution by making a variable (var = is_fullscreen) to work around the problem, but then I saw your answer and decided to change the code and it still works:
if Input.is_action_just_pressed("fullscreen") and DisplayServer.window_get_mode() == 0:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
elif Input.is_action_just_pressed("fullscreen") and DisplayServer.window_get_mode() == 3:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)