Android的NDK多点触控?多点、触控、Android、NDK

2023-09-05 00:12:26 作者:回眸壹笑百妹瘋

我写仅使用本地code的应用程序。 那么,有可能得到的多点触控事件NDK? 我觉得香港专业教育学院serched整个网络,但没有发现任何东西!

im writing an application that uses only native code. So is it possible to get multitouch events in ndk? I feel like ive serched the whole web, but without finding anything!

有谁知道如何做到这一点?

Does anyone know how to do this?

推荐答案

是的,确实如此。 您可以检查例如名为天然活性来看看如何将输入事件。查找 engine_handle_input 功能。 AInputEvent_getType 函数返回事件的类型。如果是 AINPUT_EVENT_TYPE_MOTION 然后用 AKeyEvent_getAction 功能,您可以获取有关触摸事件的不同信息。使用 AMOTION_EVENT_ACTION_MASK AMOTION_EVENT_ACTION_POINTER_INDEX_MASK AMOTION_EVENT_ACTION_POINTER_DOWN AMOTION_EVENT_ACTION_POINTER_UP 在您使用它们的Java API相同的方式枚举:http://android-developers.blogspot.com/2010/06/making-sense-of-multitouch.html

Yes, it is. You can check example called native-activity to see how to get input events. Look for engine_handle_input function. AInputEvent_getType function returns type of event. If it is AINPUT_EVENT_TYPE_MOTION then using AKeyEvent_getAction function you can get different information about touch event. Use the AMOTION_EVENT_ACTION_MASK, AMOTION_EVENT_ACTION_POINTER_INDEX_MASK, AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP enums in same way you use them in Java API: http://android-developers.blogspot.com/2010/06/making-sense-of-multitouch.html