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);
8.cocos2dx 开关 CCControlSwitch
最新推荐文章于 2018-09-06 09:51:14 发布