41 #ifndef __CU_PROGRESS_BAR_H__
42 #define __CU_PROGRESS_BAR_H__
43 #include <cugl/2d/CUNode.h>
44 #include <cugl/2d/CUPolygonNode.h>
78 #pragma mark Constructors
104 virtual void dispose()
override;
115 CUAssertLog(
false,
"This node does not support the empty initializer");
131 return initWithCaps(
nullptr,
nullptr,
nullptr,
nullptr,size);
146 bool init(
const std::shared_ptr<Texture>& background) {
147 return initWithCaps(background,
nullptr,
nullptr,
nullptr);
163 bool init(
const std::shared_ptr<Texture>& background,
const Size& size) {
164 return initWithCaps(background,
nullptr,
nullptr,
nullptr,size);
179 bool init(
const std::shared_ptr<Texture>& background,
180 const std::shared_ptr<Texture>& foreground) {
181 return initWithCaps(background,foreground,
nullptr,
nullptr);
197 bool init(
const std::shared_ptr<Texture>& background,
198 const std::shared_ptr<Texture>& foreground,
200 return initWithCaps(background,foreground,
nullptr,
nullptr,size);
217 bool initWithCaps(
const std::shared_ptr<Texture>& background,
218 const std::shared_ptr<Texture>& foreground,
219 const std::shared_ptr<Texture>& beginCap,
220 const std::shared_ptr<Texture>& finalCap);
237 bool initWithCaps(
const std::shared_ptr<Texture>& background,
238 const std::shared_ptr<Texture>& foreground,
239 const std::shared_ptr<Texture>& beginCap,
240 const std::shared_ptr<Texture>& finalCap,
271 #pragma mark Static Constructors
283 static std::shared_ptr<ProgressBar>
alloc(
const Size& size) {
284 std::shared_ptr<ProgressBar> node = std::make_shared<ProgressBar>();
285 return (node->init(size) ? node :
nullptr);
300 static std::shared_ptr<ProgressBar>
alloc(
const std::shared_ptr<Texture>& background) {
301 std::shared_ptr<ProgressBar> node = std::make_shared<ProgressBar>();
302 return (node->init(background) ? node :
nullptr);
318 static std::shared_ptr<ProgressBar>
alloc(
const std::shared_ptr<Texture>& background,
const Size& size) {
319 std::shared_ptr<ProgressBar> node = std::make_shared<ProgressBar>();
320 return (node->init(background,size) ? node :
nullptr);
335 static std::shared_ptr<ProgressBar>
alloc(
const std::shared_ptr<Texture>& background,
336 const std::shared_ptr<Texture>& foreground) {
337 std::shared_ptr<ProgressBar> node = std::make_shared<ProgressBar>();
338 return (node->init(background,foreground) ? node :
nullptr);
354 static std::shared_ptr<ProgressBar>
alloc(
const std::shared_ptr<Texture>& background,
355 const std::shared_ptr<Texture>& foreground,
357 std::shared_ptr<ProgressBar> node = std::make_shared<ProgressBar>();
358 return (node->init(background,foreground,size) ? node :
nullptr);
375 static std::shared_ptr<ProgressBar>
allocWithCaps(
const std::shared_ptr<Texture>& background,
376 const std::shared_ptr<Texture>& foreground,
377 const std::shared_ptr<Texture>& beginCap,
378 const std::shared_ptr<Texture>& finalCap) {
379 std::shared_ptr<ProgressBar> node = std::make_shared<ProgressBar>();
380 return (node->initWithCaps(background,foreground,beginCap,finalCap) ? node :
nullptr);
398 static std::shared_ptr<ProgressBar>
allocWithCaps(
const std::shared_ptr<Texture>& background,
399 const std::shared_ptr<Texture>& foreground,
400 const std::shared_ptr<Texture>& beginCap,
401 const std::shared_ptr<Texture>& finalCap,
403 std::shared_ptr<ProgressBar> node = std::make_shared<ProgressBar>();
404 return (node->initWithCaps(background,foreground,beginCap,finalCap,size) ? node :
nullptr);
433 const std::shared_ptr<JsonValue> data) {
434 std::shared_ptr<ProgressBar> result = std::make_shared<ProgressBar>();
435 if (!result->initWithData(loader,data)) { result =
nullptr; }
436 return std::dynamic_pointer_cast<
Node>(result);
440 #pragma mark Properties
static std::shared_ptr< ProgressBar > alloc(const std::shared_ptr< Texture > &background, const std::shared_ptr< Texture > &foreground)
Definition: CUProgressBar.h:335
bool init(const std::shared_ptr< Texture > &background, const std::shared_ptr< Texture > &foreground)
Definition: CUProgressBar.h:179
bool init(const Size &size)
Definition: CUProgressBar.h:130
static std::shared_ptr< ProgressBar > allocWithCaps(const std::shared_ptr< Texture > &background, const std::shared_ptr< Texture > &foreground, const std::shared_ptr< Texture > &beginCap, const std::shared_ptr< Texture > &finalCap, const Size &size)
Definition: CUProgressBar.h:398
void setForegroundColor(Color4 color)
std::shared_ptr< PolygonNode > _finalcap
Definition: CUProgressBar.h:74
virtual void dispose() override
Size _foresize
Definition: CUProgressBar.h:65
float getProgress() const
Definition: CUProgressBar.h:449
bool init(const std::shared_ptr< Texture > &background)
Definition: CUProgressBar.h:146
bool initWithCaps(const std::shared_ptr< Texture > &background, const std::shared_ptr< Texture > &foreground, const std::shared_ptr< Texture > &beginCap, const std::shared_ptr< Texture > &finalCap)
Color4 getForegroundColor() const
Definition: CUProgressBar.h:490
static std::shared_ptr< Node > allocWithData(const SceneLoader *loader, const std::shared_ptr< JsonValue > data)
Definition: CUProgressBar.h:432
bool init(const std::shared_ptr< Texture > &background, const std::shared_ptr< Texture > &foreground, const Size &size)
Definition: CUProgressBar.h:197
static std::shared_ptr< ProgressBar > alloc(const std::shared_ptr< Texture > &background, const Size &size)
Definition: CUProgressBar.h:318
std::shared_ptr< PolygonNode > _foreground
Definition: CUProgressBar.h:70
static std::shared_ptr< ProgressBar > alloc(const std::shared_ptr< Texture > &background, const std::shared_ptr< Texture > &foreground, const Size &size)
Definition: CUProgressBar.h:354
Color4 getBackgroundColor() const
Definition: CUProgressBar.h:469
Definition: CUSceneLoader.h:77
float _progress
Definition: CUProgressBar.h:63
Definition: CUProgressBar.h:60
virtual bool init() override
Definition: CUProgressBar.h:114
static std::shared_ptr< ProgressBar > allocWithCaps(const std::shared_ptr< Texture > &background, const std::shared_ptr< Texture > &foreground, const std::shared_ptr< Texture > &beginCap, const std::shared_ptr< Texture > &finalCap)
Definition: CUProgressBar.h:375
std::shared_ptr< PolygonNode > _begincap
Definition: CUProgressBar.h:72
std::shared_ptr< PolygonNode > _background
Definition: CUProgressBar.h:68
ProgressBar()
Definition: CUProgressBar.h:87
Definition: CUColor4.h:1084
static std::shared_ptr< ProgressBar > alloc(const std::shared_ptr< Texture > &background)
Definition: CUProgressBar.h:300
Definition: CUAction.h:51
void setBackgroundColor(Color4 color)
Definition: CUProgressBar.h:479
static std::shared_ptr< ProgressBar > alloc(const Size &size)
Definition: CUProgressBar.h:283
~ProgressBar()
Definition: CUProgressBar.h:92
bool initWithData(const SceneLoader *loader, const std::shared_ptr< JsonValue > data) override
void setProgress(float progress)
bool init(const std::shared_ptr< Texture > &background, const Size &size)
Definition: CUProgressBar.h:163