Weird black bars inside of window when resizing dynamically
Asked Answered
S

12

0

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.

(Ideal solution)

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.

Thanks so much

Svelte answered 16/3 at 1:52 Comment(0)
L
0

Svelte Since the post with pictures doesn't go through, I'll try to explain in words. Which is difficult since I use a translator.

These stripes are artifacts from the stripes when the window is expanded to the full width of the screen. Sometimes, by switching modes you can achieve that they would not be there. IMO this should not be the case and you can open a issue.

Latrinalatrine answered 17/3 at 12:1 Comment(0)
S
0

Svelte I've spent a few hours debugging this to the best of my ability, and I'm not convinced this isn't an engine issue. If anyone could give this a second look I'd really appreciate it, since I think I'm going to have to scrap this if I can't get it working.

Svelte answered 16/3 at 19:18 Comment(0)
L
0

Svelte If anyone could give this a second look

Well, I got the game running, but immediately gave a bunch of errors.

So I can't test it. 🙁

Latrinalatrine answered 16/3 at 20:3 Comment(0)
S
0

Latrinalatrine Hi,
I'm sorry, I scraped a bunch of files out of it to minimize the file size and so unnecessary code isn't there, but it seems I removed some stuff. I updated the zip on Google Drive, it should be all set now. (The actual game itself isn't in there, however the main menu and the settings inside it are all that's needed to test the border.)

I will also note that I wasn't going to update the handlers for the mouse cursor until I finished the menus, so that's not done yet. The default controls are arrow keys up and down to select and z to confirm, x to go back.

Thanks so much for being willing to help me out!

Svelte answered 16/3 at 20:20 Comment(0)
L
0

Svelte I updated the zip on Google Drive, it should be all set now.

The news is probably both good and bad at once — the bug is not confirmed — not reproducible. The game enters full screen mode normally and exits it the same way.

What OS and video card do you have?

Latrinalatrine answered 16/3 at 20:41 Comment(0)
S
0

Latrinalatrine I'm on Windows 10 with a Nvidia GTX 1060. There doesn't seem to be any issues like artifacting on it.

And just to be sure: Did you switch to and from the integer scaling setting for stretching? It does work normally unless the settings are changed.

The exact changes I do from startup are: Fullscreen off -> on -> off (Should be normal), Integer scaling Better Looking -> Bigger screen, Fullscreen off -> on -> off (Should work as a normal fullscreen mode), then finally Integer scaling Bigger Screen -> Better Looking, then changing the fullscreen setting from here causes problems.

Svelte answered 16/3 at 20:46 Comment(0)
L
0

Well, I think I've found it. I'll add more soon.

Latrinalatrine answered 16/3 at 20:48 Comment(0)
S
0

Latrinalatrine Thanks so much!

Svelte answered 16/3 at 20:49 Comment(0)
L
0

Svelte I only found the error, and what to do with it is not very clear.

Anyway, the "Better Looking" window is expanded to the whole screen and is "normal". That is, the stripes on the edges of the screen when the window is maximized remain when it is reduced to its normal (native) size.

Well, I think it should not be like that. Perhaps it makes sense to open the problem.

Latrinalatrine answered 16/3 at 21:0 Comment(0)
L
0

They sometimes check my posts here ("Awaiting approval"), apparently not trusting me very much. I hope my reply will be visible soon.

Latrinalatrine answered 16/3 at 21:2 Comment(0)
L
0

Svelte Since the post with pictures doesn't go through, I'll try to explain in words. Which is difficult since I use a translator.

These stripes are artifacts from the stripes when the window is expanded to the full width of the screen. Sometimes, by switching modes you can achieve that they would not be there. IMO this should not be the case and you can open a issue.

Latrinalatrine answered 17/3 at 12:1 Comment(0)
M
0

Latrinalatrine Sorry about this.. It's the auto spam tools that sometimes flag false positives.

Metastasize answered 17/3 at 13:12 Comment(0)
S
0

Latrinalatrine Hi,
Thanks so much for verifying this. That was exactly what I thought it was, and I'm glad you were able to confirm it.

Hope if I make an issue that it'll actually be picked up. I think people have largely moved on to Godot 4, so I hope people are still looking at issues for 3.5.

Thanks again!

Svelte answered 17/3 at 13:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.