AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzAnimInstance Class Reference

An instance of an animation object. More...

#include <CzAnim.h>

List of all members.

Public Member Functions

void setParent (CzAnimTimeline *parent)
CzAnimTimelinegetParent ()
CzAnimgetAnimation ()
void setAnimation (CzAnim *anim)
 Assigns a CzAnim animation to this animation instance.
void setManaged (bool managed)
bool isManaged () const
int getRepeatCount () const
void setRepeatCount (int repeat_count)
void setCurrentTime (float current_time)
float getCurrentTime () const
bool isFinished () const
CzAnimFramegetCurrentData ()
unsigned int getTargetPropertyHash ()
IzAnimTargetgetTargetElement ()
void setTarget (IzAnimTarget *element, const char *property_name)
void setTargetElement (IzAnimTarget *element)
float getDelay () const
void setDelay (float delay)
bool isStarted () const
bool isStopped () const
bool isPlaying () const
bool isPaused () const
bool isDelayed () const
void restart ()
void play ()
void stop ()
void pause ()
void setStartedCallback (CzCallback callback)
void setStoppedCallback (CzCallback callback)
void setLoopedCallback (CzCallback callback)
bool isCurrentDataValid () const
void setDelta (bool is_delta)
bool isDelta () const
void setInterpolate (bool interpolate)
bool isInterpolated () const
void addEventsManager ()
CzEventManagergetEventsManager ()
 CzAnimInstance ()
virtual ~CzAnimInstance ()
virtual bool Update (float dt, IzAnimTarget *target=NULL)
 Updates the animation instance.
virtual void UpdateTargetOnly (IzAnimTarget *target)
 Updates the instances target only.
virtual void ForceUpdateTargetOnly (IzAnimTarget *target)
 Updates the instances target only.
virtual void ProcessEventActions (unsigned int event_name)
 Process the event actions described by event_name.
virtual void NotifyStart ()
 This event is called when this aimation instance is started.
virtual void NotifyEnd ()
 This event is called when this aimation instance stopped playing.
virtual void NotifyRepeat ()
 This event is called when this aimation instance repeats.

Protected Attributes

CzAnimTimelineParent
 Parent timeline.
CzAnimAnimation
 Animation to use.
bool Managed
 True if managed by a CzAnimInstanceManager.
int RepeatCount
 Number of times to replay the animation.
float CurrentTime
 Current animation time (0 is start of animation)
CzAnimFrameCurrentData
 The current interpolated data for the current time.
CzAnim::eAnimStatus Status
 Status of the animation.
bool Started
 If set to true then the animation has started playing.
IzAnimTargetTarget
 Target object to update.
unsigned int TargetPropertyHash
 Target object property name as a string hash to update.
float Delay
 Amount of time to delay starting the animation.
bool DelayExpired
 true if initial delay has expired
CzCallback StartedCallback
 Callback which is called when the animation starts playing.
CzCallback StoppedCallback
 Callback which is called when the animation stops playing.
CzCallback LoopedCallback
 Callback which is called when the animation loops.
bool CurrentDataValid
 True if current frame data is valid.
bool IsDelta
 Delta animation should update the target variables value instead of replacing it.
bool Interpolate
 If true then the interpolated valiue between key frames will be calculated and applied.
CzEventManagerEventsManager
 List of events that the animation handles.
int RepeatedCount

Detailed Description

An instance of an animation object.

CzAnim is not played directly, instead you create an instance of it using CzAnimInstance:

// Create and set up an animation
CzAnimInstance* face_anim = new CzAnimInstance();
face_anim->setAnimation(anim);
face_anim->setTarget(actor, "SrcRect");

Note the following line of code:

face_anim->setTarget(actor, "SrcRect");

This line of code tells the animation to modify the "SrcRect" (the actors image atlas position) property of the actor object, causing the image to change.

Animation instances can be played, paused, resumed, stopped and restarted. You can also tell an animation to delay playing for a finite period of time.


Constructor & Destructor Documentation


Member Function Documentation

Updates the instances target only.

This method force updates this animation instances target only, even if th animation is not playing.

