src/main/android/SDL_android_main.c
changeset 7501 b27825bb5879
parent 7467 998579383ced
child 7663 53fe1b64eb2d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/main/android/SDL_android_main.c	Mon Jul 22 02:51:45 2013 -0700
     1.3 @@ -0,0 +1,38 @@
     1.4 +
     1.5 +#include "SDL_config.h"
     1.6 +
     1.7 +#ifdef __ANDROID__
     1.8 +
     1.9 +/* Include the SDL main definition header */
    1.10 +#include "SDL_main.h"
    1.11 +
    1.12 +/*******************************************************************************
    1.13 +                 Functions called by JNI
    1.14 +*******************************************************************************/
    1.15 +#include <jni.h>
    1.16 +
    1.17 +// Called before SDL_main() to initialize JNI bindings in SDL library
    1.18 +extern void SDL_Android_Init(JNIEnv* env, jclass cls);
    1.19 +
    1.20 +// Start up the SDL app
    1.21 +void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
    1.22 +{
    1.23 +    /* This interface could expand with ABI negotiation, calbacks, etc. */
    1.24 +    SDL_Android_Init(env, cls);
    1.25 +
    1.26 +    SDL_SetMainReady();
    1.27 +
    1.28 +    /* Run the application code! */
    1.29 +    int status;
    1.30 +    char *argv[2];
    1.31 +    argv[0] = SDL_strdup("SDL_app");
    1.32 +    argv[1] = NULL;
    1.33 +    status = SDL_main(1, argv);
    1.34 +
    1.35 +    /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
    1.36 +    //exit(status);
    1.37 +}
    1.38 +
    1.39 +#endif /* __ANDROID__ */
    1.40 +
    1.41 +/* vi: set ts=4 sw=4 expandtab: */