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


C++ CAView::convertRectToWorldSpace方法代码示例

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


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

示例1: passingTouchesViews

void CATouchController::passingTouchesViews(float dt)
{
    CAView* view = dynamic_cast<CAView*>(CAApplication::getApplication()->getTouchDispatcher()->getFirstResponder());
    bool isContainsFirstPoint = view && view->convertRectToWorldSpace(view->getBounds()).containsPoint(m_tFirstPoint);
    if (!isContainsFirstPoint && view)
    {
        view->ccTouchBegan(m_pTouch, m_pEvent);
    }
    
    CC_RETURN_IF(m_vTouchesViews.empty());

    CAResponder* responder = m_vTouchesViews.front();
    while (responder->nextResponder())
    {
        m_vTouchesViews.pushBack(responder->nextResponder());
        responder = responder->nextResponder();
    }
    
    for (int i=0; i<m_vTouchesViews.size();)
    {
        if (!m_vTouchesViews.at(i)->ccTouchBegan(m_pTouch, m_pEvent))
        {
            m_vTouchesViews.erase(i);
        }
        else
        {
            i++;
        }
    }
}
开发者ID:zhaojietong,项目名称:CrossApp,代码行数:30,代码来源:CATouchDispatcher.cpp

示例2: touchCancelled

void CATouchController::touchCancelled()
{
    CAScheduler::unschedule(schedule_selector(CATouchController::passingTouchesViews), this);
    
    CAView* view = dynamic_cast<CAView*>(CAApplication::getApplication()->getTouchDispatcher()->getFirstResponder());
    bool isContainsFirstPoint = view && view->convertRectToWorldSpace(view->getBounds()).containsPoint(m_tFirstPoint);
    if (!isContainsFirstPoint && view)
    {
        view->ccTouchCancelled(m_pTouch, m_pEvent);
    }
    
    CAVector<CAResponder*>::iterator itr;
    for (itr=m_vTouchesViews.begin(); itr!=m_vTouchesViews.end(); itr++)
    {
        (*itr)->ccTouchCancelled(m_pTouch, m_pEvent);
    }
}
开发者ID:zhaojietong,项目名称:CrossApp,代码行数:17,代码来源:CATouchDispatcher.cpp

示例3: touchBegan

void CATouchController::touchBegan()
{
    m_tFirstPoint = m_pTouch->getLocation();
    
    std::vector<CAResponder*> vector;
    
    CAView* view = dynamic_cast<CAView*>(CAApplication::getApplication()->getTouchDispatcher()->getFirstResponder());
    bool isContainsFirstPoint = view && view->convertRectToWorldSpace(view->getBounds()).containsPoint(m_tFirstPoint);
    if (isContainsFirstPoint)
    {
        vector = this->getEventListener(m_pTouch, view);
    }
    else
    {
        vector = this->getEventListener(m_pTouch, CAApplication::getApplication()->getRootWindow());
    }

    std::vector<CAResponder*>::iterator itr;
    for (itr=vector.begin(); itr!=vector.end(); itr++)
    {
        if ((*itr)->isTouchMovedStopSubviews())
        {
            m_vTouchMovedsViewCache.pushBack((*itr));
        }
    }
    m_vTouchesViews.pushBack(vector.back());
    
    if (!m_vTouchMovedsViewCache.empty())
    {
        CAScheduler::schedule(schedule_selector(CATouchController::passingTouchesViews), this, 0, 0, 0.05f);
    }
    else
    {
        this->passingTouchesViews();
    }
}
开发者ID:zhaojietong,项目名称:CrossApp,代码行数:36,代码来源:CATouchDispatcher.cpp

示例4: touchMoved


//.........这里部分代码省略.........
            while (0);
            
            m_vTouchMovedsViewCache.popBack();
        }
        
        
        CAVector<CAResponder * > tTouchesViews = m_vTouchesViews;
        if (!m_vTouchMovedsView.empty())
        {
            if (!isScheduledPassing)
            {
                
                CAVector<CAResponder*>::iterator itr;
                //
                for (itr = m_vTouchMovedsView.begin(); itr != m_vTouchMovedsView.end(); itr++)
                {
                    m_vTouchesViews.eraseObject(*itr, true);
                }
                //
                
                for (itr=m_vTouchesViews.begin(); itr!=m_vTouchesViews.end(); itr++)
                {
                    (*itr)->ccTouchCancelled(m_pTouch, m_pEvent);
                }
            }
            
            {
                m_vTouchesViews.clear();
                
                for (int i=0; i<m_vTouchMovedsView.size(); i++)
                {
                    CAResponder* responder = m_vTouchMovedsView.at(i);
                    CCPoint pointOffSet = CCPointZero;
                    if (CAView* v = dynamic_cast<CAView*>(responder))
                    {
                        pointOffSet = ccpSub(v->convertToNodeSpace(m_pTouch->getLocation()),
                                             v->convertToNodeSpace(m_pTouch->getPreviousLocation()));
                    }
                    else if (CAViewController* c = dynamic_cast<CAViewController*>(responder))
                    {
                        pointOffSet = ccpSub(c->getView()->convertToNodeSpace(m_pTouch->getLocation()),
                                             c->getView()->convertToNodeSpace(m_pTouch->getPreviousLocation()));
                    }
                    else
                    {
                        pointOffSet = ccpSub(m_pTouch->getLocation(), m_pTouch->getPreviousLocation());
                    }
                    
                    if (responder->isTouchMovedListenHorizontal()
                        && fabsf(pointOffSet.x) >= fabsf(pointOffSet.y))
                    {
                        CC_CONTINUE_IF(responder->isSlidingMinX() && pointOffSet.x > 0);
                        CC_CONTINUE_IF(responder->isSlidingMaxX() && pointOffSet.x < 0);
                    }
                    
                    if (responder->isTouchMovedListenVertical()
                        && fabsf(pointOffSet.x) < fabsf(pointOffSet.y))
                    {
                        CC_CONTINUE_IF(responder->isSlidingMinY() && pointOffSet.y > 0);
                        CC_CONTINUE_IF(responder->isSlidingMaxY() && pointOffSet.y < 0);
                    }
                    
                    m_vTouchesViews.pushBack(responder);
                    
                    
                    if (tTouchesViews.contains(responder)==false)
                    {
                        responder->ccTouchBegan(m_pTouch, m_pEvent);
                    }
                    break;
                }
                
                if (m_vTouchesViews.empty())
                {
                    m_vTouchesViews.pushBack(m_vTouchMovedsView.front());
                    if (tTouchesViews.contains(m_vTouchesViews.back())==false)
                    {
                        m_vTouchesViews.back()->ccTouchBegan(m_pTouch, m_pEvent);//
                    }
                    
                }
            }
        }
        
    }
    
    CAView* view = dynamic_cast<CAView*>(CAApplication::getApplication()->getTouchDispatcher()->getFirstResponder());
    bool isContainsFirstPoint = view && view->convertRectToWorldSpace(view->getBounds()).containsPoint(m_tFirstPoint);
    if (!isContainsFirstPoint && view)
    {
        view->ccTouchMoved(m_pTouch, m_pEvent);
    }
    
    CAVector<CAResponder*>::iterator itr;
    for (itr=m_vTouchesViews.begin(); itr!=m_vTouchesViews.end(); itr++)
    {
        (*itr)->ccTouchMoved(m_pTouch, m_pEvent);
    }
    
}
开发者ID:zhaojietong,项目名称:CrossApp,代码行数:101,代码来源:CATouchDispatcher.cpp

