本文整理汇总了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();
}
}
}
示例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);
}
}