I'm pulling my hair out with this. I cannot for the life of me figure out why my GUI is scaling incorrectly and creating sub pixels. Here's some examples: https://imgur.com/a/DU4uE6G
If I set my GUI to full device size it renders them fine but any sort of aspect ratio scaling I try to do (because I don't want my GUI to be drastically different sizes on different devices) breaks it.
Here's the code that's running at the beginning of the game to set up display:
Any help in identifying what I'm doing that's causing this would be appreciated!
If I set my GUI to full device size it renders them fine but any sort of aspect ratio scaling I try to do (because I don't want my GUI to be drastically different sizes on different devices) breaks it.
Here's the code that's running at the beginning of the game to set up display:
Code:
global.monitor_w = display_get_width()
global.monitor_h = display_get_height()
/// Display properties
global.view_width = 0;
global.view_height = 360
show_debug_message("Total display height: " + string(display_get_height()) +" View height set: " + string(vheight))
global.ui_scale = 2;
global.camera_x = 0
global.camera_y = 0
aspect_ratio = display_get_width() / display_get_height();
show_debug_message_ext("Aspect ratio: " + string(aspect_ratio))
global.view_width = global.view_height*aspect_ratio;
//Check to make sure our ideal width and height isn't an odd number, as that's usually not good.
if(global.view_width & 1)
global.view_width++;
if(global.view_height & 1)
global.view_height++;
//Setup all the view ports so I don't have to.
globalvar Main_Camera;
Main_Camera = camera_create_view(0,0,global.view_width,global.view_height,0,noone,0,0,0,0);
camera_set_view_size(Main_Camera,global.view_width,global.view_height);
for(var i=1; i<= room_last; i++)
{
if(room_exists(i))
{
room_set_view_enabled(i,true);
room_set_viewport(i,0,true,0,0,global.view_width,global.view_height);
room_set_camera(i,0,Main_Camera);
}
}
surface_resize(application_surface,global.view_width,global.view_height);
global.gui_height = vheight*uiscale
global.gui_width = (vheight*aspect_ratio)*uiscale
//display_set_gui_size(global.gui_width,global.gui_height);
window_set_size(global.view_width*uiscale,global.view_height*uiscale);