Crazy Eddie's GUI System  0.8.6
CEGUI::AnimationInstance Class Reference

Defines an 'animation instance' class. More...

+ Inheritance diagram for CEGUI::AnimationInstance:
+ Collaboration diagram for CEGUI::AnimationInstance:

Public Member Functions

 AnimationInstance (Animation *definition)
 internal constructor, please use AnimationManager::instantiateAnimation
 
 ~AnimationInstance (void)
 
AnimationgetDefinition () const
 Retrieves the animation definition that is used in this instance.
 
void setTarget (PropertySet *target)
 Sets the target property set - this class will get it's properties affected by the Affectors!
 
PropertySetgetTarget () const
 Retrieves the target property set.
 
void setEventReceiver (EventSet *receiver)
 Sets event receiver - this class will receive events when something happens to the playback of this animation - it starts, stops, pauses, unpauses, ends and loops.
 
EventSetgetEventReceiver () const
 Retrieves the event receiver.
 
void setEventSender (EventSet *sender)
 Sets event sender - this class will send events and can affect this animation instance if there are any auto subscriptions defined in the animation definition.
 
EventSetgetEventSender () const
 Retrieves the event sender.
 
void setTargetWindow (Window *target)
 Helper method, sets given window as target property set, event receiver and event set.
 
void setPosition (float position)
 Sets playback position. Has to be higher or equal to 0.0 and lower or equal to Animation definition's duration.
 
float getPosition () const
 Retrieves current playback position.
 
void setSpeed (float speed)
 Sets playback speed - you can speed up / slow down individual instances of the same animation. 1.0 means normal playback.
 
float getSpeed () const
 Retrieves current playback speed.
 
void setSkipNextStep (bool skip)
 Controls whether the next time step is skipped.
 
bool getSkipNextStep () const
 Returns true if the next step is going to be skipped. More...
 
void setMaxStepDeltaSkip (float maxDelta)
 Sets the max delta before step skipping occurs. More...
 
float getMaxStepDeltaSkip () const
 Gets the max delta before step skipping occurs.
 
void setMaxStepDeltaClamp (float maxDelta)
 Sets the max delta before step clamping occurs. More...
 
float getMaxStepDeltaClamp () const
 Gets the max delta before step clamping occurs.
 
void start (bool skipNextStep=true)
 Starts this animation instance - sets position to 0.0 and unpauses. More...
 
void stop ()
 Stops this animation instance - sets position to 0.0 and pauses.
 
void pause ()
 Pauses this animation instance - stops it from stepping forward.
 
void unpause (bool skipNextStep=true)
 Unpauses this animation instance - allows it to step forward again. More...
 
void togglePause (bool skipNextStep=true)
 Pauses the animation if it's running and unpauses it if it isn't. More...
 
bool isRunning () const
 Returns true if this animation instance is currently unpaused, if it is stepping forward.
 
void setAutoSteppingEnabled (bool enabled)
 Controls whether auto stepping is enabled. More...
 
bool isAutoSteppingEnabled () const
 Checks whether auto stepping is enabled.
 
void step (float delta)
 Steps the animation forward by the given delta. More...
 
bool handleStart (const CEGUI::EventArgs &e)
 handler that starts the animation instance
 
bool handleStop (const CEGUI::EventArgs &e)
 handler that stops the animation instance
 
bool handlePause (const CEGUI::EventArgs &e)
 handler that pauses the animation instance
 
bool handleUnpause (const CEGUI::EventArgs &e)
 handler that unpauses the animation instance
 
bool handleTogglePause (const CEGUI::EventArgs &e)
 handler that toggles pause on this animation instance
 
