44 #ifndef __CU_ANIMATION_NODE_H__
45 #define __CU_ANIMATION_NODE_H__
47 #include <cugl/2d/CUPolygonNode.h>
48 #include <cugl/math/CURect.h>
49 #include <cugl/renderer/CUTexture.h>
55 #pragma mark AnimationNode
89 #pragma mark Constructors
148 bool initWithFilmstrip(
const std::shared_ptr<Texture>& texture,
int rows,
int cols,
int size);
175 #pragma mark Static Constructors
192 static std::shared_ptr<AnimationNode>
alloc(
const std::shared_ptr<Texture>& texture,
193 int rows,
int cols) {
194 std::shared_ptr<AnimationNode> node = std::make_shared<AnimationNode>();
195 return (node->initWithFilmstrip(texture,rows,cols) ? node :
nullptr);
217 static std::shared_ptr<AnimationNode>
alloc(
const std::shared_ptr<Texture>& texture,
218 int rows,
int cols,
int size) {
219 std::shared_ptr<AnimationNode> node = std::make_shared<AnimationNode>();
220 return (node->initWithFilmstrip(texture,rows,cols,size) ? node :
nullptr);
245 const std::shared_ptr<JsonValue>& data) {
246 std::shared_ptr<AnimationNode> result = std::make_shared<AnimationNode>();
247 if (!result->initWithData(loader,data)) { result =
nullptr; }
248 return std::dynamic_pointer_cast<
Node>(result);
253 #pragma mark Attribute Accessors
unsigned int getFrame() const
Definition: CUAnimationNode.h:266
int _frame
Definition: CUAnimationNode.h:84
int _cols
Definition: CUAnimationNode.h:80
bool initWithFilmstrip(const std::shared_ptr< Texture > &texture, int rows, int cols)
Definition: CUAnimationNode.h:126
virtual bool initWithData(const SceneLoader *loader, const std::shared_ptr< JsonValue > &data) override
Definition: CUPolygonNode.h:79
int getSize() const
Definition: CUAnimationNode.h:259
virtual void dispose() override
Rect _bounds
Definition: CUAnimationNode.h:86
static std::shared_ptr< Node > allocWithData(const SceneLoader *loader, const std::shared_ptr< JsonValue > &data)
Definition: CUAnimationNode.h:244
Definition: CUSceneLoader.h:77
static std::shared_ptr< AnimationNode > alloc(const std::shared_ptr< Texture > &texture, int rows, int cols)
Definition: CUAnimationNode.h:192
static std::shared_ptr< AnimationNode > alloc(const std::shared_ptr< Texture > &texture, int rows, int cols, int size)
Definition: CUAnimationNode.h:217
Definition: CUAction.h:51
int _size
Definition: CUAnimationNode.h:82
Definition: CUAnimationNode.h:77
~AnimationNode()
Definition: CUAnimationNode.h:108