本文整理汇总了C++中CCScale9Sprite::setPositionX方法的典型用法代码示例。如果您正苦于以下问题:C++ CCScale9Sprite::setPositionX方法的具体用法?C++ CCScale9Sprite::setPositionX怎么用?C++ CCScale9Sprite::setPositionX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCScale9Sprite
的用法示例。
在下文中一共展示了CCScale9Sprite::setPositionX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool BuyLifeLayer::init()
{
bool bRet = false;
do
{
CC_BREAK_IF (!CCLayer::init());
CCSprite *p = CCSprite::create(g_sPanelBGImage);
CCSize ps = p->getContentSize();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCScale9Sprite * bg = CCScale9Sprite::create(g_sPanelBGImage,CCRectMake(0,0,ps.width,ps.height),CCRectMake(20,20,ps.width-40,ps.height-40));
this->addChild(bg);
bg->setAnchorPoint(ccp(0,0));
bg->setPreferredSize(CCSizeMake(s.width,s.height-beginY));
this->setTouchEnabled(true);
this->setTouchPriority(-999);
p = CCSprite::create(g_sPanelBGImage2);
ps = p->getContentSize();
bg = CCScale9Sprite::create(g_sPanelBGImage2,CCRectMake(0,0,ps.width,ps.height),CCRectMake(20,20,ps.width-40,ps.height-40));
this->addChild(bg);
bg->setAnchorPoint(ccp(0,0));
bg->setPreferredSize(CCSizeMake(s.width-20,s.height-20-beginY));
bg->setPositionX(10);
bg->setPositionY(10);
CCMenuItemImage * back = CCMenuItemImage::create(g_sBackButtonUpBGImage,g_sBackButtonDownBGImage,
this,
menu_selector(BuyLifeLayer::onCommandBack));
back->setAnchorPoint(ccp(0,1));
MyCCMenu * backMenu = MyCCMenu::create(back,NULL);
this->addChild(backMenu);
backMenu->setPositionX(28);
backMenu->setPositionY(1000-beginY);
backMenu->setTouchPriority(-1000);
CCSprite * t2 = CCSprite::create(g_sBigLifeBGImage);
t2->setAnchorPoint(ccp(0,1));
t2->setPosition(ccp(82,890-beginY));
this->addChild(t2);
CCSprite * price2 = CCSprite::create(g_sBuy2BGImage);
price2->setAnchorPoint(ccp(0,1));
price2->setPosition(ccp(157,889-beginY));
this->addChild(price2);
CCSprite * coin2 = CCSprite::create(g_sGoldBGImage);
coin2->setAnchorPoint(ccp(0,1));
coin2->setPosition(ccp(392,891-beginY));
this->addChild(coin2);
CCMenuItemImage * buy2 = CCMenuItemImage::create(g_sOkButtonUpBGImage,g_sOkButtonDownBGImage,
this,
menu_selector(BuyLifeLayer::onCommandBuy2));
buy2->setAnchorPoint(ccp(0,1));
MyCCMenu * buy2Menu = MyCCMenu::create(buy2,NULL);
this->addChild(buy2Menu);
buy2Menu->setPositionX(534);
buy2Menu->setPositionY(907-beginY);
buy2Menu->setTouchPriority(-1000);
CCSprite * t5 = CCSprite::create(g_sBigLifeBGImage);
t5->setAnchorPoint(ccp(0,1));
t5->setPosition(ccp(82,719-beginY));
this->addChild(t5);
CCSprite * price5 = CCSprite::create(g_sBuy5BGImage);
price5->setAnchorPoint(ccp(0,1));
price5->setPosition(ccp(157,718-beginY));
this->addChild(price5);
CCSprite * coin5 = CCSprite::create(g_sGoldBGImage);
coin5->setAnchorPoint(ccp(0,1));
coin5->setPosition(ccp(392,723-beginY));
this->addChild(coin5);
CCMenuItemImage * buy5 = CCMenuItemImage::create(g_sOkButtonUpBGImage,g_sOkButtonDownBGImage,
this,
menu_selector(BuyLifeLayer::onCommandBuy5));
buy5->setAnchorPoint(ccp(0,1));
MyCCMenu * buy5Menu = MyCCMenu::create(buy5,NULL);
this->addChild(buy5Menu);
buy5Menu->setPositionX(534);
buy5Menu->setPositionY(736-beginY);
buy5Menu->setTouchPriority(-1000);
CCSprite * t21 = CCSprite::create(g_sBigLifeBGImage);
t21->setAnchorPoint(ccp(0,1));
t21->setPosition(ccp(82,550-beginY));
this->addChild(t21);
CCSprite * price21 = CCSprite::create(g_sBuy21BGImage);
price21->setAnchorPoint(ccp(0,1));
price21->setPosition(ccp(152,550-beginY));
this->addChild(price21);
CCSprite * coin21 = CCSprite::create(g_sGoldBGImage);
//.........这里部分代码省略.........