29 #include "nomlib/graphics/sprite/AnimatedSprite.hpp"
40 this->
fps.setFrameRate ( 100 );
45 NOM_LOG_TRACE ( NOM );
53 NOM_LOG_TRACE ( NOM );
58 this->
fps.setFrameRate ( 100 );
64 NOM_LOG_TRACE ( NOM );
69 this->
fps.setFrameRate ( 100 );
74 NOM_LOG_TRACE ( NOM );
114 this->
fps.setFrameRate ( rate );
121 NOM_LOG_ERR ( NOM,
"Could not update animation frame: requested frame value is too low or too high." );
140 if ( this->
status() != AnimatedSprite::AnimationStatus::Playing )
return;
142 if ( this->
fps.ticks() + this->
fps.framerate() > SDL_GetTicks() )
151 if ( this->
style() == AnimatedSprite::AnimationStyle::Oscillate )
162 if ( this->
frame() <= 0 )
168 else if ( this->
style() == AnimatedSprite::AnimationStyle::Blink )
173 #if defined ( NOM_DEBUG_ANIMATED_SPRITE )
174 NOM_DUMP_VAR( this->
frame() );
179 #if defined ( NOM_DEBUG_ANIMATED_SPRITE )
180 NOM_DUMP_VAR( this->
frame() );
void initialize(void)
Initialize values to their respective defaults.
Extended bitmap object rendering – utilizes sprite sheets.
void play(void)
Play the animation.
int32 frames(void) const
Obtain the number of frames this object contains.
virtual ~AnimatedSprite(void)
Destructor.
int32 max_frames
Total number of animation frames.
int32 frame_inc(void) const
Get the frame increment value of this object.
AnimatedSprite::AnimationStatus status(void) const
Get the current status of this animation.
void setSheetID(int32 id)
Set a new frame ID to render.
void unpause(void)
Un-pause the animation playback.
void setMaxFrames(int32 max)
Set the total number of animated frames for this object.
void setCurrentFrame(int32 frame)
int32 total_frames(void) const
Get the maximum number of animation frames for this object.
int32 current_frame
Current animation frame.
void update_animation(void)
Updates the playback of the animation.
enum AnimatedSprite::AnimationStatus animation_status
Status info.
AnimationTimer fps
Keeps record of our current tick and frame rate (think: frame delay)
int32 frame(void) const
Get the current frame of this object.
void setAnimationStatus(AnimatedSprite::AnimationStatus status)
Set a new status state for this object.
Specialized class container for the creation of sprite sheets via RFC 4627 JSON-compliant file input...
void setAnimationStyle(AnimatedSprite::AnimationStyle style)
Set a new style of animation for this object.
enum AnimatedSprite::AnimationStyle animation_style
Animation playback logic.
void setFrameRate(int32 rate)
SpriteSheet sprite_sheet
Our attached sprite sheet object.
void setFrameIncrement(int32 increment)
Set the increment value of each animated frame of this object.
AnimatedSprite::AnimationStyle style(void) const
Get the current animation style for this object.
int32 frame_increment
Value that we increment the current_frame by.
void pause(void)
Pause the animation playback.
void stop(void)
Stop the animation playback.