• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED Changing Viewport width and height does nothing

M

Michael_

Guest
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