O'Reilly logo

Developing Mobile Games with Moai SDK by Francisco Tufro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Going multi-platform

The first thing we need to think about is how we are going to deal with different resolutions in our project. You could do a lot of fancy stuff in this regard, such as changing the UI given different sizes, or loading HD images if the resolution is higher than or equal to 1024 x 768 (or whatever you choose!), and so on. In this example we're going to keep it simple; we will just stretch everything so that it fits on the screen.

Open the Concentration project and change the following lines:

SCREEN_RESOLUTION_X = 2 * WORLD_RESOLUTION_X
SCREEN_RESOLUTION_Y = 2 * WORLD_RESOLUTION_Y

To the following:

SCREEN_RESOLUTION_X = MOAIEnvironment.horizontalResolution
SCREEN_RESOLUTION_Y = MOAIEnvironment.verticalResolution

If you run the project ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required