• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code So how to change aspect ratio or display size generally


Hey all,

This one's bugging me. I want to have an option for the player to change between 16/9 aspect ratio and 4/3... I've seen a guide suggesting using the command display_set_gui_size(w, h) but that didn't work at all...

Here is the code I have that appears for a persistent object at the event "room start":

var base_h = 768;
var max_w = display_get_width();
var max_h = display_get_height();
var aspect = display_get_width() / display_get_height();

global.VIEW_HEIGHT = min(base_h, max_h);
global.VIEW_WIDTH = global.VIEW_HEIGHT * aspect;

camera_set_view_size(view_camera[0], floor(global.VIEW_WIDTH), floor(global.VIEW_HEIGHT))
view_wport[0] = max_w;
view_hport[0] = max_h;
surface_resize(application_surface, view_wport[0], view_hport[0]);


Edit: added pictures in a reply to show what I mean.

Thanks to any who can help!
Last edited: