323 Size widgetSize =
_widget->getContentSize();
326 Text *alert = Text::create(
"LoadingBar right scale9 render",
"fonts/Marker Felt.ttf", 20);
327 alert->setColor(Color3B(159, 168, 176));
328 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 2.7f));
332 LoadingBar* loadingBar = LoadingBar::create(
"cocosui/sliderThumb.png");
333 loadingBar->setTag(0);
334 loadingBar->ignoreContentAdaptWithSize(
false);
336 loadingBar->setCapInsets(Rect(0, 0, 0, 0));
337 loadingBar->setContentSize(Size(200, 80));
338 loadingBar->setDirection(LoadingBar::Direction::LEFT);
339 loadingBar->setPercent(100);
341 loadingBar->setTouchEnabled(
true);
342 loadingBar->addTouchEventListener([=](Ref* sender, Widget::TouchEventType type){
343 if (type == Widget::TouchEventType::ENDED) {
344 if (loadingBar->isScale9Enabled())
346 loadingBar->setScale9Enabled(false);
349 loadingBar->setScale9Enabled(
true);
353 loadingBar->setPosition(Vec2(widgetSize.width / 2.0f,
354 widgetSize.height / 2.0f + loadingBar->getContentSize().height / 4.0f));
cocos2d::Layer * _uiLayer
virtual bool init() override
cocos2d::ui::Layout * _widget