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

Latest commit

 

History

History
30 lines (24 loc) · 888 Bytes

SDL_android_main.cpp

File metadata and controls

30 lines (24 loc) · 888 Bytes
 
1
2
3
4
5
6
7
8
9
10
/* 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
Jan 13, 2011
Jan 13, 2011
11
extern "C" void SDL_Android_Init(JNIEnv* env, jclass cls);
12
13
14
15
16
17
18
19
// Library init
extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
return JNI_VERSION_1_4;
}
// Start up the SDL app
Jan 13, 2011
Jan 13, 2011
20
extern "C" void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
21
22
{
/* This interface could expand with ABI negotiation, calbacks, etc. */
Jan 13, 2011
Jan 13, 2011
23
SDL_Android_Init(env, cls);
24
25
26
27
28
29
30
/* Run the application code! */
char *argv[2];
argv[0] = strdup("SDL_app");
argv[1] = NULL;
SDL_main(1, argv);
}