• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

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