Game Development Reference
In-Depth Information
// Display our message on screen
IwGxPrintString(10, 10, lMessage);
// Flush IwGx draw buffers to screen
IwGxFlush();
// Swap screen double buffer
IwGxSwapBuffers();
}
// Terminate Marmalade modules
IwGxTerminate();
return 0;
}
The code should be fairly simple to follow, but here is a quick breakdown.
First we reference the include files to allow us to use the parts of Marmalade that
are necessary for our application, and then we create our main entry point function
main . This is equivalent to the main() function in a standard C or C++ program,
except that it takes no parameters as Marmalade does not accept command-line
parameters. It's quite hard to specify command-line parameters on mobile devices,
so there really isn't any need!
The first thing our application needs to do is initialize Marmalade's rendering
module with a call to IwGxInit() , which will initialize the screen and set up
standard behavior such as double buffering of the display.
Next we allocate a character buffer that will contain the message that we will be
displaying on screen. We initialize it to a default message to make sure that there is
something to be shown, but we then use a call to the s3eConfigGetString function
to see if another message has been specified in the application's configuration file,
which will be explained in more detail shortly.
The following call to IwGxSetColClear sets the desired screen background color
to black, and then the call to IwGxPrintSetScale tells Marmalade to display text
using its built-in font (which is quite small in size) at double its default resolution.
We now enter our main processing loop that will continue until the
s3eDeviceCheckQuitRequest function returns a true value, which will happen if
the user quits the application or if the device sends a quit request to the application
for any reason.
 
Search WWH ::




Custom Search