本文整理汇总了C++中CCNode::isVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ CCNode::isVisible方法的具体用法?C++ CCNode::isVisible怎么用?C++ CCNode::isVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCNode
的用法示例。
在下文中一共展示了CCNode::isVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setADVisible
void IOSStoreLayer::setADVisible(bool e, bool bRemove /* = false*/)
{
if (!m_pBg)
{
return;
}
CCNode* pnode = m_pBg->getChildByTag(ad_tip_string_tag);
if (pnode && pnode->isVisible() != e)
{
pnode->setVisible(e);
if (bRemove)
{
pnode->removeFromParent();
}
}
pnode = m_pBg->getChildByTag(ad_tip_bg_tag);
if (pnode && pnode->isVisible() != e)
{
pnode->setVisible(e);
if (bRemove)
{
pnode->removeFromParent();
}
}
}
示例2: showMessage
void HeadUpDisplay::showMessage(){
/* A visible MenuItem is enabled as a button, so in order to no repeat
* the action of this method, we check if the accept button was enabled. */
CCNode* acceptButton = this->getChildByTag(_acceptButtonTag);
if(acceptButton->isVisible())
return;
/* Applying animation to show message elements. */
acceptButton->setVisible(true);
CCNode* mesh = this->getChildByTag(_meshTag);
mesh->stopAllActions();
mesh->runAction(CCFadeTo::create(.25f, 255 * .5f));
CCNode* bubbleTalk = this->getChildByTag(_bubbleTalkTag);
bubbleTalk->stopAllActions();
bubbleTalk->runAction(
CCSequence::create(
CCScaleTo::create(.25f, 0.75f, 1.25f),
CCScaleTo::create(.25f, 1.00f, 1.00f),
NULL
)
);
CCNode* message = bubbleTalk->getChildByTag(_messageTag);
message->stopAllActions();
message->runAction(CCFadeTo::create(.5f, 255));
}
示例3: ccTouchBegan
bool CPullMachMenu::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
CC_UNUSED_PARAM(event);
if (m_eState != kCCMenuStateWaiting || ! m_bVisible || !isEnabled())
{
return false;
}
for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
{
if (c->isVisible() == false)
{
return false;
}
}
m_pSelectedItem = this->itemForTouchPM(touch);
if (m_pSelectedItem)
{
m_eState = kCCMenuStateTrackingTouch;
m_pSelectedItem->selected();
return true;
}
return false;
}
示例4: ccTouchBegan
bool CWidgetLayout::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
if( m_bTouchEnabled && m_bVisible && m_pChildren && m_pChildren->count() > 0 )
{
CCPoint touchPointInView = convertToNodeSpace(pTouch->getLocation());
if( m_pChildren && m_pChildren->count() > 0 )
{
CCObject* pObject = NULL;
CCARRAY_FOREACH_REVERSE( m_pChildren, pObject )
{
CCNode* pNode = dynamic_cast<CCNode*>(pObject);
CWidget* pWidget = dynamic_cast<CWidget*>(pObject);
if( pWidget && pNode->isVisible() && pWidget->isEnabled() && pWidget->isTouchEnabled() )
{
if( pNode->boundingBox().containsPoint(touchPointInView) )
{
if( pWidget->executeTouchBeganHandler(pTouch) != eWidgetTouchNone )
{
m_pSelectedWidget = pWidget;
m_bIsTouched = true;
m_fTouchedDuration = 0.0f;
return true;
}
}
}
}
示例5: updateScroll
void updateScroll(){
bool vBar = _scrollBar && _scrollBar->isVisible(),
vNode = _scrollNode && _scrollNode->isVisible();
if(!vBar || !vNode){
return;
}
bool vert = getDirection() == kCCScrollViewDirectionVertical;
CCPoint p, cp = getContentOffset();
CCSize vs = getViewSize(),
cs = getContentSize();
float rate = 1 - (vert? fabsf(cp.y) / (cs.height - vs.height) : fabsf(cp.x) / (cs.width - vs.width));
if(vBar){
CCSize ss = _scrollBar->getPreferredSize();
p = _scrollBar->getPosition();
if(vert){ p.y = cs.height - (cs.height - ss.height) * rate - ss.height - _scrollTrackDelta;
}else{ p.x = cs.width - (cs.width - ss.width) * rate - ss.width - _scrollTrackDelta;
}
_scrollBar->setPosition(p);
}
if(vNode){
p = _scrollNode->getPosition();
if(vert){ p.y = cp.y + vs.height * rate;
}else{ p.x = cp.x + vs.width * rate;
}
_scrollNode->setPosition(p);
}
if(_scrollTrack){
p = _scrollTrack->getPosition();
if(vert){ p.y = fabsf(cp.y);
}else{ p.x = fabsf(cp.x);
}
_scrollTrack->setPosition(p);
}
//CCLog("LuaTableView.updateScroll ss=%d,%d vh=%d cy=%d ch=%d y=%d", (int)ss.width, (int)ss.height, (int)vs.height, (int)p.y, (int)cs.height, (int)_scrollBar->getPositionY());
}
示例6: ccTouchBegan
bool MDragDownView::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
if (isVisible() == false)
{
return false;
}
for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
{
if (c->isVisible() == false)
{
return false;
}
}
updateRect();
m_touchBeginPosition = pTouch->getLocation();
if (m_viewRect.containsPoint(m_touchBeginPosition) == false)
{
return false;
}
if (m_eState != State::NONE)
{
return true;
}
m_isTouchDragBar = m_pDragBar ? m_dragBarRect.containsPoint(m_touchBeginPosition) : false;
m_viewOldSize = m_viewSize;
return true;
}
示例7: ccTouchBegan
bool NewMenuDevice::ccTouchBegan(cocos2d::CCTouch *touch, cocos2d::CCEvent *event) {
// CCPoint pouchT = map->transScreenToMap(ccp(pTouch->locationInView().x,pTouch->locationInView().y));
// CCPoint posiT = map->transMapToTiled(this->getPosition());
//
// CCPoint tiled = map->transMapToTiled(pouchT);
// if(Mathlib::inBound(tiled.x, posiT.x+contentSizeByTiled.width/2, posiT.x-contentSizeByTiled.width/2) &&
// Mathlib::inBound(tiled.y, posiT.y+contentSizeByTiled.height/2, posiT.y-contentSizeByTiled.height/2)) {
// isMoved = true;
// }
// return CCMenu::ccTouchBegan(pTouch, pEvent);
CC_UNUSED_PARAM(event);
if (m_eState != kCCMenuStateWaiting || ! m_bVisible || !isEnabled())
{
return false;
}
for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
{
if (c->isVisible() == false)
{
return false;
}
}
m_pSelectedItem = this->itemForTouch(touch);
if (m_pSelectedItem)
{
m_eState = kCCMenuStateTrackingTouch;
m_pSelectedItem->selected();
return true;
}
return false;
}
示例8: isParentAllVisible
bool LsTouch::isParentAllVisible(LsTouchEvent* lsTe)
{
bool bRef = true;
CCNode* nLsTe = dynamic_cast<CCNode*>(lsTe);
CCNode* parent = getParent();
do
{
if (!parent)
{
bRef = false;
break;
}
if (nLsTe == parent)
{
break;
}
if (!parent->isVisible())
{
bRef = false;
break;
}
parent = parent->getParent();
} while (1);
return bRef;
}
示例9: onTouchBegan
//-------------------------------------------------------------------------
ENUM_WidgetTouchModel FKCW_UIWidget_Layout::onTouchBegan(CCTouch* pTouch)
{
m_pSelectedWidget = NULL;
m_eSelectedWidgetTouchModel = eWidgetTouchNone;
CCPoint tNodePoint = convertToNodeSpace(pTouch->getLocation());
if( m_pChildren && m_pChildren->count() > 0 )
{
CCObject* pObject = NULL;
CCARRAY_FOREACH_REVERSE( m_pChildren, pObject )
{
CCNode* pNode = dynamic_cast<CCNode*>(pObject);
FKCW_UIWidget_Widget* pWidget = dynamic_cast<FKCW_UIWidget_Widget*>(pObject);
if( pWidget && pNode->isVisible() && pWidget->isEnabled() && pWidget->isTouchEnabled() )
{
if( pNode->boundingBox().containsPoint(tNodePoint) )
{
m_eSelectedWidgetTouchModel = pWidget->executeTouchBeganHandler(pTouch);
if( m_eSelectedWidgetTouchModel == eWidgetTouchNone )
{
m_pSelectedWidget = NULL;
m_eSelectedWidgetTouchModel = eWidgetTouchNone;
}
else
{
m_pSelectedWidget = pWidget;
return m_eSelectedWidgetTouchModel;
}
}
}
}
示例10: isParentAllVisible
bool LsTouch::isParentAllVisible(LsTouchEvent* lsTe) {
bool bRef = true;
// 向父类转型,以便获取地址比较对象,LsTouchEvent 的对象必须同时直接或者简介继承 CCNode
CCNode* nLsTe = dynamic_cast<CCNode*>(lsTe);
CCNode* parent = getParent();
do {
// 如果遍历完毕,说明 LsTouch 不再 LsTouchEvent 之内
if (!parent) {
bRef = false;
break;
}
// 如果 LsTouch 在 LsTouchEvent 之内,返回 true
// 注意:如果想让LsTouchEvent 处理 不在其 CCNode 结构之内的元素,则取消此处判断
if (nLsTe == parent) {
break;
}
if (!parent->isVisible()) {
bRef = false;
break;
}
parent = parent->getParent();
} while (1);
return bRef;
}
示例11: detect
bool NodeVisible::detect()
{
CCNode *pNode = SceneReader::sharedSceneReader()->getNodeByTag(_nTag);
if (pNode != NULL && pNode->isVisible() == _bVisible)
{
return true;
}
return false;
}
示例12: hasVisibleParents
bool Component::hasVisibleParents()
{
CCNode* pParent = this->getParent();
for( CCNode *c = pParent; c != NULL; c = c->getParent() )
{
if( !c->isVisible() )
{
return false;
}
}
return true;
}
示例13: ccTouchMoved
void UIScrollLayer::ccTouchMoved(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent)
{
// Òƶ¯
CCPoint touchPoint = CCDirector::sharedDirector()->convertToGL(pTouch->getLocationInView());
if(!touchIsInContent(touchPoint) || !m_bVisible)
{
return;
}
for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
{
if (c->isVisible() == false)
{
return;
}
}
CCPoint ptbaselayer = m_baseLayer->getPosition();
if (m_ScrollDir == ESD_Horizontal)
{
CCPoint posPoint = CCPointMake(m_baseLayer->getPosition().x + touchPoint.x - m_TouchCurPoint.x, ptbaselayer.y);
if(abs(touchPoint.x - m_TouchCurPoint.x) > TOUCH_DELTA)
{
m_bShouldStolenTouch = true;
}
if(abs(touchPoint.x - m_TouchDownPoint.x) > MIN_MOVE_DELTA)
{
m_baseLayer->setPosition(posPoint);
}
}
else
{
CCPoint posPoint = CCPointMake(ptbaselayer.x, m_baseLayer->getPosition().y + touchPoint.y - m_TouchCurPoint.y);
if(abs(touchPoint.y - m_TouchCurPoint.y) > TOUCH_DELTA)
{
m_bShouldStolenTouch = true;
}
if(abs(touchPoint.y - m_TouchDownPoint.y) > MIN_MOVE_DELTA)
{
m_baseLayer->setPosition(posPoint);
}
}
m_TouchCurPoint = touchPoint;
m_ScrollStatus = ESS_DRAGGING;
}
示例14: ccTouchBegan
bool MyMenu::ccTouchBegan(cocos2d::CCTouch *touch, cocos2d::CCEvent *event) {
if (isActive) {
cacheTouch = map->transMapToTiled(map->convertToNodeSpace(touch->getLocation()));
if (CCMenu::ccTouchBegan(touch, event)) {
// if (m_pSelectedItem->getTag() == myTiledMenuItemTag) {
// moveEnabled = true;
// isMoved = false;
// //TODO
//// ((MyMap*)map)->moveTemp = this;
// MyMenu::reorderZandTouchPriority(1000000, -499);
// } else {
//// ((MyMap*)map)->moveTemp = this;
// moveEnabled = false;
// isMoved = false;
// }
return true;
}
return false;
}
if (((MyMap*)map)->isBuild()) {
return false;
}
CC_UNUSED_PARAM(event);
if (m_eState != kCCMenuStateWaiting || ! m_bVisible || !isEnabled())
{
return false;
}
for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
{
if (c->isVisible() == false)
{
return false;
}
}
m_pSelectedItem = this->itemForTouch(touch);
if (m_pSelectedItem)
{
m_eState = kCCMenuStateTrackingTouch;
m_pSelectedItem->selected();
return true;
}
return false;
}
示例15: switchImages
void switchImages(ADMenuItem* item)
{
CCNode* normal = item->getChildByTag(NORMAL_SPRITE);
CCNode* selected = item->getChildByTag(SELECTED_SPRITE);
if(normal && selected)
{
if(normal->isVisible())
{
normal->setVisible(false);
selected->setVisible(true);
}
else
{
normal->setVisible(true);
selected->setVisible(false);
}
}
}