GMS 2 Background won't fill the screen?

B

BroskiGames

Guest
Hi there i am new here, and i am currently having an issue with getting my background to fill in on GameMaker Studio 2. I made a display manager that takes care of all the aspect ratio/screen resolution adaptions. But for some reason my background just won't scale and i am making the game in 640x480. I've added screenshots and the code for the DisplayManager. For further reference, just ask. :)

Code:
/// @description Display Properties
//Create the ideal width and height variables
ideal_width = 0;
ideal_height = 480;
zoom = 1;
max_zoom = 1;
use_sub_pixels = false;
//Get aspect ratio of the monitor
aspect_ratio = display_get_width()/display_get_height();
//Get the ideal width
ideal_width=round(ideal_height*aspect_ratio);
ideal_width=round(ideal_width)
ideal_height=round(ideal_height)
//Check for odd numbers
if(ideal_width & 1)
    ideal_width++;
   
if (ideal_height & 1)
    ideal_height++;
   
max_zoom = floor(display_get_width()/ideal_width);
   
//For loop
globalvar Main_Camera,Alt_Camera;
Main_Camera = 
camera_create_view(0,0,ideal_width,ideal_height,0,noone,0,0,0,0)
Alt_Camera =
camera_create_view(0,0,ideal_width,ideal_height,0,noone,0,0,0,0)
camera_set_view_size(Main_Camera,ideal_width,ideal_height);
camera_set_view_size(Alt_Camera,ideal_width,ideal_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,ideal_width,ideal_height);
        room_set_camera(i,0,Main_Camera);
       
        room_set_viewport(i,1,false,0,0,ideal_width,ideal_height);
        room_set_camera(i,1,Alt_Camera);
       
    }
}
//Resize Application Surface
surface_resize(application_surface,ideal_width,ideal_height);
display_set_gui_size(ideal_width,ideal_height);
window_set_size(ideal_width*zoom,ideal_height*zoom);
//initialize objects
instance_create_layer(x, y, "Instances", obj_game_controller);
instance_create_layer(x, y, "Instances", obj_sound_controller);
alarm[0]=1;
alarm[2]=1;
room_goto(room_next(room))


The ghost background is the titlescreen background, for some reason it pops up in the other room?? The zelda background is from the level itself.
 

HayManMarc

Member
I'm a bit surprised that your code is getting you any results at all, to be brutally honest. I'm having a hard time understanding what you're trying to do.

The way I'm deciphering your code, it looks like you want the game size (640 x 480) to scale up to any resolution size. I'm wondering why you don't just use the fullscreen function and let GameMaker scale it for you?
Code:
if window_get_fullscreen() == 0
{
     window_set_fullscreen(true);
}
 
Top