- Online Community Forums » Programming Questions » [Android] Display size

This thread is locked; no one can reply to it. rss feed Print
[Android] Display size
Member #8,794
July 2007

On Android, al_create_display() always returns a display with the size of the Android device's screen despite of the arguments you pass when calling it. So, if you're porting a game that you built on PC using a fixed display size, what's the best approach to adapting it to Android displays?. I'm thinking there's a few ways to do it:

  • Use an Allegro transform to scale all the drawing operations in the original code to the Android display.

  • Use a custom target bitmap for drawing operations and, when all the drawing is done, draw the scaled version of the bitmap containing the final result to the Android display's backbuffer.

  • Scale all drawing operations accordingly by taking into account the actual display size and/or DPI.

Member #17,092
June 2019

I'm not sure if it would be the fastest solution (in terms of app execution times) but with a ready made game I would definitively go with the second option as it seems to be the most straightforward one (and would avoid beta testing to see if all the transforms or scaling were done correctly in the Android port).

Go to: