GMS 2 [SOLVED] View Port stuck

TheMegax

Member
I have a code that changes the camera view so it's able to see the whole room, but it seems that the port is perpetually stuck at width 1280 and height 720. Those numbers don't even show up anywhere in my code.
Am I missing something here?

oCamera Create
Code:
/// @description Set Camera
zoom_level = 1;

//For detecting mouse movement
mouse_x_orig = 0;
mouse_y_orig = 0;

//Get GCF and aspect ratio
var dh = display_get_height();
var dw = display_get_width();
var gcf = scr_get_GCF(dh, dw);
var ratio_a = dh/gcf;
var ratio_b = dw/gcf;

//Set port size
view_set_wport(0, dw);
view_set_hport(0, dh);

//Change view size
if(room_height >= room_width)
{
    default_zoom_height = room_height + 100;
    default_zoom_width = default_zoom_height * (ratio_b/ratio_a);
}
else
{
    default_zoom_width = room_width + 100;
    default_zoom_height = default_zoom_width * (ratio_a/ratio_b);
}
camera_set_view_size(view_camera[0], default_zoom_width, default_zoom_height);
camera_set_view_pos(view_camera[0], room_width/2 - default_zoom_width/2, room_height/2 - default_zoom_height/2);
 

TheMegax

Member
Ok, I found out. For some reason it took the first loaded room width and height and set it as the port, I think.
I dunno why.
 
Top