Lums
Public Member Functions | Public Attributes | List of all members
lm::Sprite Class Reference

A class representing a sprite. More...

#include <Sprite.hpp>

Public Member Functions

 Sprite ()
 
Texturetexture () const
 
int width () const
 
int height () const
 
std::size_t atlas () const
 
int frame () const
 
void setTexture (Texture &texture)
 
void setAnimation (std::size_t image, std::size_t length, std::size_t speed, bool loop=true)
 
void setSpeed (std::size_t speed)
 
void setImageInAtlas (std::size_t i)
 
bool finished () const
 
LUMS_EXPORTED void update ()
 

Public Attributes

Vector2f pos
 
Vector2f scale
 
Vector4f color
 
Vector2b flip
 

Detailed Description

A class representing a sprite.

Constructor & Destructor Documentation

lm::Sprite::Sprite ( )

Create a sprite

Member Function Documentation

std::size_t lm::Sprite::atlas ( ) const
inline

Get the sprite current atlas frame

Returns
An atlas frame
bool lm::Sprite::finished ( ) const
inline

Check if the animation has ended

Returns
true if the animation is over
int lm::Sprite::frame ( ) const
inline

Get the sprite frame relative to the animation

Returns
the animation frame
int lm::Sprite::height ( ) const
inline

Get the sprite height

Returns
The height
void lm::Sprite::setAnimation ( std::size_t  image,
std::size_t  length,
std::size_t  speed,
bool  loop = true 
)
inline

Set the frame animation

Parameters
imageThe base image atlas
lengthThe animation length
speedThe animation speed, in 120 frame ticks
loopIf true, the animation loops
void lm::Sprite::setImageInAtlas ( std::size_t  i)
inline

Set the current image in atlas

Parameters
iThe image index
void lm::Sprite::setSpeed ( std::size_t  speed)
inline

Set the animation speed

Parameters
speedThe speed
void lm::Sprite::setTexture ( Texture texture)
inline

Set the sprite texture

Parameters
textureThe texture
Texture& lm::Sprite::texture ( ) const
inline

Get the texture from the sprite.

Returns
The texture
LUMS_EXPORTED void lm::Sprite::update ( )

Update the sprite

int lm::Sprite::width ( ) const
inline

Get the sprite width

Returns
The width

Member Data Documentation

Vector4f lm::Sprite::color

The sprite color

Vector2b lm::Sprite::flip

The sprite flip value

Vector2f lm::Sprite::pos

The sprite position

Vector2f lm::Sprite::scale

The sprite scale


The documentation for this class was generated from the following file: