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


C++ Pnt2f::dist2方法代码示例

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


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

示例1: validateClickCount

void WindowEventProducer::validateClickCount(const MouseEventDetails::MouseButton& Button, const Time& TimeStamp, const Pnt2f& Location)
{
   //Get the vector of Clicks for this Button
   ClickVector& TheClickVector( _ButtonClickCountMap[Button] );
   //If the vector not empty
   if(TheClickVector.size() > 0) 
   {
      //Check if the timestamp for this click is less than the default multiple click Rate
      //Check if the Location of the click is greater then the default allowance away from the last click location
      if((TimeStamp - TheClickVector.back()._TimeStamp) > InputSettings::the()->getMultipleClickRate() ||
         Location.dist2(TheClickVector.back()._Location) > (InputSettings::the()->getMultipleClickMouseDriftAllowance() * InputSettings::the()->getMultipleClickMouseDriftAllowance()) )
      {
         //If so then clear the deque
         TheClickVector.clear();
      }
   }
}
开发者ID:ahuballah,项目名称:OpenSGToolbox,代码行数:17,代码来源:OSGWindowEventProducer.cpp

示例2: produceMouseReleased

void WindowEventProducer::produceMouseReleased(const MouseEventDetails::MouseButton& Button, const Pnt2f& Location)
{
    //Check if Input is blocked
    if(_BlockInput) { return; }

	TimeStamp t(getSystemTime());
	validateClickCount(Button, t, Location);
    Pnt2f ViewportLocation;
    Real32 DriftAllowance(InputSettings::the()->getMultipleClickMouseDriftAllowance());
    if(Location.dist2(_ButtonClickMap[Button]) <= (DriftAllowance * DriftAllowance))
    {
        produceMouseClicked(Button, Location);
    }
    ViewportUnrecPtr ResultViewport;
    ResultViewport = windowToViewport(Location, ViewportLocation);
    if(ResultViewport != NULL)
    {
        MouseEventDetailsUnrecPtr Details = MouseEventDetails::create(this, t, Button, _ButtonClickCountMap[Button].size(), ViewportLocation, ResultViewport );

        WindowEventProducerBase::produceMouseReleased(Details);
    }
}
开发者ID:ahuballah,项目名称:OpenSGToolbox,代码行数:22,代码来源:OSGWindowEventProducer.cpp


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