Dragonfly 4.20
A text-based game engine
|
Public Member Functions | |
Animation () | |
void | setSprite (Sprite *p_new_sprite) |
const Sprite * | getSprite () const |
void | setName (std::string new_name) |
std::string | getName () const |
void | setIndex (int new_index) |
int | getIndex () const |
void | setSlowdownCount (int new_slowdown_count) |
int | getSlowdownCount () const |
Box | getBox () const |
int | serialize (std::stringstream *p_ss) const |
int | deserialize (std::stringstream *p_ss) |
bool | isModified () const |
int | draw (Vector position) |
bool | operator== (const Animation &a) |
bool | operator!= (const Animation &a) |
std::string | toString () const |
Private Attributes | |
Sprite * | m_p_sprite |
int | m_index |
int | m_slowdown_count |
std::string | m_name |
bool | m_modified |
df::Animation::Animation | ( | ) |
Animation constructor.
int df::Animation::deserialize | ( | std::stringstream * | p_ss | ) |
Deserialize attributes from stream.
Return 0 if ok, else -1.
int df::Animation::draw | ( | Vector | position | ) |
Draw single frame centered at position (x,y).
Drawing accounts for slowdown, and advances Sprite frame. Return 0 if ok, else -1.
int df::Animation::getIndex | ( | ) | const |
Get index of current Sprite frame to be displayed.
std::string df::Animation::getName | ( | ) | const |
Get Sprite name (in ResourceManager).
int df::Animation::getSlowdownCount | ( | ) | const |
Set animation slowdown count (-1 means stop animation).
bool df::Animation::isModified | ( | ) | const |
Return true if any attributes modified since last serialize.
bool df::Animation::operator== | ( | const Animation & | a | ) |
Compare two Animations.
int df::Animation::serialize | ( | std::stringstream * | p_ss | ) | const |
Serialize attributes to stream.
Return 0 if ok, else -1.
void df::Animation::setIndex | ( | int | new_index | ) |
Set index of current Sprite frame to be displayed.
void df::Animation::setName | ( | std::string | new_name | ) |
Set Sprite name (in ResourceManager).
void df::Animation::setSlowdownCount | ( | int | new_slowdown_count | ) |
Set animation slowdown count (-1 means stop animation).
void df::Animation::setSprite | ( | Sprite * | p_new_sprite | ) |
Set associated Sprite to new one.
Note, Sprite is managed by ResourceManager. Set Sprite index to 0 (first frame).
std::string df::Animation::toString | ( | ) | const |
Return attributes as string.
|
private |
Current index frame for Sprite.
|
private |
True if modified since serialize().
|
private |
Sprite name in ResourceManager.
|
private |
Slowdown counter (-1 means stop).