This class is used to animate a rune::GameObject.
More...
#include <animator.h>
|
| Animator () |
| Default constructor to initialize an empty animation.
|
|
void | start () override |
| Function override for component startup.
|
|
void | playAnimation (std::string const &animationName) |
| Play an animation stored in the controller. More...
|
|
void | addAnimation (std::string const &animationName, int frameWidth, int startFrame, int numFrames, int frameRate, std::string const &fileName) |
| Add an animation to the controller. More...
|
|
void | addAnimation (std::string const &animationName, int frameWidth, int numFrames, int frameRate, std::string const &fileName) |
| Add an animation to the controller that defaults to zero being the first frame. More...
|
|
ObjectAnimation * | getAnimation (std::string const &name) |
| Get a pointer to the specified animation. More...
|
|
| Component ()=default |
| Default constructor to set up.
|
|
virtual void | awake () |
| A function that will be called before all other start functions but after the component has been assigned to a GameObject.
|
|
virtual void | update () |
| A function for each component that is called every frame.
|
|
virtual void | fixedUpdate () |
| A function for each component that is called once every physics update.
|
|
void | setParent (GameObject *newParent) |
| A function to set the pointer to the parent rune::GameObject for each component. More...
|
|
void | setEnable (bool newEnable) |
| Enable or disable the component. More...
|
|
bool | isComponentEnabled (void) |
| Gets whether or not the current component is enabled.
|
|
void | onNotify (Signal const &signal) override |
| A virtual method to be overridden by a concrete implementation of the observer class.
|
|
This class is used to animate a rune::GameObject.
- Author
- Thomas Montano
- Date
- July 22 2020
◆ addAnimation() [1/2]
void rune::Animator::addAnimation |
( |
std::string const & |
animationName, |
|
|
int |
frameWidth, |
|
|
int |
numFrames, |
|
|
int |
frameRate, |
|
|
std::string const & |
fileName |
|
) |
| |
Add an animation to the controller that defaults to zero being the first frame.
- Parameters
-
animationName | The name of the animation to be referred to later when playing. |
frameWidth | The width of each frame of animation. |
numFrames | The total number of frames in the sprite sheet. |
frameRate | The rate that the frames should be displayed (in frames per second) |
fileName | The name of the file containing the sprite sheet. |
- Warning
- Do not call this in an rune::GameObject constructor. The spriteParent pointer must be resolved first.
◆ addAnimation() [2/2]
void rune::Animator::addAnimation |
( |
std::string const & |
animationName, |
|
|
int |
frameWidth, |
|
|
int |
startFrame, |
|
|
int |
numFrames, |
|
|
int |
frameRate, |
|
|
std::string const & |
fileName |
|
) |
| |
Add an animation to the controller.
- Parameters
-
animationName | The name of the animation to be referred to later when playing. |
frameWidth | The width of each frame of animation. |
startFrame | The frame that the animation should start on. |
numFrames | The total number of frames in the sprite sheet. |
frameRate | The rate that the frames should be displayed (in frames per second) |
fileName | The name of the file containing the sprite sheet. |
- Warning
- Do not call this in an rune::GameObject constructor. The spriteParent pointer must be resolved first.
◆ getAnimation()
Get a pointer to the specified animation.
- Parameters
-
name | The name of the animation to be returned. |
- Returns
- A pointer to the animation that was requested.
◆ playAnimation()
void rune::Animator::playAnimation |
( |
std::string const & |
animationName | ) |
|
Play an animation stored in the controller.
- Parameters
-
animationName | The name of the animation to play. |
- Warning
- Do not call this in an rune::GameObject constructor. The spriteParent pointer must be resolved first.
The documentation for this class was generated from the following files: