/** * This is the main entry point of a native application that is using * android_native_app_glue. It runs in its own thread, with its own * event loop for receiving input events and doing other things. */ void android_main(struct android_app* state) { VulkanExample *engine = new VulkanExample(); state->userData = engine; state->onAppCmd = handleCommand; state->onInputEvent = handleInput; engine->app = state; engine->animating = 1; // loop waiting for stuff to do. while (1) { // Read all pending events. int ident; int events; struct android_poll_source* source; while ((ident = ALooper_pollAll(engine->animating ? 0 : -1, NULL, &events, (void**)&source)) >= 0) { if (source != NULL) { source->process(state, source); } if (state->destroyRequested != 0) { engine->cleanupVulkan(); return; } } engine->render(); } }