Game Development Reference
In-Depth Information
Straight out of the box, Moai has no IDE or tools like Gideros Studio does. However, it does contain
the
moai
binary to test the Lua code with. When you unpack the ZIP file (which is the same for all
platforms), the
bin
directory contains the libraries for all platforms, and also contains the executables
(which act as the simulators to test the Moai code) for Windows and Mac OS X.
The Moai SDK
The first thing you need to start development with Moai is a text editor (some alternatives are
discussed in Chapter 13), as there is no IDE that integrates development for Moai (however
ZeroBrane fills in that gap, but is not included with Moai by default).
bin
directory has the executables for Windows and Mac; you can run
moai
in the terminal
moai.exe main.lua
; for Mac
moai main.lua
.
samples
folder, either via
run.bat
or
run.sh
, you should see
10-1
.
Figure 10-1.
The Moai simulator running a sample app
Hello Moai
There are a couple of things we need to do to get an app in Moai running. First, we need a window
to display our application, which will double as the simulator on the desktop. We create a window
using the
MOAISim
class and call the
openWindow
function. The
openWindow
function takes three
parameters: a title, a width, and a height.