Game Development Reference
In-Depth Information
The first line of our main loop is a call to s3eDeviceYield . This is a very important
function that must be called at regular intervals during our application, to allow
the device's OS to perform important tasks such as handling events—user inputs,
incoming phone calls, and so on. Under most circumstances, a single call to this
function in the main loop is sufficient.
The value passed to s3eDeviceYield is the maximum time (in milliseconds) that
our application will yield to the OS for. Normally this value is set to zero, which
yields long enough for the device to process the events, but will return control to
our application as soon as all the events have been processed.
Next, we call IwGxClear to clear the screen and then use IwGxPrintString to
display a message on the screen. IwGxFlush causes the Marmalade engine to then
process all our drawing requests to yield a final screen image that we can then
display to the world using IwGxSwapBuffers .
Finally, outside the main loop, we call IwGxTerminate to shut down Marmalade's
rendering engine, and finally return zero to indicate that our application was
completed without any errors.
Building the "Hello World" project
Now that we have set up our project and written the necessary code, it is finally time
to build it. To do this open a Windows Explorer window and navigate to the folder
containing Hello.mkb , and then just double-click on the file. You might see a brief
flash of a command-prompt window, but after a short delay, Visual C++ should
automatically start up with our project.
The act of double-clicking the MKB file actually causes the Marmalade makefile
builder script to be executed. This is actually a script written in the Python language,
which takes the MKB file and outputs a Visual C++ solution file and other required
elements. A file association is automatically set up when installing Marmalade, so
you can either double-click the file, or alternatively use the command prompt to
create your project by changing to the project directory and entering Hello.mkb .
Before we go on to compile and run the project though, let's take a quick look at
what Marmalade has created for us.
If you look in the project directory, there should be two new directories, which are
described in the following sections.
 
Search WWH ::




Custom Search