sftools
2.0 dev
Bunch of tools for SFML application development
|
Define a animation's frame stream based on a sprite sheet. More...
#include <LoopFrameStream.hpp>
Classes | |
struct | Settings |
Combine horizontal, vertical and precedence policies together to define how a sprite sheet should be read. More... | |
Public Types | |
enum | HorizontalStartFromPolicy { FromLeft = 0, FromRight } |
Define how a sprite sheet should be horitontally read. More... | |
enum | VerticalStartFromPolicy { FromTop = 0, FromBottom } |
Define how a sprite sheet should be vertically read. More... | |
enum | PrecedencePolicy { HorizontalFirst = 0, VerticalFirst } |
Define how a sprite sheet should be read. More... | |
Public Member Functions | |
LoopFrameStream () | |
Default constructor. | |
LoopFrameStream (LoopFrameStream const &stream) | |
Copy constructor. | |
LoopFrameStream (sf::Texture const &texture, sf::Vector2i frameSize, sf::Vector2u frameCount, sf::Time frameTime, bool loop=true, Settings const &settings=Settings()) | |
Constructor. | |
LoopFrameStream & | operator= (LoopFrameStream const &rhs) |
Copy assignment operator. | |
void | create (sf::Texture const &texture, sf::Vector2i frameSize, sf::Vector2u frameCount, sf::Time frameTime, bool loop=true, Settings const &settings=Settings()) |
Load a sprite sheet. | |
virtual Frame | getFrameAt (sf::Time time) const |
Seek and fetch a frame at a given point in time. | |
Define a animation's frame stream based on a sprite sheet.
Definition at line 70 of file LoopFrameStream.hpp.
Define how a sprite sheet should be horitontally read.
i.e. from left to right or from right to left ?
Enumerator | |
---|---|
FromLeft |
Read the sprite sheet from left to right. |
FromRight |
Read the sprite sheet from right to left. |
Definition at line 83 of file LoopFrameStream.hpp.
Define how a sprite sheet should be read.
i.e. by row or by column ?
Enumerator | |
---|---|
HorizontalFirst |
Read the sprite sheet by row. |
VerticalFirst |
Read the sprite sheet by column. |
Definition at line 115 of file LoopFrameStream.hpp.
Define how a sprite sheet should be vertically read.
i.e. from top to bottom or from bottom to top ?
Enumerator | |
---|---|
FromTop |
Read the sprite sheet from top to bottom. |
FromBottom |
Read the sprite sheet from bottom to top. |
Definition at line 99 of file LoopFrameStream.hpp.
|
inline |
Default constructor.
Doesn't load any frame at all.
Definition at line 163 of file LoopFrameStream.hpp.
|
inline |
Copy constructor.
stream | object to copy |
Definition at line 175 of file LoopFrameStream.hpp.
|
inline |
Constructor.
Load a sprite sheet
texture | sprite sheet |
frameSize | size of a frame |
frameCount | number of frame as a vector where x is the number of column and y is the number of row |
frameTime | time by frame |
loop | define if the animation should loop or stay on the last frame |
settings | settings used to read the sprite sheet |
std::invalid_argument | if the number of frame is zero |
std::invalid_argument | if the frame time is zero |
Definition at line 201 of file LoopFrameStream.hpp.
References create().
|
inline |
Load a sprite sheet.
texture | sprite sheet |
frameSize | size of a frame |
frameCount | number of frame as a vector where x is the number of column and y is the number of row |
frameTime | time by frame |
loop | define if the animation should loop or stay on the last frame |
settings | settings used to read the sprite sheet |
std::invalid_argument | if the number of frame is zero |
std::invalid_argument | if the frame time is zero |
Definition at line 240 of file LoopFrameStream.hpp.
References FromLeft, FromTop, and HorizontalFirst.
Referenced by LoopFrameStream().
|
inlinevirtual |
Seek and fetch a frame at a given point in time.
See FrameStream::getFrameAt() for more details.
time | time elapsed since the start of the animation |
std::runtime_error | if the stream was not yet loaded |
Implements sftools::FrameStream.
Definition at line 308 of file LoopFrameStream.hpp.
|
inline |
Copy assignment operator.
rhs | stream to be copied |
Definition at line 217 of file LoopFrameStream.hpp.