Legacy GM Why does my sprite squash when I change the view

Rivo

7014
This might be somewhat of a noob question, but i have kinda left views and ports a little late since i find it dreadfully boring sometimes.

Basically my view height and width is (w = 832 h = 639) - which squishes the player
What seems to work though is (w = 832 h = 477) - this doesn't

I keep to the aspect ratio in both of them - 16:9. Yet my first attempt squishes my sprite? Can someone plz explain? im lost. :( I literally just learned about aspect ratio too :p

Also, what if someone is using a 21:9 monitor when playing my game? :O will the sprite just stretch outwards?
 

jo-thijs

Member
And what are the dimensions of the port?

If you stretch the view, but not the port, more has to be drawn on less,
so things are squished together.

How different monitors react to it is decided in the global game settings.
 

Rivo

7014
Ive set the port to the same as my monitor -
Code:
// get display w/h
screen_width = display_get_width();
screen_height = display_get_height();

// port
view_wport[0] = screen_width;
view_hport[0] = screen_height;
My monitor is a 16:9 monitor (1920x1080)
So it must be the same aspect ratio since both of the dimensions i used where a multiple of 16 and 9, right? So what is in the global game settings that i should be concerned about.
 

jo-thijs

Member
h = 477 is much closer to that ratio than h = 639.
Just try: (w / h) / (16 / 9)
If this is close to 1, you'll have a better aspect ratio.

The aspect ratio is defined by 16 / 9, it has nothing to do with what your views need to be a multiple of.
The ratio of 1920x1080 (or also 1920:1080) is 16:9, because 1920/1080 = 16/9 and you can't simplify 16/9 further.
 

Rivo

7014
What if someone is using a 21:9 monitor? will this affect and stretch my sprite outwards because the width is further away from the aspect ratio?
 

jo-thijs

Member
As I already said, it depends on what you choose in the global game settings.
Go to the windows tab and then to the graphics tab.
You can set the port to stretch to match the screen or you can keep the aspect ratio,
which will keep the w:h ratio of the ports.
 

RangerX

Member
16/9 = 1,7 (any resolution where width divided by height = 1,7 its a 16:9 screen ratio)
21/9 = 2,3 (any resolution where width divided by height = 2,3 its a 21:9 screen ratio) ---- which is an extremely uncommon ratio you might not want to care about.

For you game to always appear right (or for most people) without efforts, is the have your view and port the same size and put the global settings to "keep aspect ratio". This way your game will NEVER stretch. It might not be "pixel perfect" at certain sizes though. If you want to achieve that its a tad more complex... and guess what? I have a tutorial for you if ever it becomes pertinent:

https://forum.yoyogames.com/index.php?threads/how-to-properly-scale-your-game.995/

:)
 
Top