• 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!

Black bars not showing correctly

Megax60

Member
i made the game scale pixel perfect, but the black bars on the sides are moved:

i followed this guide. The resolution is 640 x 480. I really dont know what im doing wrong

obj_system create event:
Code:
//Resize
application_surface_draw_enable(false);
window_set_fullscreen(true);
global.MonitorW = display_get_width();
global.MonitorH = display_get_height();
global.Xoffset = (global.MonitorW - 640) / 2;
global.Yoffset = (global.MonitorH - 480) / 2;

if(global.MonitorW >= 1280 && global.MonitorH >= 960){
    surface_resize(application_surface,1280,960)
    global.Xoffset = (global.MonitorW - 1280)/2;
    global.Yoffset = (global.MonitorH - 960)/2;
}
draw gui end event:
Code:
//Resize screen
draw_surface_ext(application_surface,global.Xoffset,global.Yoffset,1,1,0,c_white,1);
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Code:
global.Xoffset = (global.MonitorW / 2) - (surface_get_width(application_surface) / 2);
global.Yoffset = (global.MonitorH / 2) - (surface_get_height(application_surface) / 2);
That's what I'd do... :)
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Add breakpoints to the code and step through it in the debugger to make sure that the values are those that you expect. Also, you are using the DISPLAY width, but drawing in the GUI event... so if the GUI layer is not the same size as the display, then you'll get issues (and I suspect that is where the problem lies here). Check the GUI width/height and resize it as required, or change the display width/height values for GUI width/height values.
 
Top