• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cccontrol_selector函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cccontrol_selector函数的典型用法代码示例。如果您正苦于以下问题:C++ cccontrol_selector函数的具体用法?C++ cccontrol_selector怎么用?C++ cccontrol_selector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cccontrol_selector函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: addChild

bool SimpleLayer::init() {
    if (!BaseLayer::init()) {
        return false;
    }
    
    auto bg = LayerColor::create(Color4B::BLUE);
    addChild(bg, 1);
    
    _openButton = ControlButton::create("Open more layer", "", 30);
    _openButton->setPosition(Vec2(100, 400));
    _openButton->setAnchorPoint(Vec2(0, 0));
    _openButton->addTargetWithActionForControlEvents(this,
                                                     cccontrol_selector(SimpleLayer::onOpenPressed),
                                                     Control::EventType::TOUCH_UP_INSIDE);
    addChild(_openButton, 2);
    
    _closeButton = ControlButton::create("Close this layer", "", 30);
    _closeButton->setPosition(Vec2(100, 300));
    _closeButton->setAnchorPoint(Vec2(0, 0));
    _closeButton->addTargetWithActionForControlEvents(this,
                                                     cccontrol_selector(SimpleLayer::onClosePressed),
                                                     Control::EventType::TOUCH_UP_INSIDE);
    addChild(_closeButton, 2);
    
    return true;
}
开发者ID:kobakei,项目名称:CocosAndroidBackKey,代码行数:26,代码来源:SimpleLayer.cpp


示例2: js_cocos2dx_CCControl_addTargetWithActionForControlEvents

JSBool js_cocos2dx_CCControl_addTargetWithActionForControlEvents(JSContext *cx, uint32_t argc, jsval *vp) {
return JS_TRUE;
    if(argc == 3) {
        jsval *argv = JS_ARGV(cx, vp);
        JSObject *obj = JS_THIS_OBJECT(cx, vp);
        js_proxy_t *proxy;
        JS_GET_NATIVE_PROXY(proxy, obj);
        cocos2d::extension::CCControl* item = (cocos2d::extension::CCControl*)(proxy ? proxy->ptr : NULL);
        TEST_NATIVE_OBJECT(cx, item)
        JSObject* jsTargetObj = JSVAL_TO_OBJECT(argv[0]);
        JSObject* jsFuncObj = JSVAL_TO_OBJECT(argv[1]);
        int event = JSVAL_TO_INT(argv[2]);
        
        js_callback_proxy_t* found = NULL;
        if (is_target_function_exist(jsTargetObj, jsFuncObj, (void*)item, (void*)event, &found))
        {
            item->removeTargetWithActionForControlEvents(found->nativeTargetObj, cccontrol_selector(JSCallbackTarget::onControlEventReceived), event);
            JS_CALLBACK_REMOVE_PROXY(found);
            CCLOG("In add Target: target exists, remove it!");
        }
        
        JSCallbackTarget* pTarget = new JSCallbackTarget();
        item->addTargetWithActionForControlEvents(pTarget, cccontrol_selector(JSCallbackTarget::onControlEventReceived), event);
        js_callback_proxy_t* p;
        JS_CALLBACK_NEW_PROXY(p, pTarget, jsTargetObj, jsFuncObj, item, event);
        JS_AddNamedObjectRoot(cx, &jsTargetObj, "cccontrol target object");
        JS_AddNamedObjectRoot(cx, &jsFuncObj, "cccontrol jsFuncObj object");

        pTarget->setJSProxy(p);
        return JS_TRUE;
    }
    JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 3);
    return JS_FALSE;
}
开发者ID:dumganhar,项目名称:HelloExtensionJS,代码行数:34,代码来源:cocos2d_specifics.cpp


示例3: addChild

