Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.04 KB

SDL_android_main.c

File metadata and controls

38 lines (27 loc) · 1.04 KB
 
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "SDL_config.h"
#ifdef __ANDROID__
/* Include the SDL main definition header */
#include "SDL_main.h"
/*******************************************************************************
Functions called by JNI
*******************************************************************************/
#include <jni.h>
Aug 20, 2013
Aug 20, 2013
14
/* Called before SDL_main() to initialize JNI bindings in SDL library */
15
16
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
Aug 20, 2013
Aug 20, 2013
17
/* Start up the SDL app */
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
{
/* This interface could expand with ABI negotiation, calbacks, etc. */
SDL_Android_Init(env, cls);
SDL_SetMainReady();
/* Run the application code! */
int status;
char *argv[2];
argv[0] = SDL_strdup("SDL_app");
argv[1] = NULL;
status = SDL_main(1, argv);
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
Aug 21, 2013
Aug 21, 2013
33
/* exit(status); */
34
35
36
37
38
}
#endif /* __ANDROID__ */
/* vi: set ts=4 sw=4 expandtab: */