MCPcopy Create free account
hub / github.com/android/ndk-samples / HandleInputEvents

Function HandleInputEvents

hello-vulkan/app/src/main/cpp/vk_main.cpp:105–117  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

103 * d.android.com/games/agdk/game-activity/get-started#handle-events
104 */
105static 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.

Callers 1

android_mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected