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);
180 #pragma mark Static Constructors
197 static std::shared_ptr<AnimationNode>
alloc(
const std::shared_ptr<Texture>& texture,
198 int rows,
int cols) {
199 std::shared_ptr<AnimationNode> node = std::make_shared<AnimationNode>();
200 return (node->initWithFilmstrip(texture,rows,cols) ? node :
nullptr);
222 static std::shared_ptr<AnimationNode>
alloc(
const std::shared_ptr<Texture>& texture,
223 int rows,
int cols,
int size) {
224 std::shared_ptr<AnimationNode> node = std::make_shared<AnimationNode>();
225 return (node->initWithFilmstrip(texture,rows,cols,size) ? node :
nullptr);
255 const std::shared_ptr<JsonValue> data) {
256 std::shared_ptr<AnimationNode> result = std::make_shared<AnimationNode>();
257 if (!result->initWithData(loader,data)) { result =
nullptr; }
258 return std::dynamic_pointer_cast<
Node>(result);
263 #pragma mark Attribute Accessors
unsigned int getFrame() const
Definition: CUAnimationNode.h:276
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:269
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:254
Definition: CUSceneLoader.h:77
static std::shared_ptr< AnimationNode > alloc(const std::shared_ptr< Texture > &texture, int rows, int cols)
Definition: CUAnimationNode.h:197
static std::shared_ptr< AnimationNode > alloc(const std::shared_ptr< Texture > &texture, int rows, int cols, int size)
Definition: CUAnimationNode.h:222
Definition: CUAction.h:51
int _size
Definition: CUAnimationNode.h:82
Definition: CUAnimationNode.h:77
~AnimationNode()
Definition: CUAnimationNode.h:108