2011-01-06 16:11:21 -08:00
|
|
|
|
|
|
|
/* Include the SDL main definition header */
|
|
|
|
#include "SDL_main.h"
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
Functions called by JNI
|
|
|
|
*******************************************************************************/
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
// Called before SDL_main() to initialize JNI bindings in SDL library
|
2011-01-13 15:10:17 -08:00
|
|
|
extern "C" void SDL_Android_Init(JNIEnv* env, jclass cls);
|
2011-01-06 16:11:21 -08:00
|
|
|
|
|
|
|
// Library init
|
|
|
|
extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
|
|
|
{
|
|
|
|
return JNI_VERSION_1_4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start up the SDL app
|
2011-01-13 15:10:17 -08:00
|
|
|
extern "C" void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
|
2011-01-06 16:11:21 -08:00
|
|
|
{
|
|
|
|
/* This interface could expand with ABI negotiation, calbacks, etc. */
|
2011-01-13 15:10:17 -08:00
|
|
|
SDL_Android_Init(env, cls);
|
2011-01-06 16:11:21 -08:00
|
|
|
|
|
|
|
/* Run the application code! */
|
|
|
|
char *argv[2];
|
|
|
|
argv[0] = strdup("SDL_app");
|
|
|
|
argv[1] = NULL;
|
|
|
|
SDL_main(1, argv);
|
|
|
|
}
|