Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
42 lines (31 loc) · 1.07 KB

SDL_android_main.cpp

File metadata and controls

42 lines (31 loc) · 1.07 KB
 
Jun 22, 2011
Jun 22, 2011
1
Oct 31, 2011
Oct 31, 2011
2
3
4
5
#include "SDL_config.h"
#ifdef __ANDROID__
Jun 22, 2011
Jun 22, 2011
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* 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
extern "C" void SDL_Android_Init(JNIEnv* env, jclass cls);
// Library init
extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
return JNI_VERSION_1_4;
}
// Start up the SDL app
extern "C" 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);
/* Run the application code! */
int status;
char *argv[2];
argv[0] = strdup("SDL_app");
argv[1] = NULL;
status = SDL_main(1, argv);
/* We exit here for consistency with other platforms. */
exit(status);
}
Oct 31, 2011
Oct 31, 2011
40
41
#endif /* __ANDROID__ */
Jun 22, 2011
Jun 22, 2011
42
/* vi: set ts=4 sw=4 expandtab: */