本文整理汇总了C++中CCLayerColor::setTouchEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLayerColor::setTouchEnabled方法的具体用法?C++ CCLayerColor::setTouchEnabled怎么用?C++ CCLayerColor::setTouchEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLayerColor
的用法示例。
在下文中一共展示了CCLayerColor::setTouchEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: constructView
void SGCGMovieLayer::constructView()
{
SGNotificationCenter::sharedNotificationCenter()->addObserver(MSG_CGBATTLE_START, this, callfuncO_selector(SGCGMovieLayer::cgBattleListener));
s = CCDirector::sharedDirector()->getWinSize();
ResourceManager::sharedInstance()->bindTexture("bg/cgBg.plist", RES_TYPE_LAYER_UI, sg_cgMovieLayer);
CCSprite *cgBg = CCSprite::createWithSpriteFrameName("cgBg.png");
cgBg->setAnchorPoint(ccp(0.5, 1));
cgBg->ignoreAnchorPointForPosition(false);
cgBg->cocos2d::CCNode::setScaleX(s.width/cgBg->getContentSize().width);
cgBg->setPosition(ccp(s.width/2, s.height));
addChild(cgBg);
// SGButton *skipBt = SGButton::createFromLocal("box_btnbg.png", "跳 过", this, menu_selector(SGCGMovieLayer::cgSkipToBattle), CCPointZero, FONT_PANGWA,ccWHITE,32,false,true);
// skipBt->setPosition(ccp(s.width/2, skipBt->getContentSize().height*2));
// addBtn(skipBt);
CCLayerColor * blackBg = CCLayerColor::create(ccc4(0, 0, 0, 255), s.width, s.height);
blackBg->setTouchEnabled(false);
blackBg->ignoreAnchorPointForPosition(false);
blackBg->setAnchorPoint(ccp(0, 0));
blackBg->setPosition(ccp(0, 0));
this->addChild(blackBg, -100);
scrollRect = CCRectMake(0, s.height*0.2, s.width, s.height/4);
cgScrollView = SNSScrollView::create(scrollRect);
cgScrollView->setFrame(scrollRect);
cgScrollView->setPosition(scrollRect.origin);
cgScrollView->setHorizontal(false);
cgScrollView->setVertical(true);
cgScrollView->setTouchEnabled(false);
this->addChild(cgScrollView);
// CCSprite *scrollBg = CCSprite::createWithSpriteFrameName("barrack_kuang.png");
// scrollBg->cocos2d::CCNode::setScale(s.width/scrollBg->getContentSize().width, s.height/4/scrollBg->getContentSize().height);
// scrollBg->setPosition(ccpAdd(scrollRect.origin, ccp(s.width/2, s.height/8)));
// addChild(scrollBg);
char *spritData = new char[(int)s.width * (int)s.height *4];
memset(spritData,0,(int)s.width * (int)s.height *4);
int spriteDataSize = (int)s.width * (int)s.height*4;
for (int j=0; j<spriteDataSize; j+=4) {
spritData[j] = 0;
spritData[j+1] = 0;
spritData[j+2] = 0;
spritData[j+3] = 255;
}
CCTexture2D *pTexture = new CCTexture2D();
pTexture->initWithData(spritData, kCCTexture2DPixelFormat_Default, (int)s.width, (int)s.height, s);
finaleSprite = CCSprite::createWithTexture(pTexture);
finaleSprite->setPosition(CCPointZero);
finaleSprite->setAnchorPoint(CCPointZero);
this->addChild(finaleSprite,10,10);
finaleSprite->setVisible(false);
finaleSprite->setOpacity(0);
delete [] spritData;
pTexture->autorelease();
this->setTouchEnabled(true);
const char *str[7] = { str_CGMovieLayer_str1,
str_CGMovieLayer_str2,
str_CGMovieLayer_str3,
str_CGMovieLayer_str4,
str_CGMovieLayer_str5,
str_CGMovieLayer_str6,
str_CGMovieLayer_str7};
SGCCLabelTTF *cgMsg = NULL;
posY = -20;
for (int i=0; i<7; i++) {
cgMsg = SGCCLabelTTF::create(str[i], FONT_BOXINFO, 34);
cgMsg->cocos2d::CCNode::setPosition(s.width/2, posY);
cgScrollView->m_body->addChild(cgMsg);
posY -= 50;
}
moveCgMsgDis = CGMSGMOVEDIS;
unschedule(schedule_selector(SGCGMovieLayer::moveCgMsgUp));
if (SGPlayerInfo::sharePlayerInfo()->getCDKeyNeed()==1) {
SGNotificationCenter::sharedNotificationCenter()->addObserver(MSG_CDK, this, callfuncO_selector(SGCGMovieLayer::cdkListener));
ResourceManager::sharedInstance()->bindTexture("sgloginingbox/sgloginingbox.plist", RES_TYPE_LAYER_UI, sg_cgMovieLayer);
// ResourceManager::sharedInstance()->bindTexture("sgserverlistlayer/sgserverlistlayer.plist",RES_TYPE_LAYER_UI ,sg_registerLayer);
box = CCSprite::createWithSpriteFrameName("register_diban.png");
box->setPosition(SGLayout::getPoint(kMiddleCenter));
this->addChild(box);
m_cdk = CCEditBox::create(CCSizeMake(500, 60), CCScale9Sprite::createWithSpriteFrameName("public_kuang_input.png"));
m_cdk->setPlaceHolder(str_CGMovieLayer_str8);
m_cdk->setPlaceholderFontColor(ccc3(0x82,0x3e,0x02));
m_cdk->setMaxLength(10);
m_cdk->setReturnType(kKeyboardReturnTypeDone);
//.........这里部分代码省略.........