minor fix on CMakeLists for checking MSVC_VERSION
[freeglut] / src / android / fg_runtime_android.c
index acac390..d96f3af 100644 (file)
 #include <android/asset_manager.h>
 #include <android/native_window.h>
 #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 */
+/* Cf. fg_main_android.c */
 extern int32_t handle_input(struct android_app* app, AInputEvent* event);
 extern void handle_cmd(struct android_app* app, int32_t cmd);
 
@@ -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,6 +154,7 @@ 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 */
@@ -160,11 +162,6 @@ void android_main(struct android_app* app) {
 
   LOGI("android_main: end");
 
-  /* Finish processing all events (namely APP_CMD_DESTROY) before
-     exiting thread */
-  while (!app->destroyRequested)
-      fgPlatformProcessSingleEvent();
-
   /* Let NativeActivity restart us */
   /* Users may want to forcibly exit() in their main() anyway because
      NativeActivity doesn't dlclose() us, so all statically-assigned