Game Development Reference
In-Depth Information
private static void OnFatalError(String message) {
if (listener != null)
listener.OnFatalError(message);
}
private static void OnQuit(int code) {
if (listener != null)
listener.OnQuit(code);
}
/**
* Fires when a sound is played in the C layer.
*/
private static void OnStartSound(byte[] name, int vol) {
if (listener != null)
listener.OnStartSound(new String(name), vol);
}
/**
* Start background music callback
*/
private static void OnStartMusic(String name, int loop) {
if (listener != null)
listener.OnStartMusic(name, loop);
}
/**
* Stop background music
* @param name
*/
private static void OnStopMusic(String name) {
if (listener != null)
listener.OnStopMusic(name);
}
/**
* Set background music volume
* @param volume Range: (0-255)
*/
private static void OnSetMusicVolume(int volume) {
if (listener != null)
listener.OnSetMusicVolume((int) (volume * 100.0 / 15.0));
}
}
Native Layer
The native layer glues the Java and C code together by defining three types of tasks to be
performed:
Native method implementations : These are the C implementations of
the native Java methods defined by the native interface class. This code
lives in the file jni_doom.c.
 
Search WWH ::




Custom Search