Game Development Reference
In-Depth Information
OnStartMusic(String name, int loop) : This fires on background music. It
delegates to the receiver.
OnStopMusic(String name) : This fires on stop music background. It delegates to
the receiver.
OnSetMusicVolume(int volume) : This fires when the user sets the music volume. It
delegates to the receiver.
Native Methods
The native methods invoke the native Doom engine. There are three basic native methods:
static native int DoomMain(String[] argv) : This method invokes the main
game loop of the Doom engine.
static native int keyEvent(int type, int key) : This method sends a key event
to the engine. The event type is either EV_KEYDOWN or EV_KEYUP . The argument key
must be an ASCII symbol, not an Android key code. This means the key code must
be translated before being sent to the engine.
static native int motionEvent(int b, int x, int y) : This method sends a
motion event to the engine (such as when the user drags a finger on the display).
The first argument is a mouse button (always zero in this case), plus the x and y
coordinates of the event itself.
static native int DoomMain(String[] argv) requires a list or arguments and blocks execution, so
it must be run within a thread. The following are the most important arguments:
width defines the width of the video buffer.
height defines the height of the video buffer.
iwad defines the game to be played. The following game files are supported by the
engine:
doom1.wad : This is the shareware episode of Doom.
doom.wad : This is the retail episode.
doom2.wad : This is the second episode in the Doom series.
plutonia.wad : This is the Plutonia Experiment episode, part of the Ultimate
Doom series.
tnt.wad : This is an episode dubbed Evilution, also part of the ultimate
Doom series.
file defines extra game files to be used by the engine.
For example, to play Doom shareware in landscape mode, the list arguments that must be sent to
DoomMain (as a String array) would be doom -width 480 -height 320 -iwad doom1.wad .
Search WWH ::




Custom Search