Merge branch 'sdl_android' of github.com:pelya/commandergenius into android
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
#define _SDL_main_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#ifdef RELEASE_BUILD
|
||||
#include <jni.h>
|
||||
#endif
|
||||
|
||||
/** @file SDL_main.h
|
||||
* Redefine main() on Win32 and MacOS so that it is called by winmain.c
|
||||
@@ -54,8 +57,11 @@
|
||||
#define main SDL_main
|
||||
|
||||
/** The prototype for the application's main() function */
|
||||
#ifdef RELEASE_BUILD
|
||||
extern C_LINKAGE int SDL_main(int argc, char *argv[], JNIEnv* env, jobject thiz);
|
||||
#else
|
||||
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
|
||||
|
||||
#endif
|
||||
|
||||
/** @name From the SDL library code -- needed for registering the app on Win32 */
|
||||
/*@{*/
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
static int argc = 0;
|
||||
static char ** argv = NULL;
|
||||
|
||||
#ifdef RELEASE_BUILD
|
||||
static JNIEnv* static_env;
|
||||
static jobject static_thiz;
|
||||
#endif
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#else
|
||||
extern void SDL_ANDROID_MultiThreadedVideoLoopInit();
|
||||
@@ -35,7 +40,11 @@ extern void SDL_ANDROID_MultiThreadedVideoLoop();
|
||||
|
||||
static int threadedMain(void * unused)
|
||||
{
|
||||
#ifdef RELEASE_BUILD
|
||||
SDL_main( argc, argv, static_env, static_thiz );
|
||||
#else
|
||||
SDL_main( argc, argv );
|
||||
#endif
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Application closed, calling exit(0)");
|
||||
exit(0);
|
||||
}
|
||||
@@ -49,6 +58,11 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring
|
||||
const jbyte *jstr;
|
||||
const char * str = "sdl";
|
||||
|
||||
#ifdef RELEASE_BUILD
|
||||
static_env = env;
|
||||
static_thiz = thiz;
|
||||
#endif
|
||||
|
||||
strcpy(curdir, "/sdcard/app-data/");
|
||||
strcat(curdir, SDL_CURDIR_PATH);
|
||||
|
||||
@@ -102,10 +116,18 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "param %d = \"%s\"", i, argv[i]);
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#ifdef RELEASE_BUILD
|
||||
SDL_main( argc, argv, env, thiz );
|
||||
#else
|
||||
SDL_main( argc, argv );
|
||||
#endif
|
||||
#else
|
||||
if( ! multiThreadedVideo )
|
||||
#ifdef RELEASE_BUILD
|
||||
SDL_main( argc, argv, env, thiz );
|
||||
#else
|
||||
SDL_main( argc, argv );
|
||||
#endif
|
||||
else
|
||||
{
|
||||
SDL_ANDROID_MultiThreadedVideoLoopInit();
|
||||
|
||||
Reference in New Issue
Block a user