Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
rune::Animator Class Reference

This class is used to animate a rune::GameObject. More...

#include <animator.h>

Inheritance diagram for rune::Animator:
Collaboration diagram for rune::Animator:

Public Member Functions

 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...
 
ObjectAnimationgetAnimation (std::string const &name)
 Get a pointer to the specified animation. More...
 
- Public Member Functions inherited from rune::Component
 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.
 

Additional Inherited Members

- Protected Attributes inherited from rune::Component
GameObjectparentObject = nullptr
 The rune::GameObject that this component is attached to. If not attached to a rune::GameObject this will equal nullptr.
 
bool isEnabled = true
 Whether or not the component is currently enabled. If not enabled, update function will not be called.
 

Detailed Description

This class is used to animate a rune::GameObject.

Author
Thomas Montano
Date
July 22 2020

Member Function Documentation

◆ 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
animationNameThe name of the animation to be referred to later when playing.
frameWidthThe width of each frame of animation.
numFramesThe total number of frames in the sprite sheet.
frameRateThe rate that the frames should be displayed (in frames per second)
fileNameThe 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
animationNameThe name of the animation to be referred to later when playing.
frameWidthThe width of each frame of animation.
startFrameThe frame that the animation should start on.
numFramesThe total number of frames in the sprite sheet.
frameRateThe rate that the frames should be displayed (in frames per second)
fileNameThe 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()

rune::ObjectAnimation * rune::Animator::getAnimation ( std::string const &  name)

Get a pointer to the specified animation.

Parameters
nameThe 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
animationNameThe 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: