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
The guide writes this code for full scaling:
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.
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
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]);
I hope i've explained sufficiently well, i just can't understand very well how this code works.