Пример #1
0
HookGui::HGWidget* HookGui::HGWidget::FindPointTarget(HookGui::Point _point)
{
    // First check if the point is inside this widget
    if(!m_CurrentFrame.PointIsInside(_point.x, _point.y))
    {
        return nullptr;
    }
    
    // Set the current widget
    HookGui::HGWidget* currentWidget = this;
    
    // Go until we break
    while(true)
    {
        // Set target found to false
        bool targetFound = false;
        
        // For each child
        for(auto child : currentWidget->m_Childs)
        {
            // Check if this child contains the point
            if(ContainPoint(_point))
            {
                // Set the new current widget
                currentWidget = child;
                
                // Set target found
                targetFound = true;
                
                break;
            }
        }
        
        // Check if we found a target this round
        if(targetFound)
        {
            // Ok we need to check the current view childs
            continue;
        }
        else
        {
            // We can return the current widget without problems
            break;
        }
    }
    
    return currentWidget;
}
Пример #2
0
bool Cuboid2D<T>::ContainPoint(
    T xPosition
  , T yPosition
  , gsl::index& rXIndex
  , gsl::index& rYIndex
  , std::size_t overlap/*=0*/) const
{
  if (ContainPoint(xPosition, yPosition, overlap)) {
    rXIndex = static_cast<gsl::index>(floor((xPosition - mXPosition +
        static_cast<T>(overlap) * mDeltaR) / mDeltaR + 0.5));
    rYIndex = static_cast<gsl::index>(floor((yPosition - mYPosition +
        static_cast<T>(overlap) * mDeltaR) / mDeltaR + 0.5));
    return true;
  }
  else {
    return false;
  }
}