|
CUGL 1.3
Cornell University Game Library
|
41 #ifndef __CU_MOVE_ACTION_H__
42 #define __CU_MOVE_ACTION_H__
71 #pragma mark Constructors
114 return init(delta,0.0f);
128 bool init(
const Vec2& delta,
float time);
130 #pragma mark Static Constructors
139 static std::shared_ptr<MoveBy>
alloc() {
140 std::shared_ptr<MoveBy> result = std::make_shared<MoveBy>();
141 return (result->init() ? result :
nullptr);
154 static std::shared_ptr<MoveBy>
alloc(
const Vec2& delta) {
155 std::shared_ptr<MoveBy> result = std::make_shared<MoveBy>();
156 return (result->init(delta) ? result :
nullptr);
170 static std::shared_ptr<MoveBy>
alloc(
const Vec2& delta,
float time) {
171 std::shared_ptr<MoveBy> result = std::make_shared<MoveBy>();
172 return (result->init(delta,time) ? result :
nullptr);
175 #pragma mark Atributes
196 #pragma mark Animation Methods
202 virtual std::shared_ptr<Action>
clone()
override;
214 virtual void update(
const std::shared_ptr<Node>& target, Uint64* state,
float dt)
override;
216 #pragma mark Debugging Methods
227 virtual std::string
toString(
bool verbose =
false)
const override;
253 #pragma mark Constructors
296 return init(target,0.0f);
309 bool init(
const Vec2& target,
float time);
311 #pragma mark Static Constructors
320 static std::shared_ptr<MoveTo>
alloc() {
321 std::shared_ptr<MoveTo> result = std::make_shared<MoveTo>();
322 return (result->init() ? result :
nullptr);
334 static std::shared_ptr<MoveTo>
alloc(
const Vec2& target) {
335 std::shared_ptr<MoveTo> result = std::make_shared<MoveTo>();
336 return (result->init(target) ? result :
nullptr);
349 static std::shared_ptr<MoveTo>
alloc(
const Vec2& target,
float time) {
350 std::shared_ptr<MoveTo> result = std::make_shared<MoveTo>();
351 return (result->init(target, time) ? result :
nullptr);
354 #pragma mark Attributes
375 #pragma mark Animation Methods
381 virtual std::shared_ptr<Action>
clone()
override;
392 virtual void load(
const std::shared_ptr<Node>& target, Uint64* state)
override;
404 virtual void update(
const std::shared_ptr<Node>& target, Uint64* state,
float dt)
override;
406 #pragma mark Debugging Methods
417 virtual std::string
toString(
bool verbose =
false)
const override;
virtual std::string toString(bool verbose=false) const override
Definition: CUAction.h:70
bool init(const Vec2 &delta)
Definition: CUMoveAction.h:113
void dispose()
Definition: CUMoveAction.h:272
Vec2 _target
Definition: CUMoveAction.h:250
static const Vec2 ZERO
Definition: CUVec2.h:71
Definition: CUMoveAction.h:65
Vec2 _delta
Definition: CUMoveAction.h:68
static std::shared_ptr< MoveTo > alloc(const Vec2 &target)
Definition: CUMoveAction.h:334
static std::shared_ptr< MoveBy > alloc(const Vec2 &delta, float time)
Definition: CUMoveAction.h:170
virtual void load(const std::shared_ptr< Node > &target, Uint64 *state) override
virtual std::string toString(bool verbose=false) const override
~MoveTo()
Definition: CUMoveAction.h:265
bool init()
Definition: CUMoveAction.h:282
static std::shared_ptr< MoveBy > alloc(const Vec2 &delta)
Definition: CUMoveAction.h:154
MoveTo()
Definition: CUMoveAction.h:260
static std::shared_ptr< MoveTo > alloc(const Vec2 &target, float time)
Definition: CUMoveAction.h:349
void setTarget(const Vec2 &target)
Definition: CUMoveAction.h:373
static std::shared_ptr< MoveTo > alloc()
Definition: CUMoveAction.h:320
void dispose()
Definition: CUMoveAction.h:90
static std::shared_ptr< MoveBy > alloc()
Definition: CUMoveAction.h:139
virtual void update(const std::shared_ptr< Node > &target, Uint64 *state, float dt) override
const Vec2 & getDelta() const
Definition: CUMoveAction.h:184
void setDelta(const Vec2 &delta)
Definition: CUMoveAction.h:194
bool init()
Definition: CUMoveAction.h:99
MoveBy()
Definition: CUMoveAction.h:78
virtual std::shared_ptr< Action > clone() override
~MoveBy()
Definition: CUMoveAction.h:83
virtual std::shared_ptr< Action > clone() override
const Vec2 & getTarget() const
Definition: CUMoveAction.h:363
virtual void update(const std::shared_ptr< Node > &target, Uint64 *state, float dt) override
bool init(const Vec2 &target)
Definition: CUMoveAction.h:295
Definition: CUMoveAction.h:247