Frame-based texture animated sprite.
More...
#include <gelSprite.h>
List of all members.
Public Member Functions |
| GelAnimSprite () |
| Default constructor.
|
| GelAnimSprite (Gel2dVec obj_size, Gel2dVec obj_pos, int col, int row, int stframe, int endframe, int nfps) |
| Convenience constructor.
|
void | setup (int col, int row, int stframe, int endframe, int nfps) |
| Sets a few basic parameters of the tile animation.
|
int | getMode () const |
| Gets the mode of the tile animation.
|
void | setMode (int nmode) |
| Sets the tile animation's mode.
|
int | getFPS () const |
| Gets the tile animation's frame rate.
|
void | setFPS (int nfps) |
| Sets the tile animation's frame rate.
|
int | getColumns () const |
| Gets the number of columns the texture has been divided into.
|
void | setColumns (int columns) |
| Sets the number of columns the texture will be divided into.
|
int | getRows () const |
| Gets the number of rows the texture has been divided into.
|
void | setRows (int rows) |
| Sets the number of rows the texture will be divided into.
|
int | getCurFrame () const |
void | setCurFrame (int frame) |
int | getStartFrame () const |
void | setStartFrame (int frame) |
int | getEndFrame () const |
void | setEndFrame (int frame) |
int | getNumFrames () const |
int | getPlayState () const |
| Gets the tile animation's playback state.
|
void | setPlayState (int state) |
| Sets the tile animation's playback state.
|
void | update () |
| Updates the tile animation.
|
void | render () |
| Renders the animated quad to the screen.
|
Detailed Description
Frame-based texture animated sprite.
Constructor & Destructor Documentation
gel::GelAnimSprite::GelAnimSprite |
( |
| ) |
|
gel::GelAnimSprite::GelAnimSprite |
( |
Gel2dVec |
obj_size, |
|
|
Gel2dVec |
obj_pos, |
|
|
int |
col, |
|
|
int |
row, |
|
|
int |
stframe, |
|
|
int |
endframe, |
|
|
int |
nfps |
|
) |
| |
Convenience constructor.
- Parameters:
-
obj_size | : A Gel2dVec containing the quad's width and height. |
obj_pos | : A Gel2dVec containing the quad's x and y coordinates. |
col | : The number of columns to divide the texture into. |
row | : The number of rows to divide the texture into. |
stframe | : The frame to begin the tile animation. |
endframe | : The frame to end the tile animation. |
nfps | : The frame rate of the tile animation. |
Member Function Documentation
void gel::GelAnimSprite::setup |
( |
int |
col, |
|
|
int |
row, |
|
|
int |
stframe, |
|
|
int |
endframe, |
|
|
int |
nfps |
|
) |
| |
Sets a few basic parameters of the tile animation.
- Parameters:
-
col | : The number of columns to divide the texture into. |
row | : The number of rows to divide the texture into. |
stframe | : The frame to begin the tile animation. |
endframe | : The frame to end the tile animation. |
nfps | : The frame rate of the tile animation. |
int gel::GelAnimSprite::getMode |
( |
| ) |
const [inline] |
Gets the mode of the tile animation.
- Returns:
- The mode of the tile animation.
void gel::GelAnimSprite::setMode |
( |
int |
nmode | ) |
[inline] |
Sets the tile animation's mode.
Available modes are: GEL_FWD, GEL_REV, GEL_PLAYSTOP, GEL_LOOP, GEL_PINGPONG, and GEL_FLIPPER.
You can combine flags together with the bitwise OR operator such as GEL_FWD | GEL_PLAYSTOP or GEL_REV | GEL_LOOP.
Combining flags improperly can lead to unexpected results. For instance, you can't play forward and backward at the same time, and you can't play once and loop at the same time. Just use a little common sense and you'll be fine.
- Parameters:
-
nmode | : The new mode of the tile animation. |
int gel::GelAnimSprite::getFPS |
( |
| ) |
const [inline] |
Gets the tile animation's frame rate.
- Returns:
- The speed of the tile animation in frames per second.
void gel::GelAnimSprite::setFPS |
( |
int |
nfps | ) |
[inline] |
Sets the tile animation's frame rate.
- Parameters:
-
nfps | : The new speed of the tile animation in frames per second. |
int gel::GelAnimSprite::getColumns |
( |
| ) |
const [inline] |
Gets the number of columns the texture has been divided into.
- Returns:
- The number of columns in the tile animation.
void gel::GelAnimSprite::setColumns |
( |
int |
columns | ) |
[inline] |
Sets the number of columns the texture will be divided into.
- Parameters:
-
columns | : The new number of columns in the tile animation. |
int gel::GelAnimSprite::getRows |
( |
| ) |
const [inline] |
Gets the number of rows the texture has been divided into.
- Returns:
- The number of rows in the tile animation.
void gel::GelAnimSprite::setRows |
( |
int |
rows | ) |
[inline] |
Sets the number of rows the texture will be divided into.
- Parameters:
-
rows | : The new number of rows in the tile animation. |
int gel::GelAnimSprite::getCurFrame |
( |
| ) |
const [inline] |
void gel::GelAnimSprite::setCurFrame |
( |
int |
frame | ) |
[inline] |
int gel::GelAnimSprite::getStartFrame |
( |
| ) |
const [inline] |
void gel::GelAnimSprite::setStartFrame |
( |
int |
frame | ) |
[inline] |
int gel::GelAnimSprite::getEndFrame |
( |
| ) |
const [inline] |
void gel::GelAnimSprite::setEndFrame |
( |
int |
frame | ) |
[inline] |
int gel::GelAnimSprite::getNumFrames |
( |
| ) |
const [inline] |
int gel::GelAnimSprite::getPlayState |
( |
| ) |
const [inline] |
Gets the tile animation's playback state.
This function will return one of the following states: GEL_STOP, GEL_PLAY, or GEL_PAUSE.
- Returns:
- The current playback state.
void gel::GelAnimSprite::setPlayState |
( |
int |
state | ) |
[inline] |
Sets the tile animation's playback state.
Available states are GEL_STOP, GEL_PLAY, and GEL_PAUSE.
- Parameters:
-
state | : The new playback state. |
void gel::GelAnimSprite::update |
( |
| ) |
|
Updates the tile animation.
This must be called somewhere in your game loop.
void gel::GelAnimSprite::render |
( |
| ) |
[virtual] |
Renders the animated quad to the screen.
Reimplemented from gel::GelSprite.
The documentation for this class was generated from the following file: