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

Help displaying fullscreen on android device

ho88it

Member
I have been working on a project for android devices, and I am having a bit of trouble with the display size. When I test the game, I get a big black space to the left of the game, and a smaller one to the right. It looks like this:
1632271168389.png
optimally, I would like the game to fill the whole screen of the device. Another option that I would laso be interested in knowing how to make happen is making the dark space equal on either side of the game. How might I accomplish this?
 
Last edited by a moderator:

Ommn

Member
you can use a sample solution but not perfect
in option android: (Enable Full screen)
1632342051542.png
or use perfect solution (hard way) by:
change room size to same scale of your phone (maybe you need to change position of objects)
or use camera and view to fill black space
(review the thread)
 

ho88it

Member
you can use a sample solution but not perfect
in option android: (Enable Full screen)
View attachment 43184
or use perfect solution (hard way) by:
change room size to same scale of your phone (maybe you need to change position of objects)
or use camera and view to fill black space
(review the thread)
Alright I have followed through the camera and view article you recommended and have made some progress. Using this code in my room start event of my main controller object
GML:
//viewport stuff
view_enabled=true;
view_visible[0]=true;

var vHeight=768;
var vWidth=1366;

view_wport[0] = vWidth;
view_hport[0] = vHeight;

if room!=rPlay{
    var vHeight=768;
    var vWidth=1366;
    
    var yCamLoc=0;

    view_wport[0] = vWidth;
    view_hport[0] = vHeight;
    
    view_xport[0] = 0;
    view_yport[0] = 0;
}
else{
    var vHeight=864;
    var vWidth=1536;

    view_wport[0] = vWidth;
    view_hport[0] = vHeight;
    
    var yCamLoc=290;
    
    view_xport[0] = 0;
    view_yport[0] = 0;
}

//var _dwidth = display_get_width();
//var _dheight = display_get_height();
//var _xpos = (_dwidth / 2-vWidth/2);
//var _ypos = (_dheight / 2-vHeight/2);
//window_set_rectangle(window_get_x(), window_get_y(), vHeight, vWidth);
var disWidth,disHeight, ratio;
disWidth=display_get_width();
disHeight=display_get_height();

//ratio=disHeight/disWidth;
//disWidth/=ratio;
//window_set_size(1366,768)
surface_resize(application_surface,disWidth,disHeight)


view_camera[0] = camera_create_view(view_xport[0], yCamLoc, view_wport[0], view_hport[0]);
I have gotten rid of the bar on the right side of the screen, and reduced the size of the left one. However, I still cannot find out how to completely remove the left bar. My screen now looks like this:
View attachment 43215
Any idea how to fill that bar. If it helps, that is where the top of the phone is...
 

Ommn

Member
try this:
GML:
if room!=rPlay{
    var disWidth,disHeight, ratio;
    disWidth=display_get_width();
    disHeight=display_get_height();
    ratio=disWidth/disHeight;

    var vHeight=768;
    var vWidth=768*ratio;
    var yCamLoc=0;
    
    view_wport[0] = vWidth;
    view_hport[0] = vHeight;
    view_xport[0] = 0;
    view_yport[0] = 0;
}
 

ho88it

Member
try this:
GML:
if room!=rPlay{
    var disWidth,disHeight, ratio;
    disWidth=display_get_width();
    disHeight=display_get_height();
    ratio=disWidth/disHeight;

    var vHeight=768;
    var vWidth=768*ratio;
    var yCamLoc=0;
   
    view_wport[0] = vWidth;
    view_hport[0] = vHeight;
    view_xport[0] = 0;
    view_yport[0] = 0;
}
I tested that code, and unfortunately, the bar still appears. It is always on the side of the phone closest to the camera, which is usually the left (since my game is only meant to be played in landscape mode).
 
Top