bool LayerSetup::init()
{
	CCLayer::init();

	CCLayerColor* layerTrans = CCLayerColor::create(ccc4(192, 192, 192, 128));
	addChild(layerTrans);

	CCLayerColor* layerBG = CCLayerColor::create(ccc4(192, 192, 192, 255), winSize.width / 2, winSize.height / 2);
	addChild(layerBG);
	layerBG->setPosition(ccp(winSize.width / 4, winSize.height / 4));

	// 创建两个slider
	MyCCControlSlider* volumeBG = MyCCControlSlider::create("sliderTrack.png", "sliderProgress.png", "sliderThumb.png");
	MyCCControlSlider* volumeEffect = MyCCControlSlider::create("sliderTrack.png", "sliderProgress.png", "sliderThumb.png");
	addChild(volumeBG);
	addChild(volumeEffect);
	_volumeBG = volumeBG;
	_volumeEffect = volumeEffect;

	volumeBG->setMinimumValue(0.0f);
	volumeBG->setMaximumValue(1.0f);

	volumeEffect->setMinimumValue(0.0f);
	volumeEffect->setMaximumValue(1.0f);

	volumeBG->setPosition(ccp(winSize.width / 2, winSize.height / 2));
	volumeEffect->setPosition(ccp(winSize.width / 2, winSize.height / 2));

	Common::moveNodeY(volumeBG, 40);
//	Common::moveNodeY(volumeEffect, -30);

	volumeBG->addTargetWithActionForControlEvents(this, cccontrol_selector(LayerSetup::ChangeBGVolume), CCControlEventValueChanged);
	volumeEffect->addTargetWithActionForControlEvents(this, cccontrol_selector(LayerSetup::ChangeEffectVolume), CCControlEventValueChanged);

	setZOrder(Common::ZO_LAYER_SETUP);

	// 读配置文件
	float fVolumeBG = CCUserDefault::sharedUserDefault()->getFloatForKey("BGVolume", 1.0f);
	float fVolumeEffect = CCUserDefault::sharedUserDefault()->getFloatForKey("EffectVolume", 1.0f);

	volumeBG->setValue(fVolumeBG);
	volumeEffect->setValue(fVolumeEffect);

	// 创建一个确定按钮
	CCMenuItemFont* item = CCMenuItemFont::create("Close", this, menu_selector(LayerSetup::Close));
	CCMenu* menu = CCMenu::createWithItem(item);
	addChild(menu);
	Common::moveNode(item, ccp(80, -60));
	_menu = menu;

	// 暂停
	// CCDirector::sharedDirector()->pause();

	setTouchEnabled(true);
	setTouchMode(kCCTouchesOneByOne);
	setTouchPriority(-130);

	return true;
}
开发者ID:dalechngame,项目名称:mygame,代码行数:59,代码来源:LayerSetup.cpp


示例4: addChild

bool ControlColourPicker::init()
{
    if (Control::init())
    {
        // Cache the sprites
        SpriteFrameCache::getInstance()->addSpriteFramesWithFile("extensions/CCControlColourPickerSpriteSheet.plist");
        
        // Create the sprite batch node
        SpriteBatchNode *spriteSheet  = SpriteBatchNode::create("extensions/CCControlColourPickerSpriteSheet.png");
        addChild(spriteSheet);
        
        // MIPMAP
//        ccTexParams params  = {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT};
		/* Comment next line to avoid something like mosaic in 'ControlExtensionTest',
		   especially the display of 'huePickerBackground.png' when in 800*480 window size with 480*320 design resolution and hd(960*640) resources.
	    */
//        spriteSheet->getTexture()->setAliasTexParameters();
//         spriteSheet->getTexture()->setTexParameters(&params);
//         spriteSheet->getTexture()->generateMipmap();

        // Init default color
        _hsv.h = 0;
        _hsv.s = 0;
        _hsv.v = 0;
        
        // Add image
        _background=ControlUtils::addSpriteToTargetWithPosAndAnchor("menuColourPanelBackground.png", spriteSheet, Vec2::ZERO, Vec2(0.5f, 0.5f));
        if(!_background) return false;
        CC_SAFE_RETAIN(_background);
        
        Vec2 backgroundPointZero = _background->getPosition() - Vec2(_background->getContentSize().width / 2, _background->getContentSize().height / 2);
        
        // Setup panels
        float hueShift                = 8;
        float colourShift             = 28;
        
        _huePicker = new ControlHuePicker();
        _huePicker->initWithTargetAndPos(spriteSheet, Vec2(backgroundPointZero.x + hueShift, backgroundPointZero.y + hueShift));
        _colourPicker = new ControlSaturationBrightnessPicker();
        _colourPicker->initWithTargetAndPos(spriteSheet, Vec2(backgroundPointZero.x + colourShift, backgroundPointZero.y + colourShift));
        
        // Setup events
        _huePicker->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlColourPicker::hueSliderValueChanged), Control::EventType::VALUE_CHANGED);
        _colourPicker->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlColourPicker::colourSliderValueChanged), Control::EventType::VALUE_CHANGED);
       
        // Set defaults
        updateHueAndControlPicker();
        addChild(_huePicker);
        addChild(_colourPicker);

        // Set content size
        setContentSize(_background->getContentSize());
        return true;
    }
    else
        return false;
}
开发者ID:CatalystApps,项目名称:Cocos2dxv3_GAFSampleGame,代码行数:57,代码来源:CCControlColourPicker.cpp


