当前位置: 首页>>代码示例>>C++>>正文


C++ TrackedButtonInteractionEvent::asPointerEvent方法代码示例

本文整理汇总了C++中TrackedButtonInteractionEvent::asPointerEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackedButtonInteractionEvent::asPointerEvent方法的具体用法?C++ TrackedButtonInteractionEvent::asPointerEvent怎么用?C++ TrackedButtonInteractionEvent::asPointerEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TrackedButtonInteractionEvent的用法示例。


在下文中一共展示了TrackedButtonInteractionEvent::asPointerEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processEvent


//.........这里部分代码省略.........
		    {
			newValue = pow(mrv->getLogBase(),current + change);
			newValue = std::min(newValue, mrv->getMax());
		    }
		    else
		    {
			newValue = std::min(mrv->getValue() + change,
                            mrv->getMax());
		    }
                    mrv->setValue(newValue);
                    valueUpdated = true;
                }
            }

            if(valueUpdated)
            {
                if(mrv->getCallback())
                {
                    mrv->getCallback()->menuCallback(_item, event->asHandEvent() ? event->asHandEvent()->getHand() : 0);
                }
            }

            _lastMouseY = y;
            _lastMouseX = x;
            return;
        }
    }
    else if(event->asTrackedButtonEvent())
    {
        TrackedButtonInteractionEvent * tie = event->asTrackedButtonEvent();
        if(event->getInteraction() == BUTTON_DOWN
                || event->getInteraction() == BUTTON_DOUBLE_CLICK)
        {
	    if(event->asPointerEvent())
	    {
		SceneManager::instance()->getPointOnTiledWall(tie->getTransform(),_point);
	    }
	    else
	    {
		_point = tie->getTransform().getTrans();
		osg::Vec3 forward = osg::Vec3(0,1.0,0) * tie->getTransform();
		forward = forward - _point;
		_normal = forward ^ osg::Vec3(0,0,1.0);
		_normal.normalize();
	    }
            _lastDistance = 0.0;
            return;
        }
        if(event->getInteraction() == BUTTON_DRAG
                || event->getInteraction() == BUTTON_UP)
        {
            MenuRangeValueCompact * mrv = (MenuRangeValueCompact*)_item;

	    float min,max,current;

	    if(mrv->getIsLog())
	    {
		min = log(mrv->getMin()) / log(mrv->getLogBase());
		max = log(mrv->getMax()) / log(mrv->getLogBase());
		current = log(mrv->getValue()) / log(mrv->getLogBase());
	    }
	    else
	    {
		min = mrv->getMin();
		max = mrv->getMax();
		current = mrv->getValue();
开发者ID:cnea,项目名称:calvr,代码行数:67,代码来源:BoardMenuRangeValueCompactGeometry.cpp

示例2: processEvent

bool BoardPopupMenu::processEvent(InteractionEvent * event)
{
    if(!_menuActive || !_myMenu || !event->asTrackedButtonEvent())
    {
        return false;
    }

    TrackedButtonInteractionEvent * tie = event->asTrackedButtonEvent();

    if(_clickActive)
    {
        if(tie->getHand() == _activeHand)
        {
            if(tie->getInteraction() == BUTTON_DRAG
                    || tie->getInteraction() == BUTTON_UP)
            {
                if(tie->getButton() == _primaryButton)
                {
                    BoardMenuSubMenuGeometry * smg =
                            dynamic_cast<BoardMenuSubMenuGeometry *>(_activeItem);
                    if(smg && smg->isMenuHead())
                    {
                        updateMovement(tie);
                    }

                    _activeItem->processEvent(event);
                    if(tie->getInteraction() == BUTTON_UP)
                    {
                        _clickActive = false;
                    }
                    return true;
                }
            }
        }
        return false;
    }
    else if(tie->getHand() == _activeHand && tie->getButton() == _primaryButton)
    {
        if(tie->getInteraction() == BUTTON_DOWN
                || tie->getInteraction() == BUTTON_DOUBLE_CLICK)
        {
            if(_activeItem)
            {
                BoardMenuSubMenuGeometry * smg =
                        dynamic_cast<BoardMenuSubMenuGeometry *>(_activeItem);
                if(smg && smg->isMenuHead())
                {
                    osg::Vec3 ray;
                    ray = _currentPoint[tie->getHand()]
                            - tie->getTransform().getTrans();

		    if(!tie->asPointerEvent())
		    {
			_moveDistance = ray.length();
		    }
		    else
		    {
			_moveDistance = ray.y();
		    }
                    _menuPoint = _currentPoint[tie->getHand()]
                            * osg::Matrix::inverse(_menuRoot->getMatrix());
                    updateMovement(tie);
                }
                else if(smg && !smg->isMenuHead())
                {
                    if(smg->isMenuOpen())
                    {
                        closeMenu((SubMenu*)smg->getMenuItem());
                    }
                    else
                    {
                        openMenu(smg);
                    }
                }
		_clickActive = true;
                _activeItem->processEvent(event);
                return true;
            }

            return false;
        }
    }

    return false;
}
开发者ID:TheNumenorean,项目名称:calvr,代码行数:85,代码来源:BoardPopupMenu.cpp


注:本文中的TrackedButtonInteractionEvent::asPointerEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。