标签:
滑动栏:
Slider * slider = Slider::create();
slider->loadBarTexture("sliderTrack.png");//设置滑动栏的背景图片this->addChild(slider);
void HelloWorld::sliderEvent(Ref * pSender, Slider::EventType type)
{
if (type == Slider::EventType::ON_PERCENTAGE_CHANGED)
{
Slider * slider = dynamic_cast<Slider *>(pSender);
int percent = slider->getPercent();
//获取当前滑动的百分比
auto label = static_cast<Label *>(getChildByTag(11));
label->setString(String::createWithFormat("Perfecnt %d", percent)->getCString());
//使用该百分比
}
}
Cocos2d-x3.3Final(6)Slider常用成员函数(C++)
标签:
原文地址:http://blog.csdn.net/lightupheaven/article/details/43452557