* Entry point required by the Android Glue library. * This can also be achieved more verbosely by manually declaring JNI functions * and calling them from the Android application layer. */
| 122 | * and calling them from the Android application layer. |
| 123 | */ |
| 124 | void android_main(struct android_app* state) { |
| 125 | VulkanEngine engine{}; |
| 126 | vkt::HelloVK vulkanBackend{}; |
| 127 | |
| 128 | engine.app = state; |
| 129 | engine.app_backend = &vulkanBackend; |
| 130 | state->userData = &engine; |
| 131 | state->onAppCmd = HandleCmd; |
| 132 | |
| 133 | android_app_set_key_event_filter(state, VulkanKeyEventFilter); |
| 134 | android_app_set_motion_event_filter(state, VulkanMotionEventFilter); |
| 135 | |
| 136 | while (!state->destroyRequested) { |
| 137 | android_poll_source* source; |
| 138 | auto result = ALooper_pollOnce(engine.canRender ? 0 : -1, nullptr, nullptr, |
| 139 | (void**)&source); |
| 140 | if (result == ALOOPER_POLL_ERROR) { |
| 141 | LOGE("ALooper_pollOnce returned an error"); |
| 142 | std::abort(); |
| 143 | } |
| 144 | |
| 145 | if (source != nullptr) { |
| 146 | source->process(state, source); |
| 147 | } |
| 148 | |
| 149 | HandleInputEvents(state); |
| 150 | |
| 151 | if (engine.canRender) { |
| 152 | engine.app_backend->render(); |
| 153 | } |
| 154 | } |
| 155 | } |
nothing calls this directly
no test coverage detected