MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / init

Method init

Source/SimpleProgressBar.cpp:23–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21#include "GameToolbox/getTextureString.h"
22
23bool 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}
43void SimpleProgressBar::update(float delta)
44{
45 if(_pPercentage > 100.f)

Callers

nothing calls this directly

Calls 2

createFunction · 0.85
setPositionMethod · 0.80

Tested by

no test coverage detected