本文整理汇总了C++中Scale9Sprite::setAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ Scale9Sprite::setAnchorPoint方法的具体用法?C++ Scale9Sprite::setAnchorPoint怎么用?C++ Scale9Sprite::setAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scale9Sprite
的用法示例。
在下文中一共展示了Scale9Sprite::setAnchorPoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tableCellAtIndex
TableViewCell* SkillTableView::tableCellAtIndex(TableView *table, ssize_t idx)
{
CCString* str = CCString::createWithFormat("ui/skill/skill_%d.png",2001 + (int)idx);
TableViewCell* cell = table->dequeueCell();
if (!cell)
{
cell = new TableViewCell();
cell->autorelease();
Scale9Sprite* bg = Scale9Sprite::create("ui/cell.png");
bg->setAnchorPoint(Point::ZERO);
bg->setPosition(Point::ZERO);
bg->setPreferredSize(Size(420, 80));
cell->addChild(bg);
Sprite* skill = Sprite::create(str->getCString());
skill->setPosition(Point(50, 40));
cell->addChild(skill, 0, 123);
m_skillVec.push_back(skill);
}
else
{
Sprite* skill = (Sprite*)cell->getChildByTag(123);
Texture2D* texture = Director::getInstance()->getTextureCache()->addImage(str->getCString());
skill->setTexture(texture);
}
cell->setTag(2001+(int)idx);
return cell;
}
示例2: init
bool ArmsBackGroud::init(){
audioEffect *audioEffectTemp = nullptr;
audioEffectTemp->myPlaneChoose();
Scale9Sprite *background = Scale9Sprite::createWithSpriteFrameName("ArmsBackground.png");
background->setAnchorPoint(Point(0, 0));
this->addChild(background);
MenuItemSprite* ButtonReturnItem = MenuItemSprite::create(Sprite::createWithSpriteFrameName("arrow_right.png"), Sprite::createWithSpriteFrameName("arrow_right.png"), CC_CALLBACK_1(ArmsBackGroud::ButtonReturn, this));
Menu* ButtonReturn = Menu::create(ButtonReturnItem, nullptr);
//ButtonReturn->setScale(0.2f);
ButtonReturn->setAnchorPoint(Point(0, 0));
ButtonReturn->setPosition(30,450);
this->addChild(ButtonReturn);
MenuItemSprite* myplane1item = MenuItemSprite::create(Sprite::createWithSpriteFrameName("plane1Show.png"), Sprite::createWithSpriteFrameName("plane1Show.png"), CC_CALLBACK_1(ArmsBackGroud::myPlaneSelect1, this));
Menu* myPlane1 = Menu::create(myplane1item, nullptr);
myPlane1->setScale(0.5f);
myPlane1->setAnchorPoint(Point(0, 0));
myPlane1->setPosition(50, 380);
this->addChild(myPlane1);
Sprite* myPlane1Atr = Sprite::createWithSpriteFrameName("myPlane1atr.png");
myPlane1Atr->setAnchorPoint(Point(0.5, 0.5));
myPlane1Atr->setScale(0.4);
myPlane1Atr->setPosition(200, 380);
this->addChild(myPlane1Atr);
MenuItemSprite* myplane2item = MenuItemSprite::create(Sprite::createWithSpriteFrameName("plane2Show.png"), Sprite::createWithSpriteFrameName("plane2Show.png"), CC_CALLBACK_1(ArmsBackGroud::myPlaneSelect2, this));
Menu* myPlane2 = Menu::create(myplane2item, nullptr);
myPlane2->setScale(0.5f);
myPlane2->setAnchorPoint(Point(0, 0));
myPlane2->setPosition(50, 230);
this->addChild(myPlane2);
Sprite* myPlane2Atr = Sprite::createWithSpriteFrameName("myPlane2atr.png");
myPlane2Atr->setAnchorPoint(Point(0.5, 0.5));
myPlane2Atr->setScale(0.4);
myPlane2Atr->setPosition(200, 230);
this->addChild(myPlane2Atr);
MenuItemSprite* myplane3item = MenuItemSprite::create(Sprite::createWithSpriteFrameName("plane3Show.png"), Sprite::createWithSpriteFrameName("plane3Show.png"), CC_CALLBACK_1(ArmsBackGroud::myPlaneSelect3, this));
Menu* myPlane3 = Menu::create(myplane3item, nullptr);
myPlane3->setScale(0.5f);
myPlane3->setAnchorPoint(Point(0, 0));
myPlane3->setPosition(50, 80);
this->addChild(myPlane3);
Sprite* myPlane3Atr = Sprite::createWithSpriteFrameName("myPlane3atr.png");
myPlane3Atr->setAnchorPoint(Point(0.5, 0.5));
myPlane3Atr->setScale(0.4);
myPlane3Atr->setPosition(200, 80);
this->addChild(myPlane3Atr);
return true;
}
示例3: onDone
void SliderLoader::onDone(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader) {
Scale9Sprite* background = Scale9Sprite::createWithSpriteFrame(this->_backgroundSprite);
background->setContentSize(_contentSize);
Sprite* progressSprite = Sprite::create();
progressSprite->setContentSize(_contentSize);
progressSprite->addChild(background);
background->setAnchorPoint(Point(0.0, 0.5));
Sprite* sprite = Sprite::create();
sprite->setContentSize(_contentSize);
sprite->setAnchorPoint(Point(0.0, 0.0));
((ControlSlider*)pNode)->setContentSize(_contentSize);
if (_selectedHandleSprite)
((ControlSlider *)pNode)->initWithSprites(sprite,
progressSprite,
Sprite::createWithSpriteFrame(this->_handleSprite),
Sprite::createWithSpriteFrame(this->_selectedHandleSprite));
else
((ControlSlider *)pNode)->initWithSprites(sprite,
progressSprite,
Sprite::createWithSpriteFrame(this->_handleSprite));
((ControlSlider*)pNode)->setAnchorPoint(Point(0.0, 0.25));
_backgroundSprite->release();
_handleSprite->release();
if (_selectedHandleSprite)
_selectedHandleSprite->release();
// ((ControlSlider *)pNode)->setMaximumValue(100);
// ((ControlSlider *)pNode)->setMinimumValue(0);
}
示例4: init
bool SelectBackgroundLayer::init() {
auto listenerkeyPad = EventListenerKeyboard::create();
listenerkeyPad->onKeyReleased = CC_CALLBACK_2(SelectBackgroundLayer::onKeyReleased, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listenerkeyPad, this);
//╪сть╠Ё╬╟м╪
Scale9Sprite *background = Scale9Sprite::createWithSpriteFrameName("selectSceneBackground.jpg");
background->setContentSize(Size(Director::getInstance()->getWinSize().width, Director::getInstance()->getWinSize().height));
background->setAnchorPoint(Point(0, 0));
this->addChild(background);
Sprite* bottomOfLevel1 = Sprite::createWithSpriteFrameName("bottomOfpicture.png");
bottomOfLevel1->setAnchorPoint(Point(0, 0.5));
bottomOfLevel1->setScale(1.1);
//bottomOfLevel->setRotation(90);
bottomOfLevel1->setPosition(70, 360);
bottomOfLevel1->setOpacity(140);
this->addChild(bottomOfLevel1);
Sprite* blueBottom1 = Sprite::createWithSpriteFrameName("bottomOfpic.png");
blueBottom1->setAnchorPoint(Point(0, 0.5));
blueBottom1->setScale(0.65);
//bottomOfLevel->setRotation(90);
blueBottom1->setPosition(75, 295);
this->addChild(blueBottom1);
Sprite* bottomOfLevel2 = Sprite::createWithSpriteFrameName("bottomOfpicture.png");
bottomOfLevel2->setAnchorPoint(Point(0, 0.5));
bottomOfLevel2->setScale(1.1);
//bottomOfLevel->setRotation(90);
bottomOfLevel2->setPosition(70,220);
bottomOfLevel2->setOpacity(140);
this->addChild(bottomOfLevel2);
Sprite* blueBottom2 = Sprite::createWithSpriteFrameName("bottomOfpic.png");
blueBottom2->setAnchorPoint(Point(0, 0.5));
blueBottom2->setScale(0.65);
//bottomOfLevel->setRotation(90);
blueBottom2->setPosition(75, 155);
this->addChild(blueBottom2);
Sprite* bottomOfLevel3 = Sprite::createWithSpriteFrameName("bottomOfpicture.png");
bottomOfLevel3->setAnchorPoint(Point(0, 0.5));
bottomOfLevel3->setScale(1.1);
bottomOfLevel3->setPosition(70, 80);
bottomOfLevel3->setOpacity(140);
this->addChild(bottomOfLevel3);
Sprite* blueBottom3 = Sprite::createWithSpriteFrameName("bottomOfpic.png");
blueBottom3->setAnchorPoint(Point(0, 0.5));
blueBottom3->setScale(0.65);
blueBottom3->setPosition(75, 15);
this->addChild(blueBottom3);
MenuItemSprite* blank1 = MenuItemSprite::create(Sprite::createWithSpriteFrameName("img_bg_1.jpg"), Sprite::createWithSpriteFrameName("img_bg_1.jpg"), CC_CALLBACK_1(SelectBackgroundLayer::selectCheckPoint_1, this));
Menu* menuBlank1 = Menu::create(blank1, nullptr);
menuBlank1->setScale(0.15f);
menuBlank1->setAnchorPoint(Point(0, 0));
menuBlank1->setPosition(120, 365);//100
this->addChild(menuBlank1);
MenuItemSprite* blank2 = MenuItemSprite::create(Sprite::createWithSpriteFrameName("img_bg_2.jpg"), Sprite::createWithSpriteFrameName("img_bg_2.jpg"), CC_CALLBACK_1(SelectBackgroundLayer::selectCheckPoint_2, this));
Menu* menuBlank2 = Menu::create(blank2, nullptr);
menuBlank2->setScale(0.15f);
menuBlank2->setAnchorPoint(Point(0, 0));
menuBlank2->setPosition(195, 365);
this->addChild(menuBlank2);
MenuItemSprite* blank3 = MenuItemSprite::create(Sprite::createWithSpriteFrameName("img_bg_3.jpg"), Sprite::createWithSpriteFrameName("img_bg_3.jpg"), CC_CALLBACK_1(SelectBackgroundLayer::selectCheckPoint_3, this));
Menu* menuBlank3 = Menu::create(blank3, nullptr);
menuBlank3->setScale(0.15f);
menuBlank3->setAnchorPoint(Point(0, 0));
menuBlank3->setPosition(270, 365);
this->addChild(menuBlank3);
MenuItemSprite* blank4 = MenuItemSprite::create(Sprite::createWithSpriteFrameName("img_bg_4.jpg"), Sprite::createWithSpriteFrameName("img_bg_4.jpg"), CC_CALLBACK_1(SelectBackgroundLayer::selectCheckPoint_4, this));
Menu* menuBlank4 = Menu::create(blank4, nullptr);
menuBlank4->setScale(0.15f);
menuBlank4->setAnchorPoint(Point(0, 0));
menuBlank4->setPosition(195, 225);//590
this->addChild(menuBlank4);
MenuItemSprite* blank5 = MenuItemSprite::create(Sprite::createWithSpriteFrameName("img_bg_5.jpg"), Sprite::createWithSpriteFrameName("img_bg_5.jpg"), CC_CALLBACK_1(SelectBackgroundLayer::selectCheckPoint_5, this));
Menu* menuBlank5 = Menu::create(blank5, nullptr);
menuBlank5->setScale(0.15f);
menuBlank5->setAnchorPoint(Point(0, 0));
menuBlank5->setPosition(195, 85);//590
this->addChild(menuBlank5);
// Sprite* blank2 = Sprite::createWithSpriteFrameName("img_bg_2.jpg");
// blank2->setScale(0.3);
// blank2->setPosition(365, 590);
// this->addChild(blank2);
// Sprite* blank2_locked = Sprite::createWithSpriteFrameName("locked.png");
// blank2_locked->setPosition(365, 590);
//.........这里部分代码省略.........