示例5: touchMoved


//.........这里部分代码省略.........
                                isTouchCancelled = false;
                                break;
                            }
                        }
                    }
                }
                
                if (isTouchCancelled)
                {
                    if (!isScheduledPassing)
                    {
                        CAVector<CAResponder*>::iterator itr;
                        for (itr=m_vTouchesViews.begin(); itr!=m_vTouchesViews.end(); itr++)
                        {
                            this->touchCancelledWithResponder(*itr);
                        }
                    }
                    m_vTouchesViews.clear();
                }
                
                if (isScheduledPassing || m_vTouchesViews.empty())
                {
                    for (int i=0; i<m_vTouchMovedsView.size(); i++)
                    {
                        CAResponder* responder = m_vTouchMovedsView.at(i);
                        DPoint pointOffSet = DPointZero;
                        if (CAView* v = dynamic_cast<CAView*>(responder))
                        {
                            pointOffSet = ccpSub(v->convertToNodeSpace(m_pTouch->getLocation()),
                                                 v->convertToNodeSpace(m_pTouch->getPreviousLocation()));
                        }
                        else if (CAViewController* c = dynamic_cast<CAViewController*>(responder))
                        {
                            pointOffSet = ccpSub(c->getView()->convertToNodeSpace(m_pTouch->getLocation()),
                                                 c->getView()->convertToNodeSpace(m_pTouch->getPreviousLocation()));
                        }
                        else
                        {
                            pointOffSet = ccpSub(m_pTouch->getLocation(), m_pTouch->getPreviousLocation());
                        }
                        
                        if (responder->isReachBoundaryHandOverToSuperview())
                        {
                            if (responder->isHorizontalScrollEnabled()
                                && fabsf(pointOffSet.x) >= fabsf(pointOffSet.y))
                            {
                                CC_CONTINUE_IF(responder->isReachBoundaryLeft() && pointOffSet.x > 0);
                                CC_CONTINUE_IF(responder->isReachBoundaryRight() && pointOffSet.x < 0);
                            }
                            else if (responder->isVerticalScrollEnabled()
                                     && fabsf(pointOffSet.x) < fabsf(pointOffSet.y))
                            {
                                CC_CONTINUE_IF(responder->isReachBoundaryUp() && pointOffSet.y > 0);
                                CC_CONTINUE_IF(responder->isReachBoundaryDown() && pointOffSet.y < 0);
                            }
                        }

                        if (this->touchBeganWithResponder(responder))
                        {
                            m_vTouchesViews.pushBack(responder);
                        }
                        
                        break;
                    }
                    
                    if (m_vTouchesViews.empty())
                    {
                        m_vTouchesViews.pushBack(m_vTouchMovedsView.front());
                        
                        while (m_vTouchesViews.back())
                        {
                            if (this->touchBeganWithResponder(m_vTouchesViews.back()))
                            {
                                break;
                            }
                            m_vTouchesViews.popBack();
                        }
                        
                    }
                }
            }
        }

    }

    CAView* view = dynamic_cast<CAView*>(CAApplication::getApplication()->getTouchDispatcher()->getFirstResponder());
    bool isContainsFirstPoint = view && view->convertRectToWorldSpace(view->getBounds()).containsPoint(m_tFirstPoint);
    if (!isContainsFirstPoint && view && view->isScrollEnabled())
    {
        this->touchMovedWithResponder(view);
    }
    
    CAVector<CAResponder*>::iterator itr;
    for (itr=m_vTouchesViews.begin(); itr!=m_vTouchesViews.end(); itr++)
    {
        CC_CONTINUE_IF(!(*itr)->isScrollEnabled());
        this->touchMovedWithResponder(*itr);
    }
    
}
开发者ID:wjm0729,项目名称:CrossApp,代码行数:101,代码来源:CATouchDispatcher.cpp


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