本文整理汇总了C++中CCControlButton::setLabelAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ CCControlButton::setLabelAnchorPoint方法的具体用法?C++ CCControlButton::setLabelAnchorPoint怎么用?C++ CCControlButton::setLabelAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCControlButton
的用法示例。
在下文中一共展示了CCControlButton::setLabelAnchorPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool ControllerScene::init(){
CCMenu *menu = CCMenu::create();
menu->setPosition(CCPointZero);
this->addChild(menu);
CCLabelTTF *label = CCLabelTTF::create("CCTextFieldTTF", "Arial", 24);
CCMenuItemLabel *item = CCMenuItemLabel::create(label, this, menu_selector(ControllerScene::menuItemClick1));
item->setPosition(ccp(320, 1100));
menu->addChild(item);
label = CCLabelTTF::create("确定", "Arial", 24);
m_btn = CCMenuItemLabel::create(label, this, menu_selector(ControllerScene::btnOk));
m_btn->setPosition(ccp(400, 1050));
menu->addChild(m_btn);
m_texField = CCTextFieldTTF::textFieldWithPlaceHolder("input", CCSizeMake(200, 50), kCCTextAlignmentLeft, "Arial", 24);
m_texField->setPosition(ccp(320, 1050));
this->addChild(m_texField);
m_texField->attachWithIME();
m_name = CCLabelTTF::create("show info", "Arial", 24);
m_name->setPosition(ccp(100, 1100));
this->addChild(m_name);
//CCControlButton label+s9
label = CCLabelTTF::create("BUTTON", "Arial", 24);
CCControlButton *btn = CCControlButton::create(label , CCScale9Sprite::create("start.png"));
btn->setPreferredSize(CCSizeMake(228, 81));
btn->setLabelAnchorPoint(ccp(0.5, 2));
btn->setPosition(ccp(320, 1000));
this->addChild(btn);
btn->addTargetWithActionForControlEvents(this, cccontrol_selector(ControllerScene::btnClick), CCControlEventTouchDown);
//CCControlButton s9
CCScale9Sprite *s9 = CCScale9Sprite::create("start.png");
btn = CCControlButton::create(s9);
btn->setPosition(ccp(320, 900));
btn->setPreferredSize(CCSizeMake(228, 81));
this->addChild(btn);
//CCControlButton title
btn = CCControlButton::create("CCControlButton", "Arial", 24);
btn->setPosition(ccp(320, 800));
this->addChild(btn);
//s9
// s9 = CCScale9Sprite::create("home.png");
// s9->setPosition(ccp(100, 800));
// this->addChild(s9);
//CCControlColourPicker not useful
CCControlColourPicker *cp = CCControlColourPicker::create();
cp->setPosition(ccp(320, 750));
this->addChild(cp);
//CCControlPotentiometer
CCControlPotentiometer *pot = CCControlPotentiometer::create("potentiometerTrack.png", "potentiometerProgress.png", "potentiometerButton.png");
pot->setPosition(ccp(100, 750));
this->addChild(pot);
pot->setValue(90);
//CCControlSlider
CCControlSlider *slider = CCControlSlider::create("sliderTrack.png", "sliderProgress.png", "sliderThumb.png");
slider->setPosition(ccp(150, 600));
slider->setMinimumValue(0);
slider->setMaximumValue(100);
this->addChild(slider);
slider->addTargetWithActionForControlEvents(this, cccontrol_selector(ControllerScene::valueChanged), CCControlEventValueChanged);
//CCControlStepper
CCControlStepper *ste = CCControlStepper::create(CCSprite::create("stepper-minus.png"), CCSprite::create("stepper-plus.png"));
ste->setPosition(ccp(320, 600));
this->addChild(ste);
//CCControlSwitch
CCControlSwitch *swi = CCControlSwitch::create(CCSprite::create("switch-mask.png"), CCSprite::create("switch-on.png"), CCSprite::create("switch-off.png"), CCSprite::create("switch-thumb.png"), CCLabelTTF::create("on", "Arial", 24), CCLabelTTF::create("off", "Arial", 24));
swi->setPosition(ccp(500, 600));
this->addChild(swi);
//
CCEditBox *edi = CCEditBox::create(CCSizeMake(200, 50), CCScale9Sprite::create("start.png"));
edi->setPosition(ccp(150, 500));
this->addChild(edi);
return true;
}