Jin_90
April 19, 2015, 6:01pm
#1
hello guys, i need of the your help, the question is simple, how do you do this with the immages obtained of the .plist?
auto slider1 = cocos2d::ui::Slider::create();
slider1->loadBarTexture("sliderBelow.png");
slider1->loadSlidBallTextures("sliderBall.png", "sliderBall.png", "");
slider1->loadProgressBarTexture("sliderAbove.png");
slider1->setScale9Enabled(true);
slider1->setCapInsets(Rect(0, 0, 0, 0));
slider1->setContentSize(Size(200 * 4, 10 * 4));
slider1->setPosition(Vec2(visibleSize.width / 2.0f, visibleSize.height / 2.0f));
slider1->setPercent(100);
slider1->addEventListener(CC_CALLBACK_2(Opzioni::sliderEvent, this));
this->addChild(slider1, 1);
Help me please
p_VS
April 19, 2015, 8:14pm
#2
most function loadTexture support param TextureResType texType = TextureResType::LOCAL, for sprite sheet need TextureResType::PLIST
you example:
slider1->loadBarTexture("sliderBelow.png", TextureResType::PLIST);
slider1->loadSlidBallTextures("sliderBall.png", "sliderBall.png", "", TextureResType::PLIST);
slider1->loadProgressBarTexture("sliderAbove.png", TextureResType::PLIST);
.plist must already be loaded
legom
November 1, 2015, 8:11pm
#5
It seems that TextureResType is deprecated, I can’t find what to use instead, any idea ?
The latest stable release (3.8.1) is still using TextureResType, from my understanding. Even if it is deprecated, you should be able to use it without much issue (other than compiler warnings).