Dragonfly  4.4
A text-based game engine
Public Member Functions | Private Member Functions | Private Attributes | List of all members
df::Sprite Class Reference
Collaboration diagram for df::Sprite:
Collaboration graph

Public Member Functions

 ~Sprite ()
 Sprite (int max_frames)
void setWidth (int new_width)
int getWidth () const
void setHeight (int new_height)
int getHeight () const
void setColor (Color new_color)
Color getColor () const
int getFrameCount () const
int addFrame (Frame new_frame)
Frame getFrame (int frame_number) const
void setLabel (std::string new_label)
std::string getLabel () const

Private Member Functions

 Sprite ()

Private Attributes

int m_width
int m_height
int m_max_frame_count
int m_frame_count
Color m_color
std::string m_label

Constructor & Destructor Documentation

df::Sprite::Sprite ( )

Sprite constructor always has one arg.

df::Sprite::~Sprite ( )

Delete sprite, removing any allocated frames.

df::Sprite::Sprite ( int  max_frames)

Create sprite with indicated maximum number of frames.

Member Function Documentation

int df::Sprite::addFrame ( Frame  new_frame)

Add frame to sprite.

Return -1 if frame array full, else 0.

Color df::Sprite::getColor ( ) const

Get sprite color.

Frame df::Sprite::getFrame ( int  frame_number) const

Get next sprite frame indicated by number.

Return empty frame if out of range [0, frame_count].

int df::Sprite::getFrameCount ( ) const

Get total count of frames in sprite.

int df::Sprite::getHeight ( ) const

Get height of sprite.

std::string df::Sprite::getLabel ( ) const

Get label associated with sprite.

int df::Sprite::getWidth ( ) const

Get width of sprite.

void df::Sprite::setColor ( Color  new_color)

Set sprite color.

void df::Sprite::setHeight ( int  new_height)

Set height of sprite.

void df::Sprite::setLabel ( std::string  new_label)

Set label associated with sprite.

void df::Sprite::setWidth ( int  new_width)

Set width of sprite.

Member Data Documentation

Color df::Sprite::m_color

Optional color for entire sprite.

Frame* df::Sprite::m_frame

Array of frames.

int df::Sprite::m_frame_count

Actual number of frames sprite has.

int df::Sprite::m_height

Sprite height.

std::string df::Sprite::m_label

Text label to identify sprite.

int df::Sprite::m_max_frame_count

Maximum number of frames sprite can have.

int df::Sprite::m_width

Sprite width.