示例5: setTouchEnabled

bool CCControlColourPicker::init()
{
    if (CCControl::init())
    {
        setTouchEnabled(true);
        // Cache the sprites
        CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("extensions/CCControlColourPickerSpriteSheet.plist");
        
        // Create the sprite batch node
        CCSpriteBatchNode *spriteSheet  = CCSpriteBatchNode::create("extensions/CCControlColourPickerSpriteSheet.png");
        addChild(spriteSheet);
        
        // MIPMAP
//        ccTexParams params  = {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT};
		/* Comment next line to avoid something like mosaic in 'CCControlExtensionTest',
		   especially the display of 'huePickerBackground.png' when in 800*480 window size with 480*320 design resolution and hd(960*640) resources.
	    */
//        spriteSheet->getTexture()->setAliasTexParameters();
//         spriteSheet->getTexture()->setTexParameters(&params);
//         spriteSheet->getTexture()->generateMipmap();

        // Init default color
        m_hsv.h = 0;
        m_hsv.s = 0;
        m_hsv.v = 0;
        
        // Add image
        m_background=CCControlUtils::addSpriteToTargetWithPosAndAnchor("menuColourPanelBackground.png", spriteSheet, CCPointZero, ccp(0.5f, 0.5f));
       
        CCPoint backgroundPointZero = ccpSub(m_background->getPosition(), ccp (m_background->getContentSize().width / 2, m_background->getContentSize().height / 2));
        
        // Setup panels
        float hueShift                = 8;
        float colourShift             = 28;
        
        m_huePicker = new CCControlHuePicker();
        m_huePicker->initWithTargetAndPos(spriteSheet, ccp(backgroundPointZero.x + hueShift, backgroundPointZero.y + hueShift));
        m_colourPicker = new CCControlSaturationBrightnessPicker();
        m_colourPicker->initWithTargetAndPos(spriteSheet, ccp(backgroundPointZero.x + colourShift, backgroundPointZero.y + colourShift));
        
        // Setup events
        m_huePicker->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlColourPicker::hueSliderValueChanged), CCControlEventValueChanged);
        m_colourPicker->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlColourPicker::colourSliderValueChanged), CCControlEventValueChanged);
       
        // Set defaults
        updateHueAndControlPicker();
        addChild(m_huePicker);
        addChild(m_colourPicker);

        // Set content size
        setContentSize(m_background->getContentSize());
        return true;
    }
    else
        return false;
}
开发者ID:suzuhiroruri,项目名称:EuropeanCharisou,代码行数:56,代码来源:CCControlColourPicker.cpp


示例6: cccontrol_selector

SEL_CCControlHandler HRootLayer::onResolveCCBCCControlSelector(CCObject * pTarget, const char * pSelectorName) {
    SEL_CCControlHandler pRet = NULL;
    if (pSelectorName) {
        if (0 == strcmp(pSelectorName, "onBackClick:")) {
            pRet = cccontrol_selector(HRootLayer::onBackClick);
        } else if (0 == strcmp(pSelectorName, "onCloseClick:")) {
            pRet = cccontrol_selector(HRootLayer::onCloseClick);
        }
    }
    return pRet;
}
开发者ID:hyizsg,项目名称:mytest1st,代码行数:11,代码来源:RootLayer.cpp


示例7: setTouchEnabled

NS_CC_EXT_BEGIN

