本文整理汇总了C++中CCLayer::ignoreAnchorPointForPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLayer::ignoreAnchorPointForPosition方法的具体用法?C++ CCLayer::ignoreAnchorPointForPosition怎么用?C++ CCLayer::ignoreAnchorPointForPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLayer
的用法示例。
在下文中一共展示了CCLayer::ignoreAnchorPointForPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTipLayer
void HelpScene::setTipLayer(CCLayer* tipLayer){
CCSprite* bottom = SPRITE(bottom.png);
bottom->setPosition(ccp(VisibleRect::bottom().x,VisibleRect::bottom().y+35));
tipLayer->addChild(bottom);
GiantPageScrollView* tipsScrollView = GiantPageScrollView::create();
tipsScrollView->setPosition(VisibleRect::center());
tipsScrollView->cellSize = CCDirector::sharedDirector()->getWinSize();
tipsScrollView->tableSize = CCDirector::sharedDirector()->getWinSize();
tipsScrollView->cellNum = 4;
tipsScrollView->cells = CCArray::createWithCapacity(4);
for(int i=0;i<4;i++){
CCLayer* tipItem = CCLayer::create();
CCString* sprName = CCString::createWithFormat("tips_%d.png",i+1);
CCString* tipName = CCString::createWithFormat("tips_text_%d_CN.png",i+1);
CCSprite* tipStr = CCSprite::createWithSpriteFrameName(tipName->getCString());
CCSprite* tip = CCSprite::createWithSpriteFrameName(sprName->getCString());
tip->setPosition(VisibleRect::center());
tipStr->setPosition(ccp(VisibleRect::center().x,VisibleRect::center().y-200));
tipItem->ignoreAnchorPointForPosition(false);
tipItem->setPosition(VisibleRect::center());
tipItem->addChild(tip);
tipItem->addChild(tipStr);
tipsScrollView->cells->addObject(tipItem);
}
tipsScrollView->cells->retain();
tipLayer->addChild(tipsScrollView);
}
示例2: updateLayerMessageBox
void AssetsUpdateLayer::updateLayerMessageBox()
{
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ccb/ccbResources/SystemLoading.plist");
CCLayer* layer = CCLayer::create();
layer->ignoreAnchorPointForPosition(false);
layer->setContentSize(Size(960, 640));
layer->setPosition(Point(Director::getInstance()->getWinSize().width * 0.5, Director::getInstance()->getWinSize().height * 0.5));
layer->setScale(Director::getInstance()->getWinSize().width / 960);
addChild(layer, 1);
Sprite* messageboxSprite = Sprite::createWithSpriteFrameName("set_floor_v1.png");
messageboxSprite->setPosition(Point(480, 320));
layer->addChild(messageboxSprite, 1);
LabelTTF* labelContent = LabelTTF::create(Localization::getInstance()->getValueByKey("Loading_warning_need_update"), "Helvetica",32);
labelContent->setPosition(Point(480, 420));
layer->addChild(labelContent, 1);
ControlButton* btn = ControlButton::create(LabelTTF::create(Localization::getInstance()->getValueByKey("BUTTON_DONE"), "Helvetica", 32), Scale9Sprite::createWithSpriteFrameName("set_button2.png"));
btn->setPreferredSize(CCSize(191,70));
btn->setPosition(Point(480, 220));
btn->addTargetWithActionForControlEvents(this, cccontrol_selector(AssetsUpdateLayer::GoToAppPage), Control::EventType::TOUCH_UP_INSIDE);
layer->addChild(btn, 1);
}
示例3: setTowerLayer
void HelpScene::setTowerLayer(CCLayer* towerLayer){
CCSprite* bottom = SPRITE(bottom.png);
bottom->setPosition(ccp(VisibleRect::bottom().x,VisibleRect::bottom().y+35));
towerLayer->addChild(bottom);
GiantPageScrollView* towerPageScroll = GiantPageScrollView::create();
towerPageScroll->setPosition(VisibleRect::center());
towerPageScroll->cellSize = CCDirector::sharedDirector()->getWinSize();
towerPageScroll->tableSize = CCDirector::sharedDirector()->getWinSize();
towerPageScroll->cellNum = 18;
towerPageScroll->cells = CCArray::createWithCapacity(18);
for(int i=0;i<18;i++){
CCString* towerUrl;
CCString* towerInfo;
if(i<9){
towerUrl = CCString::createWithFormat("tower_0%d.png",i+1);
towerInfo = CCString::createWithFormat("tower_0%d_CN.png",i+1);
}else{
towerUrl = CCString::createWithFormat("tower_%d.png",i+1);
towerInfo = CCString::createWithFormat("tower_%d_CN.png",i+1);
}
CCLayer* towerLayer = CCLayer::create();
CCSprite* towerTxt = CCSprite::createWithSpriteFrameName(towerInfo->getCString());
CCSprite* tower = CCSprite::createWithSpriteFrameName(towerUrl->getCString());
tower->setPosition(VisibleRect::center());
towerTxt->setPosition(VisibleRect::center());
towerLayer->ignoreAnchorPointForPosition(false);
towerLayer->setPosition(VisibleRect::center());
towerLayer->addChild(tower);
towerLayer->addChild(towerTxt);
towerPageScroll->cells->addObject(towerLayer);
}
towerPageScroll->cells->retain();
towerLayer->addChild(towerPageScroll);
}