• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Some help with scaling/sprite stretching

R

Rosieu

Guest
Hi again everyone!

I was wondering if anyone had any advice for how to 'scale' up a game's display (i.e make its port on a window/desktop bigger than the room itself) without the sprites stretching.

I've tried doing it using views, using the window_set_size() function, and a couple of others, however my sprites always seems to get stretched, and lose their clarity. I should stress that I'm using power of 2 sprites (they're 64x64), so to my brain they should scale quite nicely.

I'd like to avoid simply scaling everything up in the 'sprites' and such, because I'm trying to keep the game authentically low-resolution.

Any help is greatly appreciated!
 
P

pieterator

Guest
Making a sprite power of 2 doesn't make it scale any different from a sprite that isn't. Power of 2 mostly only comes into play when you put sprites on their own texture pages for use in 3D.

In order to keep the pixel size 1 to 1 regardless of the screen resolution, you would need to get the size of the game window, and then set the camera view and port's size to match it. You will also need to set up view 0 for use in each room.

So something like this:
Code:
//Room creation code
var camera = view_camera[0];
var window_width = window_get_width();
var window_height = window_get_height();

view_set_wport(0, window_width);
view_set_hport(0, window_height);
camera_set_view_size(camera, window_width, window_height);
Another thing you could do is pick a resolution that neatly scales up to the most common screen resolutions (like 1080p and 720p) pixel perfectly.
Good candidates are:
640x360
320x180
160x90
 
Top