• 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!

Zooming with perfect w/h

L

Latch

Guest
I'm trying to zoom in so that the w and h retain their ratio. The room is 1920x1080 with the view in room half of that (960x540 respectively).

But I'm having real trouble figuring out how to keep the ratios the same so it zooms flawlessly.

As I am just testing this out I set the target values to be 460x270, the rooms size /4. I thought it would be simpler that way as it is keeping the math the same (halving) but as you may know, it doesn't work that way.

If for example I write:

if view_wview[0] != 480{
view_wview[0] --;
view_hview[0] --;}

That wont work as wview has 480 to subtract whereas hview has only 270, meaning that hview will become skewed. However, if I stop hview by going past this and gating it with a check that it doesn't go below 270, the view will be distorted and then rest at the aspect ratio I want when wview has reached it's value.

I have no idea how to solve this, anyone know what I need to do?
 
Top