Parameters:
[in,out]targetIf non-null, the target.
float CzAnimInstance::getCurrentTime ( ) const [inline]
float CzAnimInstance::getDelay ( ) const [inline]
int CzAnimInstance::getRepeatCount ( ) const [inline]
unsigned int CzAnimInstance::getTargetPropertyHash ( ) [inline]
bool CzAnimInstance::isCurrentDataValid ( ) const [inline]
bool CzAnimInstance::isDelayed ( ) const [inline]
bool CzAnimInstance::isDelta ( ) const [inline]
bool CzAnimInstance::isFinished ( ) const [inline]
bool CzAnimInstance::isInterpolated ( ) const [inline]
bool CzAnimInstance::isManaged ( ) const [inline]
bool CzAnimInstance::isPaused ( ) const [inline]
bool CzAnimInstance::isPlaying ( ) const [inline]
bool CzAnimInstance::isStarted ( ) const [inline]
bool CzAnimInstance::isStopped ( ) const [inline]
void CzAnimInstance::NotifyEnd ( ) [virtual]

This event is called when this aimation instance stopped playing.

void CzAnimInstance::NotifyRepeat ( ) [virtual]

This event is called when this aimation instance repeats.

void CzAnimInstance::NotifyStart ( ) [virtual]

This event is called when this aimation instance is started.

void CzAnimInstance::pause ( ) [inline]
void CzAnimInstance::play ( ) [inline]
void CzAnimInstance::ProcessEventActions ( unsigned int  event_name) [virtual]

Process the event actions described by event_name.

Processes the actions list that is associated with the event named event_name (event_name is a hash of the actual event name to speed up searches)

Parameters:
event_nameName of the event as a string hash
void CzAnimInstance::restart ( ) [inline]

Assigns a CzAnim animation to this animation instance.

Parameters:
[in]animIf non-null, the animation.
void CzAnimInstance::setCurrentTime ( float  current_time) [inline]
void CzAnimInstance::setDelay ( float  delay) [inline]
void CzAnimInstance::setDelta ( bool  is_delta) [inline]
void CzAnimInstance::setInterpolate ( bool  interpolate) [inline]
void CzAnimInstance::setLoopedCallback ( CzCallback  callback) [inline]
void CzAnimInstance::setManaged ( bool  managed) [inline]
void CzAnimInstance::setParent ( CzAnimTimeline parent) [inline]
void CzAnimInstance::setRepeatCount ( int  repeat_count) [inline]
void CzAnimInstance::setStartedCallback ( CzCallback  callback) [inline]
void CzAnimInstance::setStoppedCallback ( CzCallback  callback) [inline]
void CzAnimInstance::setTarget ( IzAnimTarget element,
const char *  property_name 
) [inline]
void CzAnimInstance::setTargetElement ( IzAnimTarget element) [inline]
void CzAnimInstance::stop ( ) [inline]
bool CzAnimInstance::Update ( float  dt,
IzAnimTarget target = NULL 
) [virtual]

Updates the animation instance.

This method updates this animation instance, including:

  • Calculating new animation frame data
  • Updating target object properties from the new frame data
  • Starting, repeating or stopping the instance
Parameters:
dtThe number of seconds since the app was last updated
[in,out]targetIf non-null, the target.
Returns:
true if aimation is still playing, false if finished playing
void CzAnimInstance::UpdateTargetOnly ( IzAnimTarget target) [virtual]

Updates the instances target only.

This method updates this animation instances target only.

Parameters:
[in,out]targetIf non-null, the target.

Member Data Documentation

Animation to use.

The current interpolated data for the current time.

True if current frame data is valid.

float CzAnimInstance::CurrentTime [protected]

Current animation time (0 is start of animation)

float CzAnimInstance::Delay [protected]

Amount of time to delay starting the animation.

bool CzAnimInstance::DelayExpired [protected]

true if initial delay has expired

List of events that the animation handles.

bool CzAnimInstance::Interpolate [protected]

If true then the interpolated valiue between key frames will be calculated and applied.

bool CzAnimInstance::IsDelta [protected]

Delta animation should update the target variables value instead of replacing it.

Callback which is called when the animation loops.

bool CzAnimInstance::Managed [protected]

True if managed by a CzAnimInstanceManager.

Parent timeline.

int CzAnimInstance::RepeatCount [protected]

Number of times to replay the animation.

bool CzAnimInstance::Started [protected]

If set to true then the animation has started playing.

Callback which is called when the animation starts playing.

Status of the animation.

Callback which is called when the animation stops playing.

Target object to update.

unsigned int CzAnimInstance::TargetPropertyHash [protected]

Target object property name as a string hash to update.


The documentation for this class was generated from the following files: