本文整理汇总了C++中leap::Pointable::id方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointable::id方法的具体用法?C++ Pointable::id怎么用?C++ Pointable::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leap::Pointable
的用法示例。
在下文中一共展示了Pointable::id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pointable_id
static VALUE pointable_id(VALUE self)
{
Leap::Pointable * pointer;
const char * string;
Data_Get_Struct(self, Leap::Pointable, pointer);
return INT2NUM(pointer->id());
}
示例2: onFrame
void DefaultQtLeapMouseHandler::onFrame(const Leap::Frame &frame)
{
/////// MOUSE EVENTS /////////
// MOUSE BUTTON PRESSED
// MOUSE BUTTON RELEASED
// MOUSE MOVE
if (this->listeners.empty())
return ;
Leap::Pointable pointer = frame.pointable(this->savedMousePointableId);
if (!pointer.isValid())
{
pointer = frame.pointables().frontmost();
this->savedMousePointableId = pointer.id();
}
bool forceRelease = (frame.pointables().count() == 0 && this->mousePressed);
QMouseEvent::Type frameMouseEvent = QMouseEvent::None;
QPointF globalPointerPos = QtLeapUtils::convertPointablePosToScreenPos(frame.interactionBox(), pointer);
Qt::MouseButton button = Qt::NoButton;
Qt::MouseButtons buttons = Qt::NoButton;
// FINGER TOUCHING AND NO PREVIOUS PRESS -> SETTING BUTTON PRESS
if (pointer.touchDistance() <= 0 &&
pointer.touchZone() == Leap::Pointable::ZONE_TOUCHING &&
!this->mousePressed)
{
this->mousePressed = true;
frameMouseEvent = QMouseEvent::MouseButtonPress;
button = Qt::LeftButton;
}
else if (this->mousePressed && (pointer.touchDistance() > 0 ||
pointer.touchZone() == Leap::Pointable::ZONE_NONE ||
forceRelease)) // FINGER NOT TOUCHING AND PREVIOUS PRESS -> RELEASING BUTTON PRESS
{
frameMouseEvent = QMouseEvent::MouseButtonRelease;
this->mousePressed = false;
button = Qt::LeftButton;
}
else if (frameMouseEvent == QMouseEvent::None && // FINGER IN TOUCHING OR HOVERING ZONE AND NO BUTTON PRESS / RELEASE CHANGE -> MouseMove
pointer.touchZone() != Leap::Pointable::ZONE_NONE
&& globalPointerPos.toPoint() != this->previousPos)
{
frameMouseEvent = QMouseEvent::MouseMove;
this->previousPos = globalPointerPos.toPoint();
QCursor::setPos(this->previousPos);
}
if (this->mousePressed)
buttons |= Qt::LeftButton;
if (frameMouseEvent != QMouseEvent::None)
foreach (QObject *listener, this->listeners)
QCoreApplication::postEvent(listener, new QMouseEvent(frameMouseEvent,
QtLeapUtils::convertGlobalPosToLocalPos(listener, globalPointerPos),
globalPointerPos,
button,
buttons,
Qt::NoModifier));
}