-
- return 0;
- }
-
- static void mnit_handle_cmd(struct android_app* app, int32_t cmd) {
-
- mnit_java_app = app;
- AConfiguration_setOrientation(mnit_java_app->config, ACONFIGURATION_ORIENTATION_LAND);
- LOGI("cmd %i", (int)pthread_self());
-
- switch (cmd) {
- case APP_CMD_SAVE_STATE:
- LOGI ("save state");
- mnit_java_app->savedStateSize = 1;
- mnit_java_app->savedState = malloc(1);
- App_save(nit_app);
- break;
-
- case APP_CMD_INIT_WINDOW:
- LOGI ("init window");
- if (mnit_java_app->window != NULL) {
- LOGI("init window in");
- App_init_window(nit_app);
- mnit_frame();
- mnit_animating = 1;
- }
- break;
-
- case APP_CMD_TERM_WINDOW:
- LOGI ("term window");
- mnit_term_display();
- App_term_window(nit_app);
- break;
-
- case APP_CMD_GAINED_FOCUS:
- LOGI ("gain foc");
- mnit_animating = 1;
- App_gained_focus(nit_app);
- LOGI ("gain foc 1");
- break;
-
- case APP_CMD_LOST_FOCUS:
- LOGI ("lost foc");
- mnit_animating = 0;
- App_lost_focus(nit_app);
- mnit_frame();
- break;
-
- case APP_CMD_PAUSE:
- LOGI ("app pause");
- App_pause(nit_app);
- break;
-
- /*
- case APP_CMD_STOP:
- LOGI ("app stop");
- App_stop(nit_app);
- break;
-
- case APP_CMD_DESTROY:
- LOGI ("app destrop");
- App_destroy(nit_app);
- break;
-
- case APP_CMD_START:
- LOGI ("app start");
- App_start(nit_app);
- break;
- */
-
- case APP_CMD_RESUME:
- LOGI ("app resume");
- App_resume(nit_app);
- break;
-
- case APP_CMD_LOW_MEMORY:
- LOGI ("app low mem");
- break;
-
- case APP_CMD_CONFIG_CHANGED:
- LOGI ("app cmd conf ch");
- break;
-
- case APP_CMD_INPUT_CHANGED:
- LOGI ("app cmd in ch");
- break;
-
- case APP_CMD_WINDOW_RESIZED:
- mnit_orientation_changed = 1;
- LOGI ("app win res");
- break;
-
- case APP_CMD_WINDOW_REDRAW_NEEDED:
- LOGI ("app win redraw needed");
- break;
-
- case APP_CMD_CONTENT_RECT_CHANGED:
- LOGI ("app content rect ch");
- break;
- }
- }
-
- void android_main(struct android_app* app)
- {
- mnit_java_app = app;
-
- app_dummy();
-
- main(0, NULL);
- }
-
- void mnit_frame()
- {
- if (mnit_display == EGL_NO_DISPLAY) {
- LOGI("no frame");
- return;
- }
-
- if (mnit_orientation_changed)
- {
- mnit_orientation_changed = 0;
-
- if (mnit_surface != EGL_NO_SURFACE) {
- eglDestroySurface(mnit_display, mnit_surface);
- }
- EGLSurface surface = eglCreateWindowSurface(mnit_display, mnit_config, mnit_java_app->window, NULL);