src/main/android/SDL_android_main.c
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 06 Sep 2014 23:20:14 +0200
changeset 9125 e004bdb812ce
parent 9006 98c808d72e20
child 9171 3464a9bda1e2
permissions -rw-r--r--
Fixed example in header file.

Did not compile because of typo in function name and missing argument.
     1 /*
     2     SDL_android_main.c, placed in the public domain by Sam Lantinga  3/13/14
     3 */
     4 #include "../../SDL_internal.h"
     5 
     6 #ifdef __ANDROID__
     7 
     8 /* Include the SDL main definition header */
     9 #include "SDL_main.h"
    10 
    11 /*******************************************************************************
    12                  Functions called by JNI
    13 *******************************************************************************/
    14 #include <jni.h>
    15 
    16 /* Called before SDL_main() to initialize JNI bindings in SDL library */
    17 extern void SDL_Android_Init(JNIEnv* env, jclass cls);
    18 
    19 /* Start up the SDL app */
    20 int Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
    21 {
    22     /* This interface could expand with ABI negotiation, calbacks, etc. */
    23     SDL_Android_Init(env, cls);
    24 
    25     SDL_SetMainReady();
    26 
    27     /* Run the application code! */
    28     /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works.
    29        https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start
    30      */
    31     int status;
    32     char *argv[2];
    33     argv[0] = SDL_strdup("app_process");
    34     argv[1] = NULL;
    35     status = SDL_main(1, argv);
    36 
    37     /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
    38     /* exit(status); */
    39 
    40     return status;
    41 }
    42 
    43 #endif /* __ANDROID__ */
    44 
    45 /* vi: set ts=4 sw=4 expandtab: */