SOLVED Changing Viewport width and height does nothing

Michael_

Member
So I'm trying to make my game fullscreen dynamically, Changing the width and height of the camera works but changing any information of the viewport doesn't do anything at all.

GML:
//changing viewport information, not working
view_enabled = true;
view_visible[0] = true;
view_wport[0] = display_get_width();
view_hport[0] = display_get_height();
//changing camera information, working
camera_set_view_size(view_camera[0], display_get_width(), display_get_height())
 
I had your problem before. view_wport[0] and view_hport[0] are read only variables and cannot be changed. They are setup during game start and you cannot change them anymore.

What you can do is change the application surface size and the GUI size to match the current size of your windows/fullscreen
GML:
surface_resize(application_surface,display_get_width(), display_get_height());
display_set_gui_size(display_get_width(), display_get_height());
I think GMS2 automatically sets the display GUI size at fullscreen but it doesnt for the application surface.
 
Top