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

Android Problem with fullscreen.

Ludiq

Member
I'm making an android app for personal use with Gms 1.4 but I cant get rid off of the black bar at the bottom of the screen. My current rooms Width and Height are set to 720x1280 same goes for view in room and port on screen. I have tried with my phone resolution which is 1080 x 2340 but the black bar is still there. I can force fullscreen in my phone options but I don't want to do it this way. How to fix this?
Screenshot_2021-03-21-20-46-44-035_com.companyname.Project2333.jpg
 

FoxyOfJungle

Kazan Games
I was having exactly the same problem yesterday, even the resolution was the same lol, this solved it:

GML:
// init
window_set_fullscreen(true);
var aspect_ratio = display_get_width() / display_get_height();
var maintain_aspect_ratio = false;
var base_display_w = 720;
var base_display_h = 1280;
var display_w = 0;
var display_h = 0;
var camera_width = 720;
var camera_height = 1280;

camera_width = round(camera_width);
camera_height = round(camera_height);
if (camera_width & 1) camera_width ++;
if (camera_height & 1) camera_height ++;

// setup all the view ports
switch (os_type) {
    case os_android:
        maintain_aspect_ratio = true;
        break;
    
    case os_windows:
        window_set_color(c_dkgray);
        maintain_aspect_ratio = false;
        break;
    
    default:
        maintain_aspect_ratio = false;
        break;
}

//camera_width = round(camera_height * aspect_ratio);
if (maintain_aspect_ratio) {
    camera_height = round(camera_width/aspect_ratio);
}
display_w = camera_width;
display_h = camera_height;

global.camera_main = camera_create_view(0, 0, display_w, display_h, 0, noone, 0, 0, 0, 0);
camera_set_view_size(global.camera_main, display_w, display_h);

for (var i = 0; i <= 999; i++) {
    if (room_exists(i)) {
        room_set_camera(i, 0, global.camera_main);
        room_set_view_enabled(i, true);
        room_set_viewport(i, 0, true, 0, 0, display_w, display_h);
    }
}

// resize everything
surface_resize(application_surface, display_w, display_h);
display_set_gui_size(display_w, display_h);
window_set_size(display_w, display_h);
alarm[0] = 1; // center window
 

Ludiq

Member
I was having exactly the same problem yesterday, even the resolution was the same lol, this solved it:

GML:
// init
window_set_fullscreen(true);
var aspect_ratio = display_get_width() / display_get_height();
var maintain_aspect_ratio = false;
var base_display_w = 720;
var base_display_h = 1280;
var display_w = 0;
var display_h = 0;
var camera_width = 720;
var camera_height = 1280;

camera_width = round(camera_width);
camera_height = round(camera_height);
if (camera_width & 1) camera_width ++;
if (camera_height & 1) camera_height ++;

// setup all the view ports
switch (os_type) {
    case os_android:
        maintain_aspect_ratio = true;
        break;
  
    case os_windows:
        window_set_color(c_dkgray);
        maintain_aspect_ratio = false;
        break;
  
    default:
        maintain_aspect_ratio = false;
        break;
}

//camera_width = round(camera_height * aspect_ratio);
if (maintain_aspect_ratio) {
    camera_height = round(camera_width/aspect_ratio);
}
display_w = camera_width;
display_h = camera_height;

global.camera_main = camera_create_view(0, 0, display_w, display_h, 0, noone, 0, 0, 0, 0);
camera_set_view_size(global.camera_main, display_w, display_h);

for (var i = 0; i <= 999; i++) {
    if (room_exists(i)) {
        room_set_camera(i, 0, global.camera_main);
        room_set_view_enabled(i, true);
        room_set_viewport(i, 0, true, 0, 0, display_w, display_h);
    }
}

// resize everything
surface_resize(application_surface, display_w, display_h);
display_set_gui_size(display_w, display_h);
window_set_size(display_w, display_h);
alarm[0] = 1; // center window
I will try it later thank you ! Hmm I think this is for gms 2?
 
Top