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


C++ DPoint::equals方法代码示例

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


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

示例1: isScrollWindowNotOutSide

bool CAScrollView::isScrollWindowNotOutSide()
{
    DPoint point = m_pContainer->getFrameOrigin();
    this->getScrollWindowNotOutPoint(point);
    
    return !point.equals(m_pContainer->getFrameOrigin());
}
开发者ID:wjm0729,项目名称:CrossApp,代码行数:7,代码来源:CAScrollView.cpp

示例2: setAnchorPointInPoints

void CAView::setAnchorPointInPoints(const DPoint& anchorPointInPoints)
{
    if( ! anchorPointInPoints.equals(m_obAnchorPointInPoints))
    {
        DPoint p;
        if (m_bFrame)
        {
            p = this->getFrameOrigin();
        }
        else
        {
            p = this->getCenterOrigin();
        }
        
        m_obAnchorPointInPoints = anchorPointInPoints;
        m_obAnchorPoint = DPoint(m_obAnchorPointInPoints.x / m_obContentSize.width,
                              m_obAnchorPointInPoints.y / m_obContentSize.height);
        
        if (m_bFrame)
        {
            this->setFrameOrigin(p);
        }
        else
        {
            this->setCenterOrigin(p);
        }
        
        this->updateDraw();
    }
}
开发者ID:DreamCastleShanghai,项目名称:dkomClient,代码行数:30,代码来源:CAView.cpp

示例3: setAnchorPoint

void CAView::setAnchorPoint(const DPoint& point)
{
    if( ! point.equals(m_obAnchorPoint))
    {
        DPoint p;
        if (m_bFrame)
        {
            p = this->getFrameOrigin();
        }
        else
        {
            p = this->getCenterOrigin();
        }
        
        
        m_obAnchorPoint = point;
        m_obAnchorPointInPoints = ccp(m_obContentSize.width * m_obAnchorPoint.x,
                                      m_obContentSize.height * m_obAnchorPoint.y );
      
        if (m_bFrame)
        {
            this->setFrameOrigin(p);
        }
        else
        {
            this->setCenterOrigin(p);
        }
        
        this->updateDraw();
    }
}
开发者ID:DreamCastleShanghai,项目名称:dkomClient,代码行数:31,代码来源:CAView.cpp

示例4: deaccelerateScrolling

