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

Anadroid Full Screen (Black Boarders) Problem

naresh

Member
hello,

i am working on android game, but when i testing my game i got a black boarders in phone top and bottom side, please find the below image

Screenshot_20190331-210040_Catch The Blue.jpg

i tried on 480 X 800 resolution and 1080 X 1920,

how can i solve the problem
 

NightFrost

Member
By using the aspect ratio of your phone? If that image is a full screenshot, it is 720x1520, which is an aspect ratio over two, while those two you tested have a ratio of less than two. Of course, if your game field needs to be of a certain size ratio, then black borders are an inevitability on every mobile screen that does not conform to that ratio. For example if your field needs to be twice as tall as it is wide, then every screen that does not use that ratio either has to use black borders, or do an ugly stretch, or the game needs to conform to screen ratio and accept that different phones will have a different gameplay feel because game will be sized differently.
 

naresh

Member
Thank you for reply,

can you please tell me how to calculate aspect ration and what is the exact width and height for to match with all devices.
 

NightFrost

Member
You can get current display device's dimensions with display_get_width() and display_get_height(). These values can then be used to set sizes for application surface, gui, room and camera. If you're unfamiliar with on unsure about some of that stuff, I mostly learned from this video series by PixelatedPope.
 

naresh

Member
sorry for the late replay

i dint understand, can you please explain clearly where can i apply this code. {display_get_width() and display_get_height()}
 
Top