SOLVED Fullscreen scaling; window_set_fullscreen causes pixels to appear in different sizes

Owly

Member
Hello,

In my game the room size is 1024x768 and the background sprites are usually 256x192 images that are scaled up 4 times to fill the room. I have a code to scale the window properly when playing in window mode, and it does indeed work well.

However to go to fullscreen mode I'm using the command window_set_fullscreen(true). My native windows display resolution is 1920x1080. What happens then is that the sprite, the background one for example, is not scaled properly; some pixels are bigger than others, for some reason, instead of being the same size (pic 1 shows the game in fullscreen, pic 2 zooms on a bunch of pixels to show they are not the same size, some are wider, or longer).

I've tried using the surface_resize function as I've read on a guide, but I'm still getting pixels in different sizes in fullscreen mode.

What I'd like to do is be able to switch to fullscreen mode, with the pixels all being in the same size, and keeping the native aspect ratio of 1.33 (1024/768), so for example when playing fullscreen the playable screen should be scaled up to 1280x960 if the windows display resolution is 1920x1080, and not to 1440x1080 as it seems to be doing right now when using window_set_fullscreen(true).

Thanks!
 

Attachments

curato

Member
really you need a higher resolution background if you going to stretch it like that. Honestly I would make the background the room size then it doesn't have far to stretch and will look a bunch better resized.
 

Owly

Member
really you need a higher resolution background if you going to stretch it like that. Honestly I would make the background the room size then it doesn't have far to stretch and will look a bunch better resized.
Hey! So it's not a coding problem? It's just to do with the size of the background image?
 

curato

Member
yeah I think so. I think you are just stretching that background so much it looks bad. Just find any 1024x768 image and use it for the background doesn't matter if it goes with the game and try it and see if the quality is there when you change resolutions.
 

Roldy

Member
I would guess you are going to have this problem unless you make the BG image the same aspect as the fullscreen resolution.

Or even better, guarantee that the dimensions divide evenly into each other. e.g. The height of your BG image 192 cannot divide evenly into 1080. Depending on the sample technique it is going to have to make some pixels smaller or taller than others. But if the BG image was 180 pixels high then it can scale 6 times and fit evenly into 1080. For the width 240 will go evenly into both 1920 and 1440.

So a BG image of 240x180 would probably look pretty good, which is also aspect 1.33.


Otherwise just make the BG image higher resolution and you won't notice the distortion as much.
 
Last edited:

Owly

Member
I would guess you are going to have this problem unless you make the BG image the same aspect as the fullscreen resolution.

Or even better, guarantee that the dimensions divide evenly into each other. e.g. The height of your BG image 192 cannot divide evenly into 1080. Depending on the sample technique it is going to have to make some pixels smaller or taller than others. But if the BG image was 180 pixels high then it can scale 6 times and fit evenly into 1080. For the width 240 will go evenly into both 1920 and 1440.

So a BG image of 240x180 would probably look pretty good, which is also aspect 1.33.


Otherwise just make the BG image higher resolution and you won't notice the distortion as much.
"So a BG image of 240x180 would probably look pretty good, which is also aspect 1.33."

That sounds like a good solution to experiment with. Thanks, both of you!
 
Top