Godot Version
v3.5.3.stable.official [6c814135b]
Question
Hi,
I’m rather close to being done with my game (Will release in August), and I’m going back to a feature I scrapped for a demo for an event.
You see, my pixel art game is at a strange resolution (800x600), which was what I felt at a time a good fit for the larger sprites in the game, however this makes things like fullscreen a bit tricky with scaling.
My solution was to render the entire game within a viewport, and for the most part it’s working. The window could be scaled pixel perfect, with a nice border to complement different parts of the game. My solution also allows for a seamless switch between windowed and maximized modes, where the border will display no matter the resolution.
I also wanted this to be able to be disabled, with a raw, resized image for if people want a bigger image.
However, I’m having issues when changing the resolution in my options menu, and I’m not 100% sure it’s my code. Basically, it starts in integer scaling mode, and fullscreen works fine. Switching to integer scaling again however causes some issues, because if fullscreen is pressed one more time, there’s giant black bars in fullscreen mode, even though the window is changed to the resolution of the monitor. I have verified that internally it is set to a 1440p resolution (My monitor’s resolution), as I am printing out OS.window_size.
Going out of fullscreen mode reveals an uglier sight: The black bars carry over into windowed mode, and only part of the screen is visible. They’re not nodes, and all of the nodes seem to be the correct sizes (The parent node, the viewport node, the viewport, and the scene all seem to be the correct sizes in the inspector at runtime.)
I’m entirely unsure why this is happening. It’s been a few months since I’ve even touched this code, and I remember something like this is why I stopped.
I wrote the code myself, and admittedly I should have written comments as it’s all pretty complicated.
I’ve included a file with some sample source code if anyone is able to help. Thanks so much if you’re able to figure out what it is. The issue is weird enough that I’m curious if it’s an engine bug.