X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fandroid%2Ffg_runtime_android.c;h=731c3080c4ef162dfeda4aed3dffb46995ebfc17;hb=6007df5166d84833aaff3fbf820867cbfe4dbde3;hp=253db950a0cc66325d6d855682b4e9736263cd5b;hpb=4b1d80d34568230510aafef6b9d505e1215c8d38;p=freeglut diff --git a/src/android/fg_runtime_android.c b/src/android/fg_runtime_android.c index 253db95..731c308 100644 --- a/src/android/fg_runtime_android.c +++ b/src/android/fg_runtime_android.c @@ -49,9 +49,10 @@ #include #include #include "android/native_app_glue/android_native_app_glue.h" +#include "android/fg_main_android.h" -#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "FreeGLUT", __VA_ARGS__)) -#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "FreeGLUT", __VA_ARGS__)) +#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "FreeGLUT-jnicb", __VA_ARGS__)) +#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "FreeGLUT-jnicb", __VA_ARGS__)) /* Cf. freeglut_main_android.c */ extern int32_t handle_input(struct android_app* app, AInputEvent* event); @@ -137,7 +138,7 @@ static void extract_assets(struct android_app* app) { * event loop for receiving input events and doing other things. */ void android_main(struct android_app* app) { - LOGI("android_main"); + LOGI("android_main savedState=%p", app->savedState); /* Register window resize callback */ app->activity->callbacks->onNativeWindowResized = onNativeWindowResized; @@ -153,17 +154,16 @@ void android_main(struct android_app* app) { { char progname[5] = "self"; char* argv[] = {progname, NULL}; + fgDisplay.pDisplay.app = app; main(1, argv); + /* FreeGLUT will exit() by itself if + GLUT_ACTION_ON_WINDOW_CLOSE == GLUT_ACTION_EXIT */ } LOGI("android_main: end"); - /* Finish processing all events (namely APP_CMD_DESTROY) before - exiting thread */ - while (!app->destroyRequested) - fgPlatformProcessSingleEvent(); - - /* In theory we should let NativeActivity restart us, however this - doesn't work well yet, so force exit */ - exit(0); + /* Let NativeActivity restart us */ + /* Users may want to forcibly exit() in their main() anyway because + NativeActivity doesn't dlclose() us, so all statically-assigned + variables keep their old values on restart.. */ }