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

Opening a window

The first thing we'll learn is how to open the main game window using Moai SDK.

This is a relatively easy task. The code is as follows:

MOAISim.openWindow ( "Concentration", 320, 480 )

What we are doing here is calling the MOAISim.openWindow class method with the necessary parameters, namely, title for window (a string), width, and height. As you may have noticed, we used 320 x 480, which is the display resolution of an iPhone 3GS (without Retina Display).

If you run the script now, you'll see that a window opens. So that's it, our main window is ready. But before going further, let's take a look at an important aspect of Moai SDK.

Note

Downloading the example code

You can download the example code files for all Packt books you ...

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