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.
if (window_get_minimized() == false && (global.window_width != window_get_width() || global.window_height != window_get_height())){ alarm[0] = 1; } And in alarm:
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.
|