您的位置:首页 > 移动开发 > Cocos引擎

8.cocos2dx 开关 CCControlSwitch

2013-12-20 14:51 501 查看
CCLabelTTF *labe1=CCLabelTTF::create("开", "Arial-BoldMT", 16);
labe1->setColor(ccc3(255, 0, 0));
CCLabelTTF *labe2=CCLabelTTF::create("关", "Arial-BoldMT", 16);
CCSprite *sprite2=CCSprite::create("Icon-72.png");
sprite2->setColor(ccc3(0, 255, 0));
labe2->setColor(ccc3(255, 0, 0));
cocos2d::extension::CCControlSwitch *pSwitch=cocos2d::extension::CCControlSwitch::create(
CCSprite::create("Icon-72.png"),
CCSprite::create("Icon-72.png"),
sprite2,
sprite2,
labe1,
labe2

);

//设置关闭状态
pSwitch->setOn(false);
//设置可操作
pSwitch->setEnabled(true);
//获取是否为打开
pSwitch->setEnabled(true);

pSwitch->setPosition(ccp(200, 200));
this->addChild(pSwitch);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