Hi all.
So I was following Pixelated Pope's YT videos regarding scaling for devices. I am trying to apply scaling in Android devices. I followed the code in pixelated pope's video but did some changes since some functions are already obsolete in Game Maker Studio 2.3.
Here is the scaling code:
CREATE
That scaling code is persistent and is only located in the room_init which is the first room. room_init has a dimension of 1080 x 1920 (portrait). Viewports are enabled (1080 x 1920). Under Android settings -> graphics -> scaling, Keep aspect ratio is checked. The other rooms have also a dimension of 1080 x 1920. The game is designed for a 1080 x 1920 phone, which is one of the most common phone resolutions, that is why I make the rooms 1080 x 1920.
Here lies the problem. I tested this in 3 devices (Samsung Galaxy J1 2016, some locally made low spec tablet, and Samsung Galaxy A30), as you can see in this picture, they still got the black bars.
Pic:
I would like to know some of your insights regarding how to remove the black bars and make it fit to their respective resolutions? Any links can sure help.
Thank you.
So I was following Pixelated Pope's YT videos regarding scaling for devices. I am trying to apply scaling in Android devices. I followed the code in pixelated pope's video but did some changes since some functions are already obsolete in Game Maker Studio 2.3.
Here is the scaling code:
CREATE
GML:
ideal_width = 0
ideal_height = 2340 //maximum height supported
aspect_ratio = display_get_width()/display_get_height();
ideal_width = round(ideal_height*aspect_ratio)
if (ideal_width & 1)
ideal_width++;
camera = camera_create_view(0, 0, ideal_width, ideal_height, 0, -1, -1, -1, 0, 0);
for (var i=1; i <= room_last; i++)
{
if (room_exists(i))
{
room_set_camera(i,0,camera); //originally room_set_view in pixelated pope's video, but this function is obsolete in GMS 2.3
room_set_view_enabled(i, true);
}
}
surface_resize(application_surface, ideal_width, ideal_height);
window_set_size(ideal_width, ideal_height);
room_goto(room_next(room))
Here lies the problem. I tested this in 3 devices (Samsung Galaxy J1 2016, some locally made low spec tablet, and Samsung Galaxy A30), as you can see in this picture, they still got the black bars.
Pic:
I would like to know some of your insights regarding how to remove the black bars and make it fit to their respective resolutions? Any links can sure help.
Thank you.
Attachments
-
507.8 KB Views: 4