bool CCControlColourPicker::init()
{
    if (CCControl::init())
    {
        setTouchEnabled(true);
        // Cache the sprites
        CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("extensions/CCControlColourPickerSpriteSheet.plist");
        
        // Create the sprite batch node
        CCSpriteBatchNode *spriteSheet  = CCSpriteBatchNode::create("extensions/CCControlColourPickerSpriteSheet.png");
        addChild(spriteSheet);
        
        // MIPMAP
        ccTexParams params  = {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT};
        spriteSheet->getTexture()->setAliasTexParameters();
        spriteSheet->getTexture()->setTexParameters(&params);
        spriteSheet->getTexture()->generateMipmap();

        // Init default color
        m_hsv.h = 0;
        m_hsv.s = 0;
        m_hsv.v = 0;
        
        // Add image
        m_background=CCControlUtils::addSpriteToTargetWithPosAndAnchor("menuColourPanelBackground.png", spriteSheet, CCPointZero, ccp(0.5f, 0.5f));
       
        CCPoint backgroundPointZero = ccpSub(m_background->getPosition(), ccp (m_background->getContentSize().width / 2, m_background->getContentSize().height / 2));
        
        // Setup panels . currently hard-coded...
        float hueShift                = 8;
        float colourShift             = 28;
        
        m_huePicker=CCControlHuePicker::create(spriteSheet, ccp(backgroundPointZero.x + hueShift, backgroundPointZero.y + hueShift));
        m_colourPicker=CCControlSaturationBrightnessPicker::create(spriteSheet, ccp(backgroundPointZero.x + colourShift, backgroundPointZero.y + colourShift));
        
        // Setup events
        m_huePicker->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlColourPicker::hueSliderValueChanged), CCControlEventValueChanged);
        m_colourPicker->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlColourPicker::colourSliderValueChanged), CCControlEventValueChanged);
       
        // Set defaults
        updateHueAndControlPicker();
        addChild(m_huePicker);
        addChild(m_colourPicker);

        // Set content size
        setContentSize(m_background->getContentSize());
        return true;
    }
    else
        return false;
}
开发者ID:136446529,项目名称:book-code,代码行数:53,代码来源:CCControlColourPicker.cpp


示例8: setDisplayValueLabel

bool ControlButtonTest_Event::init()
{
    if (ControlScene::init())
    {
        auto screenSize = Director::getInstance()->getWinSize();

        // Add a label in which the button events will be displayed
        setDisplayValueLabel(Label::createWithTTF("No Event", "fonts/Marker Felt.ttf", 32));
        _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1));
        _displayValueLabel->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
        addChild(_displayValueLabel, 1);

        setDisplayBitmaskLabel(Label::createWithTTF("No bitmask event", "fonts/Marker Felt.ttf", 24));
        _displayBitmaskLabel->setAnchorPoint(Vec2(0.5f, -1));
        Vec2 bitmaskLabelPos = _displayValueLabel->getPosition() - Vec2(0, _displayBitmaskLabel->getBoundingBox().size.height);
        _displayBitmaskLabel->setPosition(bitmaskLabelPos);
        addChild(_displayBitmaskLabel, 1);

        // Add the button
        auto backgroundButton = ui::Scale9Sprite::create("extensions/button.png");
        auto backgroundHighlightedButton = ui::Scale9Sprite::create("extensions/buttonHighlighted.png");
        
        auto titleButton = Label::createWithTTF("Touch Me!", "fonts/Marker Felt.ttf", 30);

        titleButton->setColor(Color3B(159, 168, 176));
        
        ControlButton *controlButton = ControlButton::create(titleButton, backgroundButton);
        controlButton->setBackgroundSpriteForState(backgroundHighlightedButton, Control::State::HIGH_LIGHTED);
        controlButton->setTitleColorForState(Color3B::WHITE, Control::State::HIGH_LIGHTED);
        
        controlButton->setAnchorPoint(Vec2(0.5f, 1));
        controlButton->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
        addChild(controlButton, 1);

        // Add the black background
        auto background = ui::Scale9Sprite::create("extensions/buttonBackground.png");
        background->setContentSize(Size(300, 170));
        background->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
        addChild(background);
        
        // Sets up event handlers
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlButtonTest_Event::touchDownAction), Control::EventType::TOUCH_DOWN);
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlButtonTest_Event::touchDragInsideAction), Control::EventType::DRAG_INSIDE);
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlButtonTest_Event::touchDragOutsideAction), Control::EventType::DRAG_OUTSIDE);
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlButtonTest_Event::touchDragEnterAction), Control::EventType::DRAG_ENTER);
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlButtonTest_Event::touchDragExitAction), Control::EventType::DRAG_EXIT);
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlButtonTest_Event::touchUpInsideAction), Control::EventType::TOUCH_UP_INSIDE);
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlButtonTest_Event::touchUpOutsideAction), Control::EventType::TOUCH_UP_OUTSIDE);
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlButtonTest_Event::touchCancelAction), Control::EventType::TOUCH_CANCEL);
        // test for issue 2882
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlButtonTest_Event::touchBitmaskAction),
            Control::EventType::TOUCH_DOWN | Control::EventType::DRAG_INSIDE | Control::EventType::DRAG_OUTSIDE | Control::EventType::DRAG_ENTER | Control::EventType::DRAG_EXIT | Control::EventType::TOUCH_UP_INSIDE | Control::EventType::TOUCH_UP_OUTSIDE | Control::EventType::TOUCH_CANCEL | Control::EventType::VALUE_CHANGED);

        return true;
    }
    return false;
}
开发者ID:asuo1986,项目名称:own,代码行数:57,代码来源:CCControlButtonTest.cpp


示例9: getContentSize

void BWHomeLayer::initUI()
{
    Size cntentSize = getContentSize();
    CCButton*  pBtnCloseGuide = CCButton::create("level",COMMON_FONT,50);
    pBtnCloseGuide->setPosition(Point(cntentSize.width*0.5,cntentSize.height*0.5));
    pBtnCloseGuide->addTargetWithActionForControlEvents(this, cccontrol_selector(BWHomeLayer::clickLevel), Control::EventType::TOUCH_UP_INSIDE);
    addChild(pBtnCloseGuide);
    
    CCButton*  pBtnEdit = CCButton::create("edit",COMMON_FONT,50);
    pBtnEdit->setPosition(Point(cntentSize.width*0.5,cntentSize.height*0.2));
    pBtnEdit->addTargetWithActionForControlEvents(this, cccontrol_selector(BWHomeLayer::clickEdit), Control::EventType::TOUCH_UP_INSIDE);
    addChild(pBtnEdit);
    
}
开发者ID:bingwan,项目名称:PlaneClasses,代码行数:14,代码来源:BWHomeLayer.cpp


示例10: addChild

void MyStore::addscrollview(CCControlButton *button)
{
    
    if (button->getTag()==1) {
        //普通商城
        //scrollview->removeAllChildren();
        this->removeChildByTag(10);
        scrollview=CCScrollView::create(CCSizeMake(700, 215));
        scrollview->setPosition(visible_center);
        scrollview->setDirection(kCCScrollViewDirectionHorizontal);
        scrollview->ignoreAnchorPointForPosition(false);
        scrollview->setTag(10);
        addChild(scrollview);
        scrollview->setDelegate(this);
        scrollview->setContentSize(CCSizeMake(1400, 215));
        for (int i=0; i<9; i++) {
            CCString *equipstring=CCString::createWithFormat("equip_%d.png",i+1);
            CCScale9Sprite *buttonsprite=CCScale9Sprite::create(equipstring->getCString());
            CCControlButton *button=CCControlButton::create(buttonsprite);
            button->setPreferredSize(CCSizeMake(120, 215));
            button->setPosition(i*160, visible_origin.y);
            button->setTag(100+i);
            button->addTargetWithActionForControlEvents(this, cccontrol_selector(MyStore::buyequip), CCControlEventTouchUpInside);
            scrollview->addChild(button);
        }
    }
    else if (button->getTag()==2)
    { //蘑菇商城
        this->removeChildByTag(10);
        scrollview=CCScrollView::create(CCSizeMake(700, 215));
        scrollview->setPosition(visible_center);
        scrollview->setDirection(kCCScrollViewDirectionHorizontal);
        scrollview->ignoreAnchorPointForPosition(false);
        scrollview->setTag(10);
        addChild(scrollview);
        scrollview->setDelegate(this);
        scrollview->setContentSize(CCSizeMake(700, 215));
        for (int i=0; i<3; i++) {
            CCString *equipstring=CCString::createWithFormat("equip_%d.png",i+10);
            CCScale9Sprite *buttonsprite=CCScale9Sprite::create(equipstring->getCString());
            CCControlButton *button=CCControlButton::create(buttonsprite);
            button->setPreferredSize(CCSizeMake(120, 215));
            button->setPosition(i*240, visible_origin.y);
            button->setTag(200+i);
            button->addTargetWithActionForControlEvents(this, cccontrol_selector(MyStore::buyequip), CCControlEventTouchUpInside);
            scrollview->addChild(button);
        }
    }
}
开发者ID:Stoneisgood,项目名称:Stoneisgood,代码行数:49,代码来源:MyStore.cpp


示例11: addChild

void BossLottery::initContent()
{
    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("ui/fightUI/bossLottery.plist");
    circle = CCSprite::createWithSpriteFrameName("bossLottery_bg.png");
    addChild(circle);
    
    btn = INSTANCE(ButtonUtils)->createButton("bossLottery_btn.png", CCSizeMake(157, 207), "");
    btn->setAnchorPoint(ccp(0.51, 0.37));
    addChild(btn);
    btn->setZoomOnTouchDown(false);
    
    btn->addTargetWithActionForControlEvents(this, cccontrol_selector(BossLottery::btnHandler), CCControlEventTouchUpInside);
    
    CCPoint cP = circle->getAnchorPointInPoints();
    for(int i=0;i<36;i++){
        BossLotteryLight *light = BossLotteryLight::create();
        circle->addChild(light);
        float t = i*10*3.14f/180;
        light->setPosition(ccpAdd(cP,ccp(200.0f * sin(t), 200.0f * cos(t))));
        array->addObject(light);
    }
    lightFlag = 0;
    
    getScheduler()->scheduleSelector(schedule_selector(BossLottery::updateLight), this, 0.1f, false);
    
    CCLabelTTF *desc = CCLabelTTF::create();
    desc->setFontSize(24);
    desc->setString("击杀将领");
    btn->addChild(desc);
    desc->setColor(ccYELLOW);
    desc->setPosition(ccpAdd(btn->getAnchorPointInPoints(), ccp(0, 33)));
    
    costLabel = CCLabelTTF::create();
    costLabel->setFontSize(24);
    costLabel->setColor(ccGREEN);
    btn->addChild(costLabel);
    costLabel->setPosition(ccpAdd(btn->getAnchorPointInPoints(), ccp(0, -34)));

    costLabel->setString("首次免费");

    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("common/common.plist");
    closeBtn = INSTANCE(ButtonUtils)->createButton("common_redBtn_1.png", "common_redBtn_2.png", "common_redBtn_1.png", CCSizeMake(151, 48), "关闭",24,ccYELLOW);
    addChild(closeBtn);
    closeBtn->setPosition(ccp(0, -190));
    closeBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(BossLottery::close), CCControlEventTouchUpInside);
    
    times = 1;
}
开发者ID:qokelate,项目名称:ThreeKingDoms,代码行数:48,代码来源:BossLottery.cpp


示例12: addChild

bool GeneralDialogTest::init()
{
    if (CCLayer::init())
    {
        //正常状态按钮
        CCScale9Sprite *backgroundButton = CCScale9Sprite::create("button.png");
        //按下效果
        CCScale9Sprite *backgroundHighlightedButton = CCScale9Sprite::create("buttonHighlighted.png");
        //按钮的大小根据标题变化
        CCLabelTTF *titleButton = CCLabelTTF::create("Touch Me!", "Marker Felt", 30);
        //按钮颜色
        titleButton->setColor(ccc3(159, 168, 176));
        
        CCControlButton* controlButton = CCControlButton::create(titleButton, backgroundButton);
        controlButton->setBackgroundSpriteForState(backgroundHighlightedButton, CCControlStateHighlighted);
        controlButton->setTitleColorForState(ccWHITE, CCControlStateHighlighted);
        
//        controlButton->setAnchorPoint(ccp(0.5f, 1));
        controlButton->setPosition(ccp(640/2, 960/5));
        addChild(controlButton);
        /* 当鼠标处于按下并曾经点中按钮的状态下,鼠标松开且在按钮范围内,则触发一次 */
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(GeneralDialogTest::touchUpInside), CCControlEventTouchUpInside);
        return true;
    }
    return false;
}
开发者ID:aquariusgx,项目名称:Winterfell_Test,代码行数:26,代码来源:GeneralDialogTest.cpp


示例13: CCTableViewCell

CCTableViewCell* RPGMapItemsMenuLayer::tableCellAtIndex(CCTableView *tableView, unsigned int idx)
{
    CCTableViewCell *cell = tableView->dequeueCell();
    if (!cell)
    {
        cell = new CCTableViewCell();
        cell->autorelease();
    }
    else
        cell->removeAllChildrenWithCleanup(true);
    
    float x = 100;
    for (int i = 0; i < 4; i++)
    {
        int index = idx * 4 + i;
        
        if(index >= this->m_itemsList->count())
            break;
        
        RPGExistingItems *itemsData = (RPGExistingItems*)this->m_itemsList->objectAtIndex(index);
        
        CCControlButton *itemBtn = CCControlButton::create(CCString::createWithFormat("%s (%i)", itemsData->m_name.c_str(), itemsData->m_total)->getCString(), "Arial", 22);
        itemBtn->setPosition(ccp(x, 0));
        itemBtn->setTag(itemsData->m_dataId);
        itemBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(RPGMapItemsMenuLayer::onButton), CCControlEventTouchUpInside);
        cell->addChild(itemBtn);
        
        x += 200;
    }
    
    return cell;
}
开发者ID:ChinaiOS,项目名称:OzgGameRPG,代码行数:32,代码来源:RPGMapItemsMenuLayer.cpp


