Gamedev Framework (gf)
0.3.0
A C++11 framework for 2D games
|
An animated sprite. More...
#include <gf/AnimatedSprite.h>
Public Member Functions | |
AnimatedSprite () | |
Constructor. More... | |
void | setAnimation (Animation &animation) |
Set the current animation of the sprite. More... | |
void | update (float dt) |
Update the state of the animation. More... | |
Public Member Functions inherited from gf::Sprite | |
Sprite () | |
Default constructor. More... | |
Sprite (const Texture &texture) | |
Construct the sprite from a source texture. More... | |
Sprite (const Texture &texture, const RectF &textureRect) | |
Construct the sprite from a sub-rectangle of a source texture. More... | |
void | setTexture (const Texture &texture, bool resetRect=false) |
Change the source texture of the sprite. More... | |
const Texture * | getTexture () const |
Get the source texture of the sprite. More... | |
void | unsetTexture () |
Unset the source texture of the sprite. More... | |
void | setTextureRect (const RectF &rect) |
Set the sub-rectangle of the texture that the sprite will display. More... | |
const RectF & | getTextureRect () const |
Get the sub-rectangle of the texture displayed by the sprite. More... | |
void | setColor (const Color4f &color) |
Set the global color of the sprite. More... | |
const Color4f & | getColor () const |
Get the global color of the sprite. More... | |
RectF | getLocalBounds () const |
Get the local bounding rectangle of the entity. More... | |
void | setAnchor (Anchor anchor) |
Set the anchor origin of the entity. More... | |
VertexBuffer | commitGeometry () const |
Create a buffer with the current geometry. More... | |
virtual void | draw (RenderTarget &target, RenderStates states) override |
Draw the object to a render target. More... | |
Public Member Functions inherited from gf::Transformable | |
Transformable () | |
Default constructor. More... | |
void | setOrigin (Vector2f origin) |
Set the local origin of the object. More... | |
Vector2f | getOrigin () const |
Get the local origin of the object. More... | |
void | setPosition (Vector2f position) |
Set the position of the object. More... | |
Vector2f | getPosition () const |
Get the position of the object. More... | |
void | move (Vector2f offset) |
Move the object by a given offset. More... | |
void | setRotation (float angle) |
Set the orientation of the object. More... | |
float | getRotation () const |
Get the orientation of the object. More... | |
void | rotate (float angle) |
Rotate the object. More... | |
void | setScale (Vector2f factors) |
Set the scale factors of the object. More... | |
void | setScale (float factor) |
Set the scale factor of the object. More... | |
Vector2f | getScale () const |
Get the current scale of the object. More... | |
void | scale (Vector2f factors) |
Scale the object. More... | |
void | scale (float factor) |
Scale the object. More... | |
Matrix3f | getTransform () const |
Get the combined transform of the object. More... | |
Matrix3f | getInverseTransform () const |
Get the inverse of the combined transform of the object. More... | |
Public Member Functions inherited from gf::Drawable | |
virtual | ~Drawable () |
Virtual desctructor. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from gf::Transformable | |
void | setOriginFromAnchorAndBounds (Anchor anchor, const RectF &bounds) |
Set the origin from an anchor and bounds. More... | |
An animated sprite.
An animated sprite is a sprite that can display an animation.
gf::AnimatedSprite::AnimatedSprite | ( | ) |
Constructor.
void gf::AnimatedSprite::setAnimation | ( | Animation & | animation | ) |
Set the current animation of the sprite.
animation | The animation |
void gf::AnimatedSprite::update | ( | float | dt | ) |
Update the state of the animation.
dt | The time (in seconds) since the last update |