void CAScrollView::deaccelerateScrolling(float dt)
{
    dt = MIN(dt, 1/30.0f);
    dt = MAX(dt, 1/100.0f);

    if (m_tInertia.getLength() > maxSpeedCache(dt))
    {
        m_tInertia = ccpMult(m_tInertia, maxSpeedCache(dt) / m_tInertia.getLength());
    }
    
    DPoint speed = DPointZero;
    if (m_tInertia.getLength() > maxSpeed(dt))
    {
        speed = ccpMult(m_tInertia, maxSpeed(dt) / m_tInertia.getLength());
    }
    else
    {
        speed = m_tInertia;
    }
    
    DPoint point = m_pContainer->getFrameOrigin();

    if (m_bBounces)
    {
        DPoint resilience = DPointZero;
        DSize size = this->getBounds().size;
        DPoint curr_point = m_pContainer->getFrameOrigin();
        DPoint relust_point = curr_point;
        this->getScrollWindowNotOutPoint(relust_point);
        float off_x = relust_point.x - curr_point.x;
        float off_y = relust_point.y - curr_point.y;
        
        if (fabsf(off_x) > FLT_EPSILON)
        {
            resilience.x = off_x / size.width;
        }
        
        if (fabsf(off_y) > FLT_EPSILON)
        {
            resilience.y = off_y / size.height;
        }
        
        resilience = ccpMult(resilience, maxSpeed(dt));
        
        if (speed.getLength() < resilience.getLength())
        {
            speed = resilience;
            m_tInertia = DPointZero;
        }
    }
    
    if (speed.getLength() < 0.25f)
    {
        m_tInertia = DPointZero;
        this->getScrollWindowNotOutPoint(point);
        this->setContainerFrame(point);
        this->update(0);
        this->hideIndicator();
        this->stopDeaccelerateScroll();
        
        if (m_pScrollViewDelegate)
        {
            m_pScrollViewDelegate->scrollViewStopMoved(this);
        }
        
    }
    else
    {
        point = ccpAdd(point, speed);

        if (this->isScrollWindowNotMaxOutSide(point))
        {
            m_tInertia = DPointZero;
        }
        
        if (m_bBounces == false)
        {
            this->getScrollWindowNotOutPoint(point);
        }
        else
        {
            if (m_bBounceHorizontal == false)
            {
                point.x = this->getScrollWindowNotOutHorizontal(point.x);
            }
            
            if (m_bBounceVertical == false)
            {
                point.y = this->getScrollWindowNotOutVertical(point.y);
            }
        }

        if (point.equals(m_pContainer->getFrameOrigin()))
        {
            m_tInertia = DPointZero;
        }
        else
        {
            this->showIndicator();
            this->setContainerFrame(point);
//.........这里部分代码省略.........
开发者ID:wjm0729,项目名称:CrossApp,代码行数:101,代码来源:CAScrollView.cpp

示例5: nodeToParentTransform

CATransformation CAView::nodeToParentTransform(void)
{
    if (m_bTransformDirty)
    {
        
        // Translate values
        float height = 0;
        
        if (this->getSuperview())
        {
            height= this->getSuperview()->getBounds().size.height;
        }
        else
        {
            height= CAApplication::getApplication()->getWinSize().height;
        }
        
        
        float x = m_obPoint.x;
        float y = height - m_obPoint.y;
        
        // Rotation values
		// Change rotation code to handle X and Y
		// If we skew with the exact same value for both x and y then we're simply just rotating
        float cx = 1, sx = 0, cy = 1, sy = 0;
        if (m_fRotationX || m_fRotationY)
        {
            float radiansX = -CC_DEGREES_TO_RADIANS(m_fRotationX);
            float radiansY = -CC_DEGREES_TO_RADIANS(m_fRotationY);
            cx = cosf(radiansX);
            sx = sinf(radiansX);
            cy = cosf(radiansY);
            sy = sinf(radiansY);
        }
        
        bool needsSkewMatrix = ( m_fSkewX || m_fSkewY );
        
        
        // optimization:
        // inline anchor point calculation if skew is not needed
        // Adjusted transform calculation for rotational skew
        DPoint anchorPointInPoints = DPoint(m_obAnchorPointInPoints.x,
                                              m_obContentSize.height - m_obAnchorPointInPoints.y);
        
        if (! needsSkewMatrix && !anchorPointInPoints.equals(DPointZero))
        {
            x += cy * -anchorPointInPoints.x * m_fScaleX + -sx * -anchorPointInPoints.y * m_fScaleY;
            y += sy * -anchorPointInPoints.x * m_fScaleX +  cx * -anchorPointInPoints.y * m_fScaleY;
        }
        
        // Build Transform Matrix
        // Adjusted transform calculation for rotational skew
        m_sTransform = CATransformationMake(cy * m_fScaleX,
                                            sy * m_fScaleX,
                                            -sx * m_fScaleY,
                                            cx * m_fScaleY,
                                            x,
                                            y );
        
        // XXX: Try to inline skew
        // If skew is needed, apply skew and then anchor point
        if (needsSkewMatrix)
        {
            CATransformation skewMatrix = CATransformationMake(1.0f,
                                                               tanf(CC_DEGREES_TO_RADIANS(m_fSkewY)),
                                                               tanf(CC_DEGREES_TO_RADIANS(m_fSkewX)),
                                                               1.0f,
                                                               0.0f,
                                                               0.0f );
            
            m_sTransform = CATransformationConcat(skewMatrix, m_sTransform);
            
            // adjust anchor point
            DPoint anchorPointInPoints = DPoint(m_obAnchorPointInPoints.x,
                                                  m_obContentSize.height - m_obAnchorPointInPoints.y);
            
            if (!anchorPointInPoints.equals(DPointZero))
            {
                m_sTransform = CATransformationTranslate(m_sTransform,
                                                         -anchorPointInPoints.x,
                                                         -anchorPointInPoints.y);
            }
        }
        
        m_bTransformDirty = false;
    }
    return m_sTransform;
}
开发者ID:DreamCastleShanghai,项目名称:dkomClient,代码行数:88,代码来源:CAView.cpp


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