Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
nom::AnimatedSprite Class Reference
Inheritance diagram for nom::AnimatedSprite:
[legend]
Collaboration diagram for nom::AnimatedSprite:
[legend]

Public Types

enum  AnimationStyle { NoStyle = 0, Blink, Oscillate }
 
enum  AnimationStatus { Stopped = 0, Playing, Paused }
 
- Public Types inherited from nom::IDrawable
typedef std::unique_ptr
< IDrawable > 
UniquePtr
 std::unique_ptr definition type for your convenience, sir!
 
typedef std::shared_ptr
< IDrawable > 
SharedPtr
 std::shared_ptr definition type at your leisure, sir!
 
typedef std::vector
< std::shared_ptr< IDrawable > > 
SharedDrawables
 Vector of std::shared_ptr definition type for the brotherhood, sir!
 
typedef std::vector
< std::unique_ptr< IDrawable > > 
UniqueDrawables
 std::unique_ptr vector container type
 
typedef const Window & RenderTarget
 

Public Member Functions

 AnimatedSprite (void)
 
 AnimatedSprite (const SpriteSheet &sheet)
 
 AnimatedSprite (const std::string &filename)
 
virtual ~AnimatedSprite (void)
 Destructor.
 
int32 total_frames (void) const
 Get the maximum number of animation frames for this object.
 
int32 frame_inc (void) const
 Get the frame increment value of this object.
 
int32 frame (void) const
 Get the current frame of this object.
 
AnimatedSprite::AnimationStyle style (void) const
 Get the current animation style for this object.
 
AnimatedSprite::AnimationStatus status (void) const
 Get the current status of this animation.
 
void setFrameRate (int32 rate)
 
void setCurrentFrame (int32 frame)
 
void setAnimationStyle (AnimatedSprite::AnimationStyle style)
 Set a new style of animation for this object.
 
void play (void)
 Play the animation.
 
void stop (void)
 Stop the animation playback.
 
void pause (void)
 Pause the animation playback.
 
void unpause (void)
 Un-pause the animation playback.
 
- Public Member Functions inherited from nom::SpriteBatch
 SpriteBatch (void)
 
virtual ~SpriteBatch (void)
 Destructor.
 
 SpriteBatch (const SpriteSheet &sheet)
 
 SpriteBatch (const std::string &filename)
 Construct a SpriteBatch object from an existing sprite sheet filename.
 
SpriteBatch & operator= (const SpriteBatch &other)
 Copy assignment operator.
 
int32 getSheetID (void) const
 Get the object's current sheet_id.
 
int32 frames (void) const
 Obtain the number of frames available.
 
const std::string & sheet_filename (void) const
 
void setSheetID (int32 id)
 Set a new frame ID to render.
 
void update (void)
 
- Public Member Functions inherited from nom::Sprite
 Sprite (void)
 
 Sprite (int32 width, int32 height)
 Construct a Sprite object, initializing the width & height coordinates.
 
Sprite & operator= (const Sprite &other)
 Copy assignment operator.
 
virtual ~Sprite (void)
 Destructor.
 
const Point2i size (void) const
 
const Point2i position (void) const
 
uint32 getState (void) const
 Get the object's state.
 
void setState (uint32 state)
 Set a new state.
 
bool load (const std::string &filename, const Color &colorkey, bool use_cache=false)
 Load a new image onto the Sprite.
 
void draw (RenderTarget target) const
 Render the object onto the primary video buffer – your visible screen.
 
void draw (RenderTarget target, const double angle) const
 
bool resize (enum ResizeAlgorithm scaling_algorithm)
 Rescale the font with a chosen resizing algorithm.
 
bool resize (const Point2f &scale_factor)
 
- Public Member Functions inherited from nom::Transformable
 Transformable (const Coords &coords)
 
 Transformable (const Coords &coords, const Color &color)
 
const Coords getPosition (void) const
 
const Coords getSize (void) const
 
void setPosition (int32 x, int32 y)
 
void setPosition (int32 x, int32 y, int32 width, int32 height)
 
void setPosition (const Coords &coords)
 
void setSize (int32 width, int32 height)
 
void setSize (const Coords &size)
 
void move (uint32 x=0, uint32 y=0)
 
void move (const Coords &offsets=Coords(0, 0))
 
const Color & getColor (void) const
 
void setColor (uint8 red, uint8 green, uint8 blue, uint8 alpha=255)
 
void setColor (const Color &color)
 
- Public Member Functions inherited from nom::IDrawable
 IDrawable (void)
 Do nothing at all default constructor.
 
virtual ~IDrawable (void)
 Do nothing at all destructor.
 

Protected Member Functions

void update_animation (void)
 Updates the playback of the animation.
 
void initialize (void)
 Initialize values to their respective defaults.
 
void setMaxFrames (int32 max)
 Set the total number of animated frames for this object.
 
void setFrameIncrement (int32 increment)
 Set the increment value of each animated frame of this object.
 
void setAnimationStatus (AnimatedSprite::AnimationStatus status)
 Set a new status state for this object.
 

Protected Attributes

int32 max_frames
 Total number of animation frames.
 
int32 current_frame
 Current animation frame.
 
int32 frame_increment
 Value that we increment the current_frame by.
 
enum AnimatedSprite::AnimationStyle animation_style
 Animation playback logic.
 
enum
AnimatedSprite::AnimationStatus 
animation_status
 Status info.
 
AnimationTimer fps
 Keeps record of our current tick and frame rate (think: frame delay)
 
- Protected Attributes inherited from nom::SpriteBatch
Coords offsets
 Source (input) coordinates – used for sprite sheet positioning.
 
SpriteSheet sprite_sheet
 Our attached sprite sheet object.
 
int32 sheet_id
 The sheet's frame ID presently in use.
 
- Protected Attributes inherited from nom::Sprite
Texture sprite
 Object that holds our sprite image.
 
uint32 state
 Convenience instance variable (user-defined)
 
int32 scale_factor
 Scale factor applied if the resize method is called.
 
- Protected Attributes inherited from nom::Transformable
Coords coords
 
Color color
 

Detailed Description

Definition at line 45 of file AnimatedSprite.hpp.

Constructor & Destructor Documentation

nom::AnimatedSprite::AnimatedSprite ( void  )

Default construct for initializing instance variables to their respective defaults.

Definition at line 43 of file AnimatedSprite.cpp.

Here is the call graph for this function:

nom::AnimatedSprite::AnimatedSprite ( const SpriteSheet &  sheet)

Construct an AnimatedSprite object, initializing it with a SpriteSheet object.

Definition at line 50 of file AnimatedSprite.cpp.

Here is the call graph for this function:

nom::AnimatedSprite::AnimatedSprite ( const std::string &  filename)

Construct an AnimatedSprite from an existing filename saved with SpriteSheet.

Definition at line 61 of file AnimatedSprite.cpp.

Here is the call graph for this function:

Member Function Documentation

void nom::AnimatedSprite::setCurrentFrame ( int32  frame)

Set the current frame for animation

The frame you are setting must be greater than or equal to total_frames().

Definition at line 117 of file AnimatedSprite.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nom::AnimatedSprite::setFrameRate ( int32  rate)

Set a new frame rate for the animation

The frame rate value needs to be in milliseconds.

Definition at line 112 of file AnimatedSprite.cpp.


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