Cerberus X Documentation

Module mojo

Tho mojo modules provide a lightweight programming framework designed primarily for creating simple 2d games. More...

Declarations

Imports
mojo.app The app module contains the App class along with various support functions for controlling application behaviour.
mojo.asyncloaders The Mojo async loaders module provides functions and interfaces for loading images and sounds asynchronously.
mojo.audio The audio module contains functions for playing sounds and music.
mojo.graphics The graphics module contains various functions that allow you to draw 2D graphics on all supported Cerberus target platforms.
mojo.input The input module allows programs to check for user input from a wide variety of devices such keyboards, mice, joysticks and touchsceens.

Detailed Discussion

Tho mojo modules provide a lightweight programming framework designed primarily for creating simple 2d games.

Mojo applications must extend the mojo App class declared in mojo.app and create a new instance of this class somewhere inside the Cerberus Main() function. This is what actually creates the application.

All data for mojo programs (images, sounds and text files) must go into a special data directory. This directory has the same name as the program's main source file, only with a '.data' extension instead of '.cxs'. For example, if your main source file is called 'joust2k.cxs', then your data directory will need to be named 'joust2k.data'.

Mojo functions should not be called until your application's OnCreate method is called. This means you cannot initialize global variables with values returned by mojo functions such as MilliSecs - you must instead initialize such variables in your application's OnCreate method or later.

To import all the mojo modules into your program, simply use:

Import mojo

This will automatically import the mojo.app, mojo.graphics, mojo.audio and mojo.input modules for you in one hit.