* Process user touch and key events. GameActivity double buffers those events, * applications can process at any time. All of the buffered events have been * reported "handled" to OS. For details, refer to: * d.android.com/games/agdk/game-activity/get-started#handle-events */
| 103 | * d.android.com/games/agdk/game-activity/get-started#handle-events |
| 104 | */ |
| 105 | static void HandleInputEvents(struct android_app* app) { |
| 106 | auto inputBuf = android_app_swap_input_buffers(app); |
| 107 | if (inputBuf == nullptr) { |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | // For the minimum, apps need to process the exit event (for example, |
| 112 | // listening to AKEYCODE_BACK). This sample has done that in the Kotlin side |
| 113 | // and not processing other input events, we just reset the event counter |
| 114 | // inside the android_input_buffer to keep app glue code in a working state. |
| 115 | android_app_clear_motion_events(inputBuf); |
| 116 | android_app_clear_motion_events(inputBuf); |
| 117 | } |
| 118 | |
| 119 | /* |
| 120 | * Entry point required by the Android Glue library. |