tamaslnagy
tamaslnagy

Reputation: 441

Supporting multiple screen sizes/resolutions/aspect ratios using MonoGame

What is the recommended way of supporting multiple screen resolutions/aspect ratios across devices like iPad, iPhone, Windows Phones, and Android phones/tablets? Should I simply #if/#else specific code for each device? I don't know how well this would work. Especially for Android phones/tablets which come in all different sizes. Any pointers would be greatly appreciated.

Upvotes: 2

Views: 1703

Answers (1)

jonathanpeppers
jonathanpeppers

Reputation: 26485

Here is what we are doing for our game:

  • All menu or ui elements are positioned based on the screen size (we implement Horizontal and Vertical alignment)
  • All levels scroll, so on some devices you just see less of level of the level at a time
  • Our levels also zoom in on smaller devices where needed
  • Design fixed levels (ones that don't scroll) so that a bit of unused space is on the edges of the screen. This way it can get cropped on some devices no problem.
  • Make 3 sizes of images: small (3GS), medium (iPhone 4, Android, WP7, iPad), large iPad3
  • Position sprites/ui elements based on an images size
  • Take advantage of the @2x naming scheme for images
  • We made an iPhone-only and iPad-only version of the app, this helps in only having to put 2 sets of images in each app

Using the screen size for positioning is your best bet. Being able to center or dock to the bottom or right of the screen is also very helpful in general.

I could tell more, but I can't reveal specifics about our game yet.

Upvotes: 1

Related Questions