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

View scaling for all devices

D

Drago Supremo

Guest
Hi guys,
i've recently read this guide (https://www.yoyogames.com/blog/66/scaling-for-devices-part-2-the-game-view) to scale my game view for evert device.

However, i'm still pretty confused under many aspects :bash:

The guide writes this code for full scaling:
Code:
var base_w = 1024;
var base_h = 768;
var max_w = display_get_width();
var max_h = display_get_height();
var aspect = display_get_width() / display_get_height();
if (max_w < max_h)
    {
    // portait
    var VIEW_WIDTH = min(base_w, max_w);
    var VIEW_HEIGHT = VIEW_WIDTH / aspect;
    }
else
    {
    // landscape
    var VIEW_HEIGHT = min(base_h, max_h);
    var VIEW_WIDTH = VIEW_HEIGHT * aspect;
    }

view_wview[0] = floor(VIEW_WIDTH);
view_hview[0] = floor(VIEW_HEIGHT);
view_wport[0] = max_w;
view_hport[0] = max_h;

surface_resize(application_surface, view_wview[0], view_hview[0]);
But why does it resize the application suface? I' ve tried it but i can't see any change of size in the game surface, it just fills the game window (with the correct aspect ratio since the view is based on it). And in addition to that why changing the view port? I thought you couldn't change the view port after the start of the game.

I hope i've explained sufficiently well, i just can't understand very well how this code works.:bash:
 
S

Spencer S

Guest
Camera's are the one single thing in GMS that I can't seem to wrap my head around. I'll be watching this thread. I'm interested in the answer as well.
 
D

Drago Supremo

Guest
Camera's are the one single thing in GMS that I can't seem to wrap my head around. I'll be watching this thread. I'm interested in the answer as well.
Thanks god i'm not the only one confused there! I hope someone knows a solution because Game Maker's logic about this really drives me crazy.
 
Top