当前位置: 首页>>代码示例>>C++>>正文


C++ CCControlButton::setLabelAnchorPoint方法代码示例

本文整理汇总了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;
}
开发者ID:1179432578,项目名称:cocos2dx-2.2.2-test,代码行数:86,代码来源:ControllerScene.cpp


注:本文中的CCControlButton::setLabelAnchorPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。