static int tolua_Cocos2d_Node_isTouchEnabled(lua_State* tolua_S) { #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else #endif { Node* self = static_cast<cocos2d::Node*>(tolua_tousertype(tolua_S,1,0)); #if COCOS2D_DEBUG >= 1 if (!self) tolua_error(tolua_S,"invalid 'self' in function 'isTouchEnabled'", nullptr); #endif { auto mng = LuaNodeManager::getInstance(); auto lnode = mng->getLuaNodeByNode(self, false); bool tolua_ret = false; if (lnode) { tolua_ret = lnode->isTouchEnabled(); } tolua_pushboolean(tolua_S,(bool)tolua_ret); } } return 1; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'isTouchEnabled'.",&tolua_err); return 0; #endif }
void CCScene::removeTouchableNode(CCNode *node) { m_touchableNodes->removeObject(node); // CCLOG("REMOVE TOUCHABLE NODE: %p", node); if (m_touchableNodes->count() == 0 && isTouchEnabled()) { setTouchEnabled(false); } }
void CCScene::addTouchableNode(CCNode *node) { if (!m_touchableNodes->containsObject(node)) { m_touchableNodes->addObject(node); // CCLOG("ADD TOUCHABLE NODE: %p", node); if (!isTouchEnabled()) { setTouchEnabled(true); } } }
bool GameLotteryLayer::ccTouchBegan(cocos2d::CCTouch* pTouch, cocos2d::CCEvent* pEvent) { if (!isTouchEnabled()) { return true; } if (!Layer::ccTouchBegan(pTouch, pEvent)) { if (m_bIsShowing && !m_bIsRunning) { CCLOG("GameLottery Showing NotRunning"); m_bTempSoundOn = false; onBtnBackCallback(NULL); m_bTempSoundOn = true; return true; } return false; } CCLOG("GameLottery %s %s", m_bIsShowing?"true":"false", m_bIsRunning?"true":"false"); return true; }
bool Widget::onTouchBegan(Touch *touch, Event *unusedEvent) { _hitted = false; if (isEnabled() && isTouchEnabled()) { _touchStartPos = touch->getLocation(); if(hitTest(_touchStartPos) && clippingParentAreaContainPoint(_touchStartPos)) { _hitted = true; } } if (!_hitted) { return false; } setFocused(true); Widget* widgetParent = getWidgetParent(); if (widgetParent) { widgetParent->checkChildInfo(0,this,_touchStartPos); } pushDownEvent(); return !_touchPassedEnabled; }
// Overridden so that not touchable unless specifically set as such bool CC3ShadowVolumeMeshNode::isTouchable() { return (isVisible() || m_shouldAllowTouchableWhenInvisible) && isTouchEnabled(); }
// Overridden so that not touchable unless specifically set as such bool CC3BoundingVolumeDisplayNode::isTouchable() { return (isVisible() || m_shouldAllowTouchableWhenInvisible) && isTouchEnabled(); }
/** Overridden so that not touchable unless specifically set as such. */ bool CC3WireframeBoundingBoxNode::isTouchable() { return (isVisible() || m_shouldAllowTouchableWhenInvisible) && isTouchEnabled(); }