ManaPlus
|
#include <animatedsprite.h>
Public Member Functions | |
AnimatedSprite (SpriteDef *const sprite) | |
~AnimatedSprite () | |
bool | reset () |
bool | play (const std::string &spriteAction) |
bool | update (const int time) |
void | draw (Graphics *const graphics, const int posX, const int posY) const |
void | drawRescaled (Graphics *const graphics, const int posX, const int posY, const int dx, const int dy) const |
void | drawRaw (Graphics *const graphics, const int posX, const int posY) const |
int | getWidth () const |
int | getHeight () const |
const Image * | getImage () const |
bool | setSpriteDirection (const SpriteDirection::Type direction) |
int | getNumberOfLayers () const |
std::string | getIdPath () const |
unsigned int | getCurrentFrame () const |
unsigned int | getFrameCount () const |
void | setAlpha (float alpha) |
const void * | getHash () const |
bool | updateNumber (const unsigned num) |
void | clearDelayLoad () |
void | setSprite (SpriteDef *const sprite) |
bool | isTerminated () const |
void | setLastTime (const int time) |
Public Member Functions inherited from Sprite | |
virtual | ~Sprite () |
virtual float | getAlpha () const |
virtual const void * | getHash2 () const |
Static Public Member Functions | |
static AnimatedSprite * | load (const std::string &filename, const int variant) |
static AnimatedSprite * | delayedLoad (const std::string &filename, const int variant) |
static AnimatedSprite * | clone (const AnimatedSprite *const anim) |
static void | setEnableCache (const bool b) |
Private Member Functions | |
bool | updateCurrentAnimation (const unsigned int dt) |
void | setDelayLoad (const std::string &filename, const int variant) |
Private Attributes | |
SpriteDirection::Type | mDirection |
int | mLastTime |
unsigned int | mFrameIndex |
unsigned int | mFrameTime |
SpriteDef * | mSprite |
const Action * | mAction |
const Animation * | mAnimation |
const Frame * | mFrame |
unsigned | mNumber |
unsigned | mNumber1 |
AnimationDelayLoad * | mDelayLoad |
bool | mTerminated |
Static Private Attributes | |
static bool | mEnableCache = false |
Additional Inherited Members | |
Protected Member Functions inherited from Sprite | |
Sprite () | |
Protected Attributes inherited from Sprite | |
float | mAlpha |
Animates a sprite by adding playback state.
Definition at line 36 of file animatedsprite.h.
|
explicit |
Constructor.
sprite | the sprite to animate |
Definition at line 51 of file animatedsprite.cpp.
References Resource::incRef(), Sprite::mAlpha, and mSprite.
Referenced by clone(), delayedLoad(), and load().
AnimatedSprite::~AnimatedSprite | ( | ) |
Definition at line 127 of file animatedsprite.cpp.
References AnimationDelayLoad::clearSprite(), Resource::decRef(), delete2, mDelayLoad, mSprite, and DelayedManager::removeDelayLoad().
|
inline |
Definition at line 115 of file animatedsprite.h.
References mDelayLoad.
Referenced by AnimationDelayLoad::~AnimationDelayLoad().
|
static |
Definition at line 113 of file animatedsprite.cpp.
References AnimatedSprite(), restrict, and SpriteAction::STAND().
Referenced by Being::setEmote().
|
static |
Definition at line 89 of file animatedsprite.cpp.
References AnimatedSprite(), ResourceManager::getFromCache(), load(), mEnableCache, restrict, and SpriteAction::STAND().
Referenced by Being::setGender(), Being::setHairTempSprite(), Being::setSpriteCards(), Being::setSpriteColor(), Being::setSpriteColorId(), Being::setSpriteId(), Being::setTempSprite(), and ActorSprite::setupSpriteDisplay().
|
virtual |
Draw the current animation frame at the coordinates given in screen pixels.
Implements Sprite.
Definition at line 328 of file animatedsprite.cpp.
References FUNC_BLOCK, and restrict.
Referenced by Being::drawBeingCursor(), and MiniStatusWindow::drawIcons().
void AnimatedSprite::drawRaw | ( | Graphics *const | graphics, |
const int | posX, | ||
const int | posY | ||
) | const |
Definition at line 363 of file animatedsprite.cpp.
References restrict.
Referenced by CutInWindow::draw2().
void AnimatedSprite::drawRescaled | ( | Graphics *const | graphics, |
const int | posX, | ||
const int | posY, | ||
const int | dx, | ||
const int | dy | ||
) | const |
Definition at line 342 of file animatedsprite.cpp.
References restrict.
Referenced by CastingEffect::draw().
|
inlinevirtual |
Returns the current frame number for the sprite.
Implements Sprite.
Definition at line 102 of file animatedsprite.h.
References mFrameIndex.
|
virtual |
Returns the frame count for the sprite.
Implements Sprite.
Definition at line 404 of file animatedsprite.cpp.
References CAST_U32, Animation::getLength(), and mAnimation.
|
virtual |
|
virtual |
Gets the height in pixels of the image of the current frame
Implements Sprite.
Definition at line 418 of file animatedsprite.cpp.
References Frame::image, and mFrame.
Referenced by CutInWindow::show().
std::string AnimatedSprite::getIdPath | ( | ) | const |
Definition at line 425 of file animatedsprite.cpp.
References Resource::mIdPath, and mSprite.
Referenced by LocalPlayer::imitateOutfit().
|
virtual |
Returns a reference to the current image being drawn.
Implements Sprite.
Definition at line 432 of file animatedsprite.cpp.
References Frame::image, and mFrame.
|
inline |
Definition at line 97 of file animatedsprite.h.
|
virtual |
Gets the width in pixels of the image of the current frame
Implements Sprite.
Definition at line 411 of file animatedsprite.cpp.
References Frame::image, and mFrame.
Referenced by MiniStatusWindow::drawIcons(), and CutInWindow::show().
|
inline |
Definition at line 121 of file animatedsprite.h.
References mTerminated.
Referenced by CastingEffect::isTerminated(), and Being::logic().
|
static |
An helper function, which will request the sprite to animate from the resource manager.
filename | the file of the sprite to animate |
variant | the sprite variant |
Definition at line 72 of file animatedsprite.cpp.
References AnimatedSprite(), Loader::getSprite(), restrict, and SpriteAction::STAND().
Referenced by Being::addEffect(), delayedLoad(), StatusEffect::getIcon(), ActorSprite::initTargetCursor(), EmoteDB::load(), EmoteDB::loadSpecialXmlFile(), EmoteDB::loadXmlFile(), Being::setHorse(), Being::setLanguageId(), CutInWindow::show(), Being::showAwayBadge(), Being::showClanBadge(), Being::showGmBadge(), Being::showGuildBadge(), Being::showInactiveBadge(), Being::showNameBadge(), Being::showPartyBadge(), Being::showShopBadge(), and Being::showTeamBadge().
|
virtual |
Plays an action using the current direction.
Implements Sprite.
Definition at line 159 of file animatedsprite.cpp.
References Animation::getLength().
Referenced by AnimationDelayLoad::load(), Being::setAction(), and Being::setHorse().
|
virtual |
Resets the sprite.
Implements Sprite.
Definition at line 142 of file animatedsprite.cpp.
References mAnimation, mFrame, mFrameIndex, Animation::mFrames, mFrameTime, and mLastTime.
|
virtual |
Sets the alpha value of the animated sprite
Reimplemented from Sprite.
Definition at line 437 of file animatedsprite.cpp.
References restrict.
|
private |
Definition at line 475 of file animatedsprite.cpp.
References DelayedManager::addDelayedAnimation(), and DelayedManager::removeDelayLoad().
|
inlinestatic |
Definition at line 124 of file animatedsprite.h.
References mEnableCache.
Referenced by Game::Game(), and Game::~Game().
|
inline |
|
inline |
Definition at line 118 of file animatedsprite.h.
References mSprite.
Referenced by AnimationDelayLoad::load().
|
virtual |
Sets the direction.
Implements Sprite.
Definition at line 377 of file animatedsprite.cpp.
References restrict.
Referenced by Being::setDirection(), and Being::setHorse().
|
virtual |
Inform the animation of the passed time so that it can output the correct animation frame.
Implements Sprite.
Definition at line 189 of file animatedsprite.cpp.
References A_UNLIKELY, restrict, and SpriteAction::STAND().
Referenced by Being::drawBeingCursor(), Being::logic(), CutInWindow::logic(), MiniStatusWindow::logic(), CutInWindow::show(), and CastingEffect::update().
|
private |
Definition at line 216 of file animatedsprite.cpp.
References FrameType::ANIMATION, CAST_U32, FrameType::GOTO, FrameType::JUMP, FrameType::LABEL, mrand(), FrameType::PAUSE, and restrict.
|
virtual |
|
private |
The currently active animation.
Definition at line 174 of file animatedsprite.h.
|
private |
The currently active frame.
Definition at line 176 of file animatedsprite.h.
Referenced by getFrameCount(), and reset().
|
private |
Definition at line 181 of file animatedsprite.h.
Referenced by clearDelayLoad(), and ~AnimatedSprite().
|
private |
The sprite direction.
Definition at line 165 of file animatedsprite.h.
|
staticprivate |
Definition at line 183 of file animatedsprite.h.
Referenced by delayedLoad(), and setEnableCache().
|
private |
Definition at line 178 of file animatedsprite.h.
Referenced by getHash(), getHeight(), getImage(), getWidth(), and reset().
|
private |
The index of the current frame.
Definition at line 168 of file animatedsprite.h.
Referenced by getCurrentFrame(), and reset().
|
private |
The time since start of frame. The sprite definition.
Definition at line 169 of file animatedsprite.h.
Referenced by reset().
|
private |
The last time update was called.
Definition at line 166 of file animatedsprite.h.
Referenced by reset(), and setLastTime().
|
private |
Definition at line 179 of file animatedsprite.h.
|
private |
Definition at line 180 of file animatedsprite.h.
|
private |
The currently active action.
Definition at line 172 of file animatedsprite.h.
Referenced by AnimatedSprite(), getIdPath(), setSprite(), and ~AnimatedSprite().
|
private |
Definition at line 182 of file animatedsprite.h.
Referenced by isTerminated().