SDL2 for SDL_Main

This commit is contained in:
Gerhard Stein
2013-10-13 22:01:21 +02:00
parent 0e02707c4d
commit 3f0dd2e97a
3 changed files with 34 additions and 1 deletions

View File

@@ -1218,8 +1218,10 @@ MainLibrariesToLoad=""
for lib in $CompatibilityHacksAdditionalPreloadedSharedLibraries; do
MainLibrariesToLoad="$MainLibrariesToLoad \\\"$lib\\\","
done
MainLibrariesToLoad="$MainLibrariesToLoad \\\"application\\\", \\\"sdl_main\\\""
if [ "$CustomBuildScript" = "n" ] ; then
CustomBuildScript=
fi

View File

@@ -58,7 +58,7 @@ public class SDLActivity extends Activity {
//System.loadLibrary("SDL2_net");
//System.loadLibrary("SDL2_ttf");
System.loadLibrary("application");
System.loadLibrary("sdl_main");
System.loadLibrary("sdl2_main");
}
// Setup

View File

@@ -1,3 +1,8 @@
#if SDL_VERSION_ATLEAST(2,0,0)
#include "SDL_config.h"
#endif
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>
@@ -8,6 +13,32 @@
#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