void savePropertyValue (const String &propertyName)
 Internal method, saves given property (called before it's affected)
 
void purgeSavedPropertyValues (void)
 
const StringgetSavedPropertyValue (const String &propertyName)
 
void addAutoConnection (Event::Connection conn)
 Internal method, adds reference to created auto connection. More...
 
void unsubscribeAutoConnections ()
 Internal method, unsubscribes auto connections. More...
 
void apply ()
 Applies this animation instance. More...
 

Static Public Attributes

static const String EventNamespace
 
static const String EventAnimationStarted
 fired when animation instance starts
 
static const String EventAnimationStopped
 fired when animation instance stops
 
static const String EventAnimationPaused
 fired when animation instance pauses
 
static const String EventAnimationUnpaused
 fired when animation instance unpauses
 
static const String EventAnimationEnded
 fired when animation instance ends
 
static const String EventAnimationLooped
 fired when animation instance loops
 

Detailed Description

Defines an 'animation instance' class.

Animation classes hold definition of the animation. Whilst this class holds data needed to use the animation definition - target PropertySet, event receiver, animation position, ...

You have to define animation first and then instantiate it via AnimationManager::instantiateAnimation

See also
Animation

Constructor & Destructor Documentation

CEGUI::AnimationInstance::~AnimationInstance ( void  )

internal destructor, please use AnimationManager::destroyAnimationInstance

Member Function Documentation

void CEGUI::AnimationInstance::addAutoConnection ( Event::Connection  conn)

Internal method, adds reference to created auto connection.

DO NOT USE THIS DIRECTLY
void CEGUI::AnimationInstance::apply ( )

Applies this animation instance.

You should not need to use this directly unless your requirements are very special. CEGUI calls this automatically in most cases.
const String& CEGUI::AnimationInstance::getSavedPropertyValue ( const String propertyName)

retrieves saved value, if it isn't cached already, it retrieves it fresh from the properties

bool CEGUI::AnimationInstance::getSkipNextStep ( ) const

Returns true if the next step is going to be skipped.

If it was skipped already, this returns false as step resets it to false after it skips one step.
void CEGUI::AnimationInstance::purgeSavedPropertyValues ( void  )

this purges all saved values forcing this class to gather new ones fresh from the properties

void CEGUI::AnimationInstance::setAutoSteppingEnabled ( bool  enabled)

Controls whether auto stepping is enabled.

If auto stepping is enabled, CEGUI will step this animation instance forward whenever CEGUI::System::injectTimePulse is called
void CEGUI::AnimationInstance::setMaxStepDeltaClamp ( float  maxDelta)

Sets the max delta before step clamping occurs.

Parameters
maxDeltadelta in seconds, if this value is reached, the step is clamped. (use -1.0f if you never want to clamp - this is the default)
If you want to ensure the animation steps at most 1.0 / 60.0 seconds at a timem you should call setMaxStepDeltaClamp(1.0f / 60.0f). This essentially slows the animation down in case the FPS drops below 60.
void CEGUI::AnimationInstance::setMaxStepDeltaSkip ( float  maxDelta)

Sets the max delta before step skipping occurs.

Parameters
maxDeltadelta in seconds, if this value is reached, the step is skipped (use -1.0f if you never want to skip - this is the default)
If you want to ensure your animation is not skipped entirely after layouts are loaded or other time consuming operations are done, use this method.

For example setMaxStepDeltaSkip(1.0f / 25.0f) ensures that if FPS drops below 25, the animation just stops progressing and waits till FPS raises.

void CEGUI::AnimationInstance::start ( bool  skipNextStep = true)

Starts this animation instance - sets position to 0.0 and unpauses.

Parameters
skipNextStepif true the next injected time pulse is skipped
This also causes base values to be purged!
void CEGUI::AnimationInstance::step ( float  delta)

Steps the animation forward by the given delta.

You don't need to call this unless AutoStepping is disabled (it is enabled by default)
void CEGUI::AnimationInstance::togglePause ( bool  skipNextStep = true)

Pauses the animation if it's running and unpauses it if it isn't.

Parameters
skipNextStepif true the next injected time pulse is skipped (only applies when unpausing!)
void CEGUI::AnimationInstance::unpause ( bool  skipNextStep = true)

Unpauses this animation instance - allows it to step forward again.

Parameters
skipNextStepif true the next injected time pulse is skipped
void CEGUI::AnimationInstance::unsubscribeAutoConnections ( )

Internal method, unsubscribes auto connections.

DO NOT USE THIS DIRECTLY

Member Data Documentation

const String CEGUI::AnimationInstance::EventNamespace
static

Namespace for animation instance events these are fired on event receiver, not this animation instance!