示例14: addChild

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);

}
开发者ID:sharpfforg,项目名称:us,代码行数:27,代码来源:AssetsUpdateLayer.cpp


示例15: cccontrol_selector

bool SkillTableView::init()
{
    if (!Node::init())
        return false;

    LayerColor* bg = LayerColor::create(Color4B(255, 255, 255, 127), 450, 500);
    bg->setPosition(bg->getContentSize()/-2);
    this->addChild(bg, -1);
    
    CCLabelTTF* title = CCLabelTTF::create("技能列表", "fonts/Marker Felt.ttf", 40);
    title->setPosition(Point(bg->getContentSize().width/2, bg->getContentSize().height-30));
    bg->addChild(title);
    
    ControlButton* button = ControlButton::create(Scale9Sprite::create("ui/closed_normal.png"));
    button->setBackgroundSpriteForState(Scale9Sprite::create("ui/closed_selected.png"), Control::State::HIGH_LIGHTED);
    button->setPreferredSize(Size(57, 58));
    button->setPosition(ccpSub(ccpAdd(bg->getPosition(), bg->getContentSize()), button->getContentSize()/2));
    this->addChild(button);
    button->addTargetWithActionForControlEvents(GAME_UILAYER, cccontrol_selector(GameInfoUIController::removeSmallMenuAndButton), Control::EventType::TOUCH_UP_INSIDE);
   // button->setTouchPriority(0);
    
    m_skillTableView = TableView::create(this, Size(420, 420));
    m_skillTableView->setPosition(Point(15, 15));
   // m_skillTableView->setDirection(kCCScrollViewDirectionVertical);
    m_skillTableView->setDelegate(this);
   // m_skillTableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    bg->addChild(m_skillTableView);
    m_skillTableView->reloadData();
    return true;
}
开发者ID:gujianhesong,项目名称:GujianDream,代码行数:30,代码来源:SkillTableView.cpp


示例16: addChild

bool CCControlSliderTest::init()
{
    if (CCControlScene::init())
    {
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();

        // Add a label in which the slider value will be displayed
        m_pDisplayValueLabel = CCLabelTTF::create("Move the slider thumb!" ,"Marker Felt", 32);
        m_pDisplayValueLabel->retain();
        m_pDisplayValueLabel->setAnchorPoint(ccp(0.5f, -1.0f));
        m_pDisplayValueLabel->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f));
        addChild(m_pDisplayValueLabel);

        // Add the slider
        CCControlSlider *slider = CCControlSlider::create("extensions/sliderTrack.png","extensions/sliderProgress.png" ,"extensions/sliderThumb.png");
        slider->setAnchorPoint(ccp(0.5f, 1.0f));
        slider->setMinimumValue(0.0f); // Sets the min value of range
        slider->setMaximumValue(5.0f); // Sets the max value of range
        slider->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f));

        // When the value of the slider will change, the given selector will be call
        slider->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlSliderTest::valueChanged), CCControlEventValueChanged);

        addChild(slider);    
        return true;
    }
    return false;
}
开发者ID:csdnnet,项目名称:hiygame,代码行数:28,代码来源:CCControlSliderTest.cpp


示例17: __createSystemEditBox

