Automatically loading assets/game.love if exists

This commit is contained in:
fysx
2013-12-28 15:28:05 +01:00
parent 7758fc2412
commit 6518cde39a
4 changed files with 106 additions and 25 deletions
@@ -22,21 +22,30 @@ void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject
SDL_SetMainReady();
/* get argument from SDLMain in SDLActivity.java */
jboolean isCopy;
const char* str = (*env)->GetStringUTFChars(env, obj, &isCopy);
/* Run the application code! */
int status;
char *argv[4];
int argc;
if (SDL_strlen(str) > 0)
argc = 2;
else
argc = 1;
/* assemble argv depending on whether we have an argument or not */
char *argv[argc + 1];
argv[0] = SDL_strdup("SDL_app");
argv[1] = SDL_strdup("--package-path");
argv[2] = SDL_strdup(str);
argv[3] = NULL;
if (SDL_strlen(str) > 0)
argv[1] = SDL_strdup(str);
argv[argc] = NULL;
if (isCopy == JNI_TRUE)
(*env)->ReleaseStringUTFChars(env, obj, str);
status = SDL_main(3, argv);
status = SDL_main(argc, argv);
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
/* exit(status); */