cocos2dx 开关 CCControlSwitch
2013-03-31 20:06
399 查看
// CCLabelTTF * label1 = CCLabelTTF::create("开", "Arial-BodMT", 16); CCLabelTTF * label2 = CCLabelTTF ::create("关", "Arial-BodMT", 16); // 创建CCControlSwitch 开关 // 参数1: 掩饰底图 // 参数2 作为打开状态 // 参数3 作为关闭状态 // 参数4 作为开关触发图 // 参数5 作为打开的文字 // 参数6 作为关闭的文字 CCControlSwitch * pSwitch = CCControlSwitch ::create(CCSprite::create("switch-mask.png"), CCSprite::create("switch-on.png"), CCSprite::create("switch-on.png"), CCSprite::create("switch-off.png"),label1,label2); // CCControlSwitch * pSwitch = CCControlSwitch::create(<#cocos2d::CCSprite *maskSprite#>, <#cocos2d::CCSprite *onSprite#>, <#cocos2d::CCSprite *offSprite#>, <#cocos2d::CCSprite *thumbSprite#>) pSwitch->setPosition(ccp(200, 200)); // 设置关闭状态 pSwitch->setOn(false); // 可操作 pSwitch->setEnabled(true); // 获取是否打开 CCLOG("是否打开%i",pSwitch->isOn()); // 获取当前开关状态是否为手动拖动开关进行的 CCLOG("关状态是否为手动拖动开关 %i",pSwitch->hasMoved()); // // 输出 CCLabelTTF * la = CCLabelTTF::create(" ", "Arial-BodMT", 16); la->setPosition(ccp(200, 100)); la->setString(CCString::createWithFormat("%i",pSwitch->hasMoved())->getCString()); addChild(la); addChild(pSwitch);
相关文章推荐
- cocos2dx基础篇(10)——开关按钮CCControlSwitch
- cocos2dx-CCControlSwitch
- cocos2dx-CCControlSwitch
- Cocos2d—X游戏开发之CCToggle(菜单标签切换)CCControlSwitch(开关切换)(十二)
- Cocos2d-x学习笔记(12)(CCControlSwitch开关、CCControlSlider滑动条、CCControlButton按钮)
- Cocos2D-x 用CCControlSwitch设置音乐的开关
- cocos2dx CCControlSwitch
- cocos2dx CCControlSwitch
- Cocos2d-x_CCControlSwitch(开关类)介绍
- cocos2dX UI控件之CCControlSwitch
- Cocos2d—X游戏开发之CCToggle(菜单标签切换)CCControlSwitch(开关切换)
- CCControlSwitch 开关
- 和屌丝一起学cocos2dx-CCControlSwitch
- 8.cocos2dx 开关 CCControlSwitch
- Cocos2d-x学习笔记(12)(CCControlSwitch开关、CCControlSlider滑动条、CCControlButtonbutton)
- CCControlSwitch 开关
- 1cocos2dx扩展库UI控件,CCControlSlider,CCScale9Sprite(九妹图),CCControlSwitch,CCControlButton
- CCControlSwitch 、CCControlSlider、CCControlButton
- cocos2dx之创建CCControlSlider
- cocos2dx-CCControlSlider