本文整理汇总了C++中Director::input方法的典型用法代码示例。如果您正苦于以下问题:C++ Director::input方法的具体用法?C++ Director::input怎么用?C++ Director::input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Director
的用法示例。
在下文中一共展示了Director::input方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: android_handle_motion
int32_t android_handle_motion(struct android_app* app, AInputEvent* event)
{
Director* director = static_cast<AInstance*>(app->userData)->director.get();
switch (AMotionEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK)
{
case AMOTION_EVENT_ACTION_DOWN:
case AMOTION_EVENT_ACTION_POINTER_DOWN: {
const int32_t index = (AMotionEvent_getAction(event) &
AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >>
AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
Pointer p = get_pointer_event(event, index);
director->input().on_pointer_began(ArrayView<Pointer>(p));
break;
}
case AMOTION_EVENT_ACTION_UP:
case AMOTION_EVENT_ACTION_POINTER_UP: {
const int32_t index = (AMotionEvent_getAction(event) &
AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >>
AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
Pointer p = get_pointer_event(event, index);
director->input().on_pointer_ended(ArrayView<Pointer>(p));
break;
}
case AMOTION_EVENT_ACTION_MOVE: {
const size_t count = AMotionEvent_getPointerCount(event);
auto pointers = std::make_unique<Pointer[]>(count);
for (size_t i = 0; i < count; ++i)
pointers[i] = get_pointer_event(event, i);
director->input().on_pointer_moved(
ArrayView<Pointer>(pointers.get(), count));
break;
}
case AMOTION_EVENT_ACTION_CANCEL:
case AMOTION_EVENT_ACTION_OUTSIDE:
director->input().on_pointer_canceled();
break;
default:
break;
}
return 1;
}