Pages: 1
  Print  
Author Topic: Scaling and Resizing  (Read 14366 times)
Offline (Unknown gender) JakroTintreach
Posted on: April 10, 2015, 11:18:00 pm
Member
Joined: Jun 2013
Posts: 15

View Profile
Does Enigma/LateralGM have a built in way of allowing the game window to be resized and rescaled? I have messed around with some of the game options but my results have always been a fixed size window. Is this a bug on my end or a non-existent feature?
Logged
Offline (Unknown gender) TheExDeus
Reply #1 Posted on: April 11, 2015, 03:50:11 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
In Game Settings you will see "Scaling" - which will tell you if the aspect ratio is kept or not. And below it there is a checkbox "Allow the player to resize the window".

This will only partly do what you want, because if you want the "View" in the room to also be resized, then you must do a check for it in game and do the resize. This is required because the OpenGL viewport must be resized too.

The way I do it is this. In step we check when the window has changed size (this is after the user stopped dragging, as the window is frozen when the user drags). global.window_width and global.window_height is window width and height got in the create event.
Code: [Select]
if (window_get_minimized() == false && (global.window_width != window_get_width() || global.window_height != window_get_height())){
alarm[0] = 1;
}

And in alarm:
Code: [Select]
if (window_get_minimized() == false){
global.window_width = window_get_width();
global.window_height = window_get_height();
view_wview[0] = global.window_width;
view_hview[0] = global.window_height;

view_wport[0] = global.window_width;
view_hport[0] = global.window_height;

window_default(true);
screen_init();
}
This sets the view width and height, as well as port's width and height. window_default(true) must be called so the internal variables are updated, but it's more of a nasty trick than anything else. I think we should add a special function for this. screen_init() also updates the internal stuff needed.

I hope this answers your question.
Logged
Pages: 1
  Print