Android Canvas 2D Game: Supporting multiple screen sizes/resolutions

| | August 8, 2015

I’m planning to develop a 2D game for android devices by using simple Canvas Surfaces (I know that OpenGL might be more efficient – but Canvas should definitely be enough for my type of game).

I’m currently researching on how I should handle different screen sizes/resolutions/ratios of the different android devices. I don’t think it’s a big deal to scale a bitmap if the screen size is just 920×512 instead of 1920×1024 (for example) – but what about completely different ratios? Like 1200x800px screens? I would have to stretch these bitmaps, or just make more objects visible from my game, which would normally be hidden in shorter screens.

I didn’t really find anything useful on my research (mainly some discussions about Canvas VS OpenGL…) – so I’m giving it a try here.
What’s the best/most common used technique to adjust a game to different screen sizes? Other than just putting black borders along my game, if the width/height is too large.

One Response to “Android Canvas 2D Game: Supporting multiple screen sizes/resolutions”

  1. If the aspect ratio remains constant, just scale the bitmaps. GUI elements might need some different handling though. For a more robust approach:

    • Do your research into what resolutions are available for your target platforms and pick the most often used ones
    • Create GUI configurations (ideally, purely visual rather than making more objects visible, etc) for the most common resolutions
    • For a resolution that you do not support, find the resolution/aspect that’s closest and programmatically generate a GUI configuration which resembles that.

Leave a Reply