| 21 | #include "GameToolbox/getTextureString.h" |
| 22 | |
| 23 | bool SimpleProgressBar::init() |
| 24 | { |
| 25 | _pGroove = ax::Sprite::create(GameToolbox::getTextureString("slidergroove_02.png")); |
| 26 | _pBar = ax::Sprite::create(GameToolbox::getTextureString("sliderBar.png")); |
| 27 | |
| 28 | // config |
| 29 | _pGroove->setStretchEnabled(false); |
| 30 | _pBarWidth = _pGroove->getContentSize().width - 4; |
| 31 | _pBar->setStretchEnabled(false); |
| 32 | _pBar->getTexture()->setTexParameters({ ax::backend::SamplerFilter::NEAREST, ax::backend::SamplerFilter::NEAREST, ax::backend::SamplerAddressMode::REPEAT, ax::backend::SamplerAddressMode::REPEAT }); |
| 33 | _pBar->setAnchorPoint({0, 0}); |
| 34 | _pBar->setPosition({2.f, 1.25f}); |
| 35 | |
| 36 | // add everything |
| 37 | _pGroove->addChild(_pBar, -1); |
| 38 | addChild(_pGroove); |
| 39 | |
| 40 | scheduleUpdate(); |
| 41 | return true; |
| 42 | } |
| 43 | void SimpleProgressBar::update(float delta) |
| 44 | { |
| 45 | if(_pPercentage > 100.f) |
nothing calls this directly
no test coverage detected