bool CCEditBox::initWithSizeAndBackgroundSprite(const CCSize& size, CCScale9Sprite* pPressed9SpriteBg)
{
    if (CCControlButton::initWithBackgroundSprite(pPressed9SpriteBg))
    {
        m_pEditBoxImpl = __createSystemEditBox(this);
        m_pEditBoxImpl->initWithSize(size);
        
        this->setPreferredSize(size);
        this->setPosition(ccp(0, 0));
        this->setZoomOnTouchDown(false);
        this->addTargetWithActionForControlEvent(this, cccontrol_selector(CCEditBox::touchDownAction), CCControlEventTouchUpInside);
        
        m_textHolderLabel = CCLabelTTF::create("", "TrebuchetMS", size.height*2/3);
        m_textHolderLabel->setAnchorPoint(ccp(0.0f, 0.5f));
        m_textHolderLabel->setPosition(ccp(2.0f, size.height * 0.5f));
        m_textHolderLabel->setColor(m_colPlaceHolder);
        addChild(m_textHolderLabel, 255);
        
        m_textLabel = CCLabelTTF::create("", "TrebuchetMS", size.height*2/3);
        m_textLabel->setAnchorPoint(ccp(0.0f, 0.5f));
        m_textLabel->setPosition(ccp(2.0f, size.height * 0.5f));
        m_textLabel->setColor(m_colText);
        addChild(m_textLabel, 255);
        
        return true;
    }
    return false;
}
开发者ID:sunxiaoyu,项目名称:CCEditBox2.1.4,代码行数:28,代码来源:CCEditBox.cpp


示例18: cccontrol_selector

bool PropColumnMenu::init()
{
    if (!Layer::init())
        return false;
    
    this->setTouchEnabled(true);
    
    Sprite* bg = Sprite::create("ui/prop_column.png");
    this->addChild(bg);
    
    m_propColumn = LayerColor::create(ccc4(255, 255, 255, 0), GRID_WIDTH*COL, GRID_HEIGHT*ROW);
    m_propColumn->setContentSize(Size(GRID_WIDTH*COL, GRID_HEIGHT*ROW));
    m_propColumn->setPosition(Point(PROP_X, PROP_Y));
    bg->addChild(m_propColumn);
    
    ControlButton* button = ControlButton::create(ui::Scale9Sprite::create("ui/closed_normal.png"));
    button->setBackgroundSpriteForState(ui::Scale9Sprite::create("ui/closed_selected.png"), Control::State::HIGH_LIGHTED);
    button->setPreferredSize(Size(57, 58));
    button->setPosition(ccpSub(ccpAdd(bg->getPosition(), bg->getContentSize()/2), button->getContentSize()/2));
    this->addChild(button);
    button->addTargetWithActionForControlEvents(GAME_UILAYER, cccontrol_selector(GameInfoUIController::removeSmallMenuAndButton), Control::EventType::TOUCH_UP_INSIDE);
   // button->setTouchPriority(0);
    
    for (int i=0; i<12; i++)
    {
        m_propVec[i] = PropIconShow::create(PropSystem::getPropInfo(i+1));
        m_propColumn->addChild(m_propVec[i]);
    }

    return true;
}
开发者ID:dzwdyc,项目名称:codesssssssss,代码行数:31,代码来源:PropColumn.cpp


示例19: removeSelector

SEL_CCControlHandler CCBScriptCallbackProxy::onResolveCCBCCControlSelector(CCObject * pTarget,
                                                                           const char * pSelectorName) {
    
    this->callBackProp = pSelectorName;
    removeSelector(this->callBackProp);
    return cccontrol_selector(CCBScriptCallbackProxy::controlCallback);
}
开发者ID:CodeSnooker,项目名称:cocos2d-x,代码行数:7,代码来源:js_bindings_ccbreader.cpp


示例20: cccontrol_selector

void HelloWorld::testControlBtn()
{
    //创建正常状态下九宫格精灵
    auto btnNormal = Scale9Sprite::create("switch-on.png");
    
    //创建点击状态下九宫格精灵
    auto  btnSelected = Scale9Sprite::create("switch-off.png");
    
    /*创建标题*/
    auto title = LabelTTF::create("", "Marker Felt", 30);
    
    
    /* 根据标题和九宫格图片创建按钮 */
    auto  controlBtn = ControlButton::create(title, btnNormal);
    //setPreferredSize 设置大小*/
    controlBtn->setPreferredSize(Size(128, 128));
    
    /* 设置点击时候显示的图片 */
    controlBtn->setBackgroundSpriteForState(btnSelected, Control::State::HIGH_LIGHTED);
    
    controlBtn->setPosition(Point(200, 200));
    //注册事件
    controlBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(HelloWorld::btnClicked), Control::EventType::TOUCH_UP_INSIDE);
    controlBtn->setTag(10);
    this->addChild(controlBtn);
}
开发者ID:zhaoyibo2014,项目名称:poluo,代码行数:26,代码来源:HelloWorldScene.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ccg函数代码示例发布时间:2022-05-30
下一篇:
C++ ccc4f函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap