Camera and Aspect Ratio Issues When in Full Screen

C

Cakelets

Guest
In my game, I want my camera to follow around the player character. It successfully follows the character, but I'm having issues having the aspect ratio stay correct now that I've made it into full screen. My code is included below. Also, after attempting to fix the values, my window is now chopped off at the top and stuck
Code:
/// create camera

cam = view_camera[0];
follow = oplayer;
view_w_half = camera_get_view_width(cam) * 0.5;
view_h_half = camera_get_view_height (cam) * 0.5;
xTo = xstart;
yTo = ystart;
//fullscreen
windowHeight = 1920;
windowWidth = 1080;
window_set_size(windowWidth, windowHeight);
//monitor
monitorWidth  = display_get_width();
monitorHeight = display_get_height();
window_set_position(monitorWidth/2 - windowWidth/2 , monitorHeight/2 - windowHeight/2);
in the center of my screen. I reverted my changes, and it's still doing that.

I'm not sure what I'm doing wrong, and I'd appreciate help.
 

jo-thijs

Member
In my game, I want my camera to follow around the player character. It successfully follows the character, but I'm having issues having the aspect ratio stay correct now that I've made it into full screen. My code is included below. Also, after attempting to fix the values, my window is now chopped off at the top and stuck
Code:
/// create camera

cam = view_camera[0];
follow = oplayer;
view_w_half = camera_get_view_width(cam) * 0.5;
view_h_half = camera_get_view_height (cam) * 0.5;
xTo = xstart;
yTo = ystart;
//fullscreen
windowHeight = 1920;
windowWidth = 1080;
window_set_size(windowWidth, windowHeight);
//monitor
monitorWidth  = display_get_width();
monitorHeight = display_get_height();
window_set_position(monitorWidth/2 - windowWidth/2 , monitorHeight/2 - windowHeight/2);
in the center of my screen. I reverted my changes, and it's still doing that.

I'm not sure what I'm doing wrong, and I'd appreciate help.
Hi and welcome to the GMC!

What you're doing isn't really fullscreen.
To achieve that, you would need to use window_set_fullscreen(true).
Your issue with the top of your window being chopped off is due to you using window_set_position.
If you don't use that, you won't have this issue anymore.
 
Top