GameMaker [Solved] Question about fullscreen in GMS2

M

MsTopHat

Guest
I've been messing with GMS2 for a while now and I noticed something was a little off compared to when I used gms1. When I entered fullscreen in GMS1 using my display coding it would display the image in the center of the screen then draw black bars around the window where necessary.
In GMS2 whenever I set the game to full screen it always places the game window in the top left corner of the screen and draws the black bars on the bottom and the right of the screen. I know GMS2 changed some things when it came to view_ports and what not, and I'm not sure if that is causing the issue.
I've tried using code to center the display while in fullscreen but nothing ends up happening.

Code:
/// @description initialize the display
// You can write your code in this editor

game_running_width = 480; //the default settings that my game initializes in
game_running_height = 270;

var screen_max_width = display_get_width() //get the max size of the monitor the user is using
var screen_max_height = display_get_height()

ideal_width = 1920 //testing; my monitor is 1920x1200
ideal_height = 1080 //testing

wy = window_get_y();

var grw = game_running_width;
var grh = game_running_height;
var iw = ideal_width
var ih = ideal_height

aspect_ratio = display_get_width()/display_get_height();

//create the camera.  The camera follows obj_default_view
global.camera = camera_create_view(0,0, grw, grh, 0, obj_default_view, -3, -3, 140, 140);
var cc = global.camera //camera variable

for(var i = 1; i<=room_last; i++) {
    
    if room_exists(i) {
        room_set_camera(i, 0, cc);
        room_set_view_enabled(i, true);
        room_set_viewport(i,0,true,0,0,iw, ih);

    }

}

surface_resize(application_surface, ideal_width, ideal_height);
window_set_size(ideal_width, ideal_height);

//window_set_fullscreen(true);
alarm[0] = 1;

room_goto_next();

If anyone has any solutions, or ideas of what might be happening it would be much appreciated!
 
P

PandaPenguin

Guest
what's happening in that "alarm[0]" event you set there? are you centering your window in that alarm?

my code looks almost exactly like yours (you probably watched @Pixelated_Pope s video tutorial series on that too :p )
and in an alarm event 1 frame later I use window_center() (because it won't work in the same frame where you resize/set your other GUI and surface sizes)
and when I test it on a non 16:9 display the bars are on both sides(got an old 4:3 monitor for testing)
 
I

ItchyPancake

Guest
Just throwing out possible ideas as to what is happening. Is it possible game maker is stretching the game to fit? And is the camera view bigger than the room?

If so, that could explain why the game is at the top left.

Double check the view size (not port) and make sure game maker isnt stretching to fit the screen in the settings.

That's all I can think of haha. Hope any of this was a small amount of help
 
M

MsTopHat

Guest
what's happening in that "alarm[0]" event you set there? are you centering your window in that alarm?
my code looks almost exactly like yours (you probably watched @Pixelated_Pope s video tutorial series on that too :p )
and in an alarm event 1 frame later I use window_center() (because it won't work in the same frame where you resize/set your other GUI and surface sizes)
and when I test it on a non 16:9 display the bars are on both sides(got an old 4:3 monitor for testing)
Yeah I did watch @Pixelated_Pope great tutorial. I changed a few things to get it working in gms2, but I'm still having issues. In the alarm I center the window which seems to do nothing in fullscreen mode but does center it if I just keep it in windowed.
I'm not sure why it won't center the black bars for me haha.

Just throwing out possible ideas as to what is happening. Is it possible game maker is stretching the game to fit? And is the camera view bigger than the room?
If so, that could explain why the game is at the top left.
Double check the view size (not port) and make sure game maker isnt stretching to fit the screen in the settings.
That's all I can think of haha. Hope any of this was a small amount of help
My camera is set up to be 480x270 and my room is 600x400, the one I'm testing. I then stretch the viewport though to fit a good size, in this case 1920x1080. However it will only draw the black bars for me at the bottom of the screen.

Thanks for the replies <3
I'm wondering if maybe a better solution is to have the screen stretch to a desired size and then manually draw the black bars?
 
M

MsTopHat

Guest
Update! I figured out what was causing the issue, however I can't figure out how to do this correctly now.
The issue is because I'm also running a shader through the application_surface I have to disable the auto draw with
application_surface_draw_enable(false);
however doing this makes it so that gms2 actually draws two application surface's, so you see them both at the same time. one that's tiny with my shader and the resized one which the shader isn't affecting.
Now I'm going to figure out how to get the shader to draw on the same aplication_surface that is being resized.
One headache down haha :p thanks for all your help!
 
Top