Yay, C/CPP-Code is now executed. Getting fine-grain now...
This commit is contained in:
@@ -13,7 +13,7 @@ LOCAL_CFLAGS := -DSDL_JAVA_PACKAGE_PATH=$(SDL_JAVA_PACKAGE_PATH) -DSDL_CURDIR_PA
|
||||
|
||||
LOCAL_CPP_EXTENSION := .cpp
|
||||
|
||||
LOCAL_SRC_FILES := sdl_main.c
|
||||
LOCAL_SRC_FILES := sdl_main.c SDL_android_main.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := sdl-$(SDL_VERSION) application
|
||||
LOCAL_LDLIBS := -llog
|
||||
|
||||
42
project/jni/sdl_main/SDL_android_main.cpp
Normal file
42
project/jni/sdl_main/SDL_android_main.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
|
||||
//exit(status);
|
||||
}
|
||||
|
||||
#endif /* __ANDROID__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1,8 +1,4 @@
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
#include "SDL_config.h"
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
@@ -13,32 +9,6 @@
|
||||
#include "SDL_main.h"
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
|
||||
|
||||
|
||||
// Called before SDL_main() to initialize JNI bindings in SDL library
|
||||
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
|
||||
|
||||
// Start up the SDL app
|
||||
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 */
|
||||
//exit(status);
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
#include "SDL_android.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user