24 #ifndef GUI_ANIMATION_DRAWABLE_H 25 #define GUI_ANIMATION_DRAWABLE_H 27 #include "common/ptr.h" 28 #include "graphics/managed_surface.h" 30 #include "gui/animation/Animation.h" 40 _bitmap(NULL), _positionX(0), _positionY(0), _width(0), _height(0), _alpha(1),
41 _usingSnapshot(
false), _shouldCenter(
false) {
50 void updateAnimation(
long currentTime) {
51 if (_animation.
get() != NULL) {
52 _animation->update(
this, currentTime);
56 bool isAnimationFinished() {
57 if (_animation.
get() != NULL)
58 return _animation->isFinished();
63 float getAlpha()
const {
return _alpha; }
64 void setAlpha(
float alpha) { _alpha = alpha; }
65 AnimationPtr getAnimation()
const {
return _animation; }
66 void setAnimation(AnimationPtr animation) { _animation = animation; }
69 float getPositionX()
const {
return _positionX; }
70 void setPositionX(
float positionX) { _positionX = positionX; }
71 float getPositionY()
const {
return _positionY; }
72 void setPositionY(
float positionY) { _positionY = positionY; }
73 virtual float getWidth()
const {
return _width; }
74 void setWidth(
float width) { _width = width; }
76 virtual float getHeight()
const {
77 if (_height == 0 && _bitmap && _bitmap->
w && _bitmap->
h)
78 return getWidth() * _displayRatio * _bitmap->
h / _bitmap->
w;
83 void setHeight(
float height) { _height = height; }
84 void setDisplayRatio(
float ratio) { _displayRatio = ratio; }
85 inline bool shouldCenter()
const {
return _shouldCenter; }
86 void setShouldCenter(
bool shouldCenter) { _shouldCenter = shouldCenter; }
99 AnimationPtr _animation;
Definition: managed_surface.h:51
int16 & w
Definition: managed_surface.h:117
PointerType get() const
Definition: ptr.h:229
int16 & h
Definition: managed_surface.h:118
Definition: Drawable.h:37