R-Type  2
Doom but in better
Loading...
Searching...
No Matches
GUI::ECS::Components::AnimationComponent Class Reference

#include <AnimationComponent.hpp>

Inheritance diagram for GUI::ECS::Components::AnimationComponent:
Inheritance graph
Collaboration diagram for GUI::ECS::Components::AnimationComponent:
Collaboration graph

Public Member Functions

 AnimationComponent ()
 Construct a new Animation Component object.
 
 AnimationComponent (const std::uint32_t entityId)
 Construct a new Animation Component object with the entity id.
 
 AnimationComponent (const std::vector< Recoded::IntRect > &rects)
 Construct a new Animation Component object with:
 
 AnimationComponent (const std::string &path, const unsigned int frameWidth, const unsigned int frameHeight, const bool startLeft, const bool startTop, const unsigned int initialFrame=0, const int endFrame=(-1))
 Construct a new Animation Component object with:
 
 AnimationComponent (const GUI::ECS::Components::TextureComponent &spritesheet, const unsigned int frameWidth, const unsigned int frameHeight, const bool startLeft, const bool startTop, const unsigned int initialFrame=0, const int endFrame=(-1))
 Construct a new Animation Component object with:
 
 AnimationComponent (const std::uint32_t entityId, const std::vector< Recoded::IntRect > &rects)
 Construct a new Animation Component object with:
 
 AnimationComponent (const std::uint32_t entityId, const std::string &path, const unsigned int frameWidth, const unsigned int frameHeight, const bool startLeft, const bool startTop, const unsigned int initialFrame=0, const int endFrame=(-1))
 Construct a new Animation Component object with:
 
 AnimationComponent (const std::uint32_t entityId, const GUI::ECS::Components::TextureComponent &spritesheet, const unsigned int frameWidth, const unsigned int frameHeight, const bool startLeft, const bool startTop, const unsigned int initialFrame=0, const int endFrame=(-1))
 Construct a new Animation Component object with:
 
 ~AnimationComponent ()
 Destroy the Animation Component object.
 
void setLoop (bool loop)
 Set the Loop object.
 
void setReadReverse (bool reverse)
 Set the Read Reverse object.
 
void setDelay (float frameDuration)
 Set the Delay object.
 
void setInitialFrame (std::uint32_t frameIndex)
 Set the Initial Frame object.
 
void setAnimation (const std::vector< Recoded::IntRect > &rects)
 Set the Animation object.
 
void setAnimation (const std::string &path, const unsigned int frameWidth, const unsigned int frameHeight, const bool startLeft, const bool startTop, const unsigned int initialFrame=0, const int endFrame=(-1))
 Set the Animation object.
 
void setAnimation (const GUI::ECS::Components::TextureComponent &spritesheet, const unsigned int frameWidth, const unsigned int frameHeight, const bool startLeft, const bool startTop, const unsigned int initialFrame=0, const int endFrame=(-1))
 Set the Animation object.
 
void checkTick ()
 Check if it is time to change the frame of the animation.
 
void forceTick ()
 Force the animation to tick regardless of the delay.
 
void start ()
 Start the playing of the animation from the current index in memory.
 
void pause ()
 Pause the playing of the animation but does not reset the index to the default frame.
 
void resume ()
 Resume the playing of the animation (has no effect if already playing)
 
void stop ()
 A function to stop the animation, and reset the index to the default frame.
 
const bool hasTicked ()
 A function to check if the frame has changed.
 
const bool hasLooped () const
 A function to check if the animation has looped around (valid for the 1rst frame of the new loop)
 
const bool isLooping () const
 Get the information about if the component is set to loop the animation.
 
const bool isPaused () const
 Get the information about the state of the animation (paused)
 
const bool isPlaying () const
 Get the information about the state of the animation (playing)
 
const bool isStopped () const
 Get the information about the state of the animation (stopped)
 
void update (const GUI::ECS::Components::AnimationComponent &copy)
 Update the current Animation component with another Animation class.
 
const bool getTicked () const
 A function to check if the frame has changed.
 
const bool getPaused () const
 Get the information about the state of the animation (paused/playing)
 
const bool getPlaying () const
 Get the information about the state of the animation (paused/playing)
 
const bool getStopped () const
 Get the information about the state of the animation (paused/playing)
 
const bool getLooped () const
 Get the information about if the animation has completed a loop (valid for the 1rst frame of the new loop)
 
const bool getLoop () const
 Get the info about if the animation is being read in a loop or not (once at the end, go back to the begining and start over)
 
const bool getReadReverse () const
 Get the info about if the order of the frames are being read from right to left instead of left to right.
 
const float getDelay () const
 Get the Delay object that is used before changing frames.
 
const std::uint32_t getFrameCount () const
 Get the total number of frames contained in the animation.
 
const std::uint32_t getInitialFrame () const
 Get the index of the frame considered as the first in the series of the animation.
 
const std::uint32_t getCurrentFrameIndex () const
 Get the index of the frame that is currently in use.
 
const Recoded::IntRect getCurrentFrame () const
 Get the index of the frame that is currently in use.
 
const GUI::ECS::Components::TextureComponent getBaseTexture () const
 Get the Base Texture object.
 
const std::pair< int, int > getFrameDimensions () const
 Get the dimension of the first frame under an std::pair<int, int> instance.
 
const Recoded::IntRect getCurrentRectangle () const
 Get the Rectangle that is currently in use.
 
const std::vector< Recoded::IntRectgetFrames () const
 Get all the frames loaded in the animation component.
 
const std::string getInfo (const unsigned int indent=0) const
 This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes.
 
const GUI::ECS::Systems::Clock getClock () const
 Get the Clock object.
 
AnimationComponentoperator= (const GUI::ECS::Components::AnimationComponent &copy)
 
- Public Member Functions inherited from GUI::ECS::EntityNode
 EntityNode (const size_t entityId=0)
 
virtual ~EntityNode ()=default
 
virtual size_t getEntityNodeId () const
 

Protected Member Functions

void _tick ()
 Main function to process the ticking of the animation.
 
void _tickReverse ()
 Advances the animation by one frame in reverse.
 
void _tickRegular ()
 Advances the animation by one frame in regular (forward) order.
 
void _processAnimation (const unsigned int frameWidth, const unsigned int frameHeight, const bool startLeft, const bool startTop, const unsigned int initialFrame=0, const int endFrame=(-1))
 Function in charge of generating the animation frames based on the provided information.
 
const short int _getIndexUpdater (const bool startBegining=true) const
 
const bool _continueLoop (const bool startBegining, const unsigned int position, const unsigned int maxValue) const
 

Protected Attributes

bool _looped = false
 A boolean instance in charge of informing the user that the program has looped (valid for the first 2 frames after the loop has occurred)
 
bool _loop = false
 A boolean instance in charge of informing the program to play the animation as a loop.
 
bool _paused = false
 A boolean instance in charge of informing the program to not play the animation but retain the current position.
 
bool _playing = false
 A boolean instance in charge of informing the program to play or resume the animation.
 
bool _stopped = false
 A boolean instance in charge of informing the program to not play the animation as well as resetting the index to the default one.
 
bool _hasTicked = false
 A boolean instance in charge of informing the user that the frame has been changed.
 
bool _readReverse = false
 A boolean instance in charge of informing the program to read the animation backwards.
 
std::uint32_t _frameDelay = 100
 An unsigned integer to store the delay to wait between each frame.
 
std::uint32_t _frameInitial = 0
 An unsigned integer to store the index of the initial frame (the default frame)
 
std::uint32_t _currentFrameIndex = 0
 An unsigned integer to store the index of the frame that is currently active.
 
std::uint32_t _totalFrames = 0
 An unsigned integer to store the total amount of frames in the animation.
 
GUI::ECS::Components::TextureComponent _baseTexture
 A Texture component to store the base texture that is used to derive all the animations rectangles.
 
std::vector< Recoded::IntRect_frames
 An std::vector of Rectangle components to store all the derived frames of the animation.
 
Recoded::IntRect _currentRectangle
 A Rectangle component to store the frame that is to be displayed.
 
GUI::ECS::Systems::Clock _clock
 A clock component that allows the Animation component to track time and know when to change frames.
 
- Protected Attributes inherited from GUI::ECS::EntityNode
size_t _entityID
 

Detailed Description

Definition at line 35 of file AnimationComponent.hpp.

Constructor & Destructor Documentation

◆ AnimationComponent() [1/8]

GUI::ECS::Components::AnimationComponent::AnimationComponent ( )

Construct a new Animation Component object.

Definition at line 16 of file AnimationComponent.cpp.

◆ AnimationComponent() [2/8]

GUI::ECS::Components::AnimationComponent::AnimationComponent ( const std::uint32_t entityId)

Construct a new Animation Component object with the entity id.

Parameters
entityIdThe id of the component

Definition at line 21 of file AnimationComponent.cpp.

◆ AnimationComponent() [3/8]

GUI::ECS::Components::AnimationComponent::AnimationComponent ( const std::vector< Recoded::IntRect > & rects)

Construct a new Animation Component object with:

  • The loaded IntRect's ready to be played
Parameters
rectsThe loaded IntRects ready to be played

Definition at line 26 of file AnimationComponent.cpp.

◆ AnimationComponent() [4/8]

GUI::ECS::Components::AnimationComponent::AnimationComponent ( const std::string & path,
const unsigned int frameWidth,
const unsigned int frameHeight,
const bool startLeft,
const bool startTop,
const unsigned int initialFrame = 0,
const int endFrame = (-1) )

Construct a new Animation Component object with:

  • The path to the spritesheet
  • The width of the frame
  • The height of the frame
  • Start parsing the animation from the left
  • Start parsing the animation from the right
Parameters
path
frameWidth
frameHeight
startLeft
startTop

Definition at line 32 of file AnimationComponent.cpp.

◆ AnimationComponent() [5/8]

GUI::ECS::Components::AnimationComponent::AnimationComponent ( const GUI::ECS::Components::TextureComponent & spritesheet,
const unsigned int frameWidth,
const unsigned int frameHeight,
const bool startLeft,
const bool startTop,
const unsigned int initialFrame = 0,
const int endFrame = (-1) )

Construct a new Animation Component object with:

  • The loaded raw spritesheet
  • The width of the frame
  • The height of the frame
  • Start parsing the animation from the left
  • Start parsing the animation from the right
Parameters
spritesheetPath to the spritesheet
frameWidthWidth of the frame for the sprite
frameHeightHeight of the frame for the sprite
startLeftStart parsing the animation from the left
startTopStart parsing the animation from the top

Definition at line 38 of file AnimationComponent.cpp.

◆ AnimationComponent() [6/8]

GUI::ECS::Components::AnimationComponent::AnimationComponent ( const std::uint32_t entityId,
const std::vector< Recoded::IntRect > & rects )

Construct a new Animation Component object with:

  • The id of the entity
  • The loaded IntRects ready to be played
Parameters
entityIdId of the component
rectsThe IntRects ready to be played

Definition at line 44 of file AnimationComponent.cpp.

◆ AnimationComponent() [7/8]

GUI::ECS::Components::AnimationComponent::AnimationComponent ( const std::uint32_t entityId,
const std::string & path,
const unsigned int frameWidth,
const unsigned int frameHeight,
const bool startLeft,
const bool startTop,
const unsigned int initialFrame = 0,
const int endFrame = (-1) )

Construct a new Animation Component object with:

  • The id of the entity
  • The path to the spritesheet
  • The width of the frame
  • The height of the frame
  • Start parsing the animation from the left
  • Start parsing the animation from the right
Parameters
entityIdId of the component
spritesheetPath to the spritesheet
frameWidthWidth of the frame for the sprite
frameHeightHeight of the frame for the sprite
startLeftStart parsing the animation from the left
startTopStart parsing the animation from the top

Definition at line 50 of file AnimationComponent.cpp.

◆ AnimationComponent() [8/8]

GUI::ECS::Components::AnimationComponent::AnimationComponent ( const std::uint32_t entityId,
const GUI::ECS::Components::TextureComponent & spritesheet,
const unsigned int frameWidth,
const unsigned int frameHeight,
const bool startLeft,
const bool startTop,
const unsigned int initialFrame = 0,
const int endFrame = (-1) )

Construct a new Animation Component object with:

  • The id of the entity
  • The loaded raw spritesheet
  • The width of the frame
  • The height of the frame
  • Start parsing the animation from the left
  • Start parsing the animation from the right
Parameters
entityIdId of the component
spritesheetThe spritsheet
frameWidthWidth of the frame for the sprite
frameHeightHeight of the frame for the sprite
startLeftStart parsing the animation from the left
startTopStart parsing the animation from the top

Definition at line 56 of file AnimationComponent.cpp.

◆ ~AnimationComponent()

GUI::ECS::Components::AnimationComponent::~AnimationComponent ( )

Destroy the Animation Component object.

Definition at line 64 of file AnimationComponent.cpp.

Member Function Documentation

◆ _continueLoop()

const bool GUI::ECS::Components::AnimationComponent::_continueLoop ( const bool startBegining,
const unsigned int position,
const unsigned int maxValue ) const
protected

Definition at line 734 of file AnimationComponent.cpp.

◆ _getIndexUpdater()

const short int GUI::ECS::Components::AnimationComponent::_getIndexUpdater ( const bool startBegining = true) const
protected

Definition at line 726 of file AnimationComponent.cpp.

◆ _processAnimation()

void GUI::ECS::Components::AnimationComponent::_processAnimation ( const unsigned int frameWidth,
const unsigned int frameHeight,
const bool startLeft,
const bool startTop,
const unsigned int initialFrame = 0,
const int endFrame = (-1) )
protected

Function in charge of generating the animation frames based on the provided information.

Parameters
frameWidthThe width of the resulting sprite
frameHeightThe height of the resulting sprite
startLeftStart from the left
startTopStart from the top

Definition at line 505 of file AnimationComponent.cpp.

◆ _tick()

void GUI::ECS::Components::AnimationComponent::_tick ( )
protected

Main function to process the ticking of the animation.

This function is responsible for advancing the current frame of the animation. It first checks if the animation is paused, if there are frames to render, and if the initial frame is valid. It then calls either _tickRegular() or _tickReverse() based on the direction of the animation (forward or reverse).

If the animation is paused, no frame is updated. If there are no frames or if the initial frame is invalid, appropriate exceptions are thrown. This function decides whether to proceed with regular or reverse ticking of the frames.

Exceptions
CustomExceptions::InvalidIndexIf there are no frames, or if the frame index exceeds the valid range.

Definition at line 410 of file AnimationComponent.cpp.

◆ _tickRegular()

void GUI::ECS::Components::AnimationComponent::_tickRegular ( )
protected

Advances the animation by one frame in regular (forward) order.

This function is responsible for incrementing the current frame index in forward order. If the next frame exceeds the total number of frames, the index is reset either to the first frame or the initial frame, depending on whether looping is enabled. The current frame is then updated.

Exceptions
CustomExceptions::InvalidIndexIf the initial frame is invalid or greater than the total number of frames.

Definition at line 476 of file AnimationComponent.cpp.

◆ _tickReverse()

void GUI::ECS::Components::AnimationComponent::_tickReverse ( )
protected

Advances the animation by one frame in reverse.

This function is responsible for decrementing the current frame index in reverse order. If the next frame is out of bounds (i.e., the index becomes negative), the frame index is reset either to the last frame or the initial frame depending on whether looping is enabled. The current frame is then updated.

Exceptions
CustomExceptions::InvalidIndexIf the initial frame is invalid or greater than the total number of frames.

Definition at line 445 of file AnimationComponent.cpp.

◆ checkTick()

void GUI::ECS::Components::AnimationComponent::checkTick ( )

Check if it is time to change the frame of the animation.

Definition at line 121 of file AnimationComponent.cpp.

◆ forceTick()

void GUI::ECS::Components::AnimationComponent::forceTick ( )

Force the animation to tick regardless of the delay.

Definition at line 130 of file AnimationComponent.cpp.

◆ getBaseTexture()

const GUI::ECS::Components::TextureComponent GUI::ECS::Components::AnimationComponent::getBaseTexture ( ) const

Get the Base Texture object.

Returns
const GUI::ECS::Components::TextureComponent

Definition at line 339 of file AnimationComponent.cpp.

◆ getClock()

const GUI::ECS::Systems::Clock GUI::ECS::Components::AnimationComponent::getClock ( ) const

Get the Clock object.

Returns
const GUI::ECS::Systems::Clock
Note
This function is intended for the update function, you can call it but I'm not sure the clock instance will be of any use without the animation component class to go with it

Definition at line 396 of file AnimationComponent.cpp.

◆ getCurrentFrame()

const Recoded::IntRect GUI::ECS::Components::AnimationComponent::getCurrentFrame ( ) const

Get the index of the frame that is currently in use.

Returns
const Recoded::IntRect

Definition at line 320 of file AnimationComponent.cpp.

◆ getCurrentFrameIndex()

const std::uint32_t GUI::ECS::Components::AnimationComponent::getCurrentFrameIndex ( ) const

Get the index of the frame that is currently in use.

Returns
const std::uint32_t

Definition at line 309 of file AnimationComponent.cpp.

◆ getCurrentRectangle()

const Recoded::IntRect GUI::ECS::Components::AnimationComponent::getCurrentRectangle ( ) const

Get the Rectangle that is currently in use.

Returns
const Recoded::IntRect

Definition at line 356 of file AnimationComponent.cpp.

◆ getDelay()

const float GUI::ECS::Components::AnimationComponent::getDelay ( ) const

Get the Delay object that is used before changing frames.

Returns
const float

Definition at line 294 of file AnimationComponent.cpp.

◆ getFrameCount()

const std::uint32_t GUI::ECS::Components::AnimationComponent::getFrameCount ( ) const

Get the total number of frames contained in the animation.

Returns
const std::uint32_t

Definition at line 299 of file AnimationComponent.cpp.

◆ getFrameDimensions()

const std::pair< int, int > GUI::ECS::Components::AnimationComponent::getFrameDimensions ( ) const

Get the dimension of the first frame under an std::pair<int, int> instance.

Returns
const std::pair<int, int>
Exceptions
CustomExceptions::NoAnimationFramesif there are no frames to read the content from.

Definition at line 344 of file AnimationComponent.cpp.

◆ getFrames()

const std::vector< Recoded::IntRect > GUI::ECS::Components::AnimationComponent::getFrames ( ) const

Get all the frames loaded in the animation component.

Returns
const std::vector<Recoded::IntRect>

Definition at line 361 of file AnimationComponent.cpp.

◆ getInfo()

const std::string GUI::ECS::Components::AnimationComponent::getInfo ( const unsigned int indent = 0) const

This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes.

Parameters
indentThe level to which the class should be indented in the dump.
Returns
const std::string The formatted output.

Definition at line 366 of file AnimationComponent.cpp.

◆ getInitialFrame()

const std::uint32_t GUI::ECS::Components::AnimationComponent::getInitialFrame ( ) const

Get the index of the frame considered as the first in the series of the animation.

Returns
const std::uint32_t

Definition at line 304 of file AnimationComponent.cpp.

◆ getLoop()

const bool GUI::ECS::Components::AnimationComponent::getLoop ( ) const

Get the info about if the animation is being read in a loop or not (once at the end, go back to the begining and start over)

Returns
true The animation is looping
false The animation is not looping

Definition at line 284 of file AnimationComponent.cpp.

◆ getLooped()

const bool GUI::ECS::Components::AnimationComponent::getLooped ( ) const

Get the information about if the animation has completed a loop (valid for the 1rst frame of the new loop)

Returns
true The program has looped
false The program has not looped
Note
This function is there for cpp convention logics as well as the update function, please use it's sister function hasLooped

Definition at line 279 of file AnimationComponent.cpp.

◆ getPaused()

const bool GUI::ECS::Components::AnimationComponent::getPaused ( ) const

Get the information about the state of the animation (paused/playing)

Returns
true The animation is paused
false The animation is playing or stopped
Note
This function is there for cpp convention logics as well as the update function, please use it's sister function isPaused

Definition at line 264 of file AnimationComponent.cpp.

◆ getPlaying()

const bool GUI::ECS::Components::AnimationComponent::getPlaying ( ) const

Get the information about the state of the animation (paused/playing)

Returns
true The animation is playing
false The animation is paused or stopped
Note
This function is there for cpp convention logics as well as the update function, please use it's sister function isPlaying

Definition at line 269 of file AnimationComponent.cpp.

◆ getReadReverse()

const bool GUI::ECS::Components::AnimationComponent::getReadReverse ( ) const

Get the info about if the order of the frames are being read from right to left instead of left to right.

Returns
true reading from right to left
false reading from left to right

Definition at line 289 of file AnimationComponent.cpp.

◆ getStopped()

const bool GUI::ECS::Components::AnimationComponent::getStopped ( ) const

Get the information about the state of the animation (paused/playing)

Returns
true The animation is stopped
false The animation is playing or paused
Note
This function is there for cpp convention logics as well as the update function, please use it's sister function isStopped

Definition at line 274 of file AnimationComponent.cpp.

◆ getTicked()

const bool GUI::ECS::Components::AnimationComponent::getTicked ( ) const

A function to check if the frame has changed.

Returns
true
false
Note
This is a function intended for the update function, if you wish to check if the clock has ticked, please use it's sister function hasTicked

Definition at line 259 of file AnimationComponent.cpp.

◆ hasLooped()

const bool GUI::ECS::Components::AnimationComponent::hasLooped ( ) const

A function to check if the animation has looped around (valid for the 1rst frame of the new loop)

Returns
true The animation has looped
false The animation has not looped

Definition at line 182 of file AnimationComponent.cpp.

◆ hasTicked()

const bool GUI::ECS::Components::AnimationComponent::hasTicked ( )

A function to check if the frame has changed.

Returns
true
false

Definition at line 173 of file AnimationComponent.cpp.

◆ isLooping()

const bool GUI::ECS::Components::AnimationComponent::isLooping ( ) const

Get the information about if the component is set to loop the animation.

Returns
true The component will loop the animation
false The component will not loop the animation

Definition at line 187 of file AnimationComponent.cpp.

◆ isPaused()

const bool GUI::ECS::Components::AnimationComponent::isPaused ( ) const

Get the information about the state of the animation (paused)

Returns
true The animation is paused
false The animation is playing or stopped

Definition at line 192 of file AnimationComponent.cpp.

◆ isPlaying()

const bool GUI::ECS::Components::AnimationComponent::isPlaying ( ) const

Get the information about the state of the animation (playing)

Returns
true The animation is playing
false The animation is paused or stopped

Definition at line 197 of file AnimationComponent.cpp.

◆ isStopped()

const bool GUI::ECS::Components::AnimationComponent::isStopped ( ) const

Get the information about the state of the animation (stopped)

Returns
true The animation is stopped
false The animation is playing or paused

Definition at line 202 of file AnimationComponent.cpp.

◆ operator=()

GUI::ECS::Components::AnimationComponent & GUI::ECS::Components::AnimationComponent::operator= ( const GUI::ECS::Components::AnimationComponent & copy)

Definition at line 401 of file AnimationComponent.cpp.

◆ pause()

void GUI::ECS::Components::AnimationComponent::pause ( )

Pause the playing of the animation but does not reset the index to the default frame.

Definition at line 146 of file AnimationComponent.cpp.

◆ resume()

void GUI::ECS::Components::AnimationComponent::resume ( )

Resume the playing of the animation (has no effect if already playing)

Definition at line 155 of file AnimationComponent.cpp.

◆ setAnimation() [1/3]

void GUI::ECS::Components::AnimationComponent::setAnimation ( const GUI::ECS::Components::TextureComponent & spritesheet,
const unsigned int frameWidth,
const unsigned int frameHeight,
const bool startLeft,
const bool startTop,
const unsigned int initialFrame = 0,
const int endFrame = (-1) )

Set the Animation object.

Parameters
spritesheet
frameWidth
frameHeight
startLeft
startTop

Definition at line 115 of file AnimationComponent.cpp.

◆ setAnimation() [2/3]

void GUI::ECS::Components::AnimationComponent::setAnimation ( const std::string & path,
const unsigned int frameWidth,
const unsigned int frameHeight,
const bool startLeft,
const bool startTop,
const unsigned int initialFrame = 0,
const int endFrame = (-1) )

Set the Animation object.

Parameters
path
frameWidth
frameHeight
startLeft
startTop

Definition at line 109 of file AnimationComponent.cpp.

◆ setAnimation() [3/3]

void GUI::ECS::Components::AnimationComponent::setAnimation ( const std::vector< Recoded::IntRect > & rects)

Set the Animation object.

Parameters
rects

Definition at line 103 of file AnimationComponent.cpp.

◆ setDelay()

void GUI::ECS::Components::AnimationComponent::setDelay ( float frameDuration)

Set the Delay object.

Parameters
frameDuration

Definition at line 76 of file AnimationComponent.cpp.

◆ setInitialFrame()

void GUI::ECS::Components::AnimationComponent::setInitialFrame ( std::uint32_t frameIndex)

Set the Initial Frame object.

Parameters
frameIndex

Definition at line 91 of file AnimationComponent.cpp.

◆ setLoop()

void GUI::ECS::Components::AnimationComponent::setLoop ( bool loop)

Set the Loop object.

Parameters
loop

Definition at line 66 of file AnimationComponent.cpp.

◆ setReadReverse()

void GUI::ECS::Components::AnimationComponent::setReadReverse ( bool reverse)

Set the Read Reverse object.

Parameters
reverse

Definition at line 71 of file AnimationComponent.cpp.

◆ start()

void GUI::ECS::Components::AnimationComponent::start ( )

Start the playing of the animation from the current index in memory.

Definition at line 137 of file AnimationComponent.cpp.

◆ stop()

void GUI::ECS::Components::AnimationComponent::stop ( )

A function to stop the animation, and reset the index to the default frame.

Definition at line 164 of file AnimationComponent.cpp.

◆ update()

void GUI::ECS::Components::AnimationComponent::update ( const GUI::ECS::Components::AnimationComponent & copy)

Update the current Animation component with another Animation class.

Parameters
copy

Definition at line 207 of file AnimationComponent.cpp.

Field Documentation

◆ _baseTexture

GUI::ECS::Components::TextureComponent GUI::ECS::Components::AnimationComponent::_baseTexture
protected

A Texture component to store the base texture that is used to derive all the animations rectangles.

Definition at line 485 of file AnimationComponent.hpp.

◆ _clock

GUI::ECS::Systems::Clock GUI::ECS::Components::AnimationComponent::_clock
protected

A clock component that allows the Animation component to track time and know when to change frames.

Definition at line 488 of file AnimationComponent.hpp.

◆ _currentFrameIndex

std::uint32_t GUI::ECS::Components::AnimationComponent::_currentFrameIndex = 0
protected

An unsigned integer to store the index of the frame that is currently active.

Definition at line 483 of file AnimationComponent.hpp.

◆ _currentRectangle

Recoded::IntRect GUI::ECS::Components::AnimationComponent::_currentRectangle
protected

A Rectangle component to store the frame that is to be displayed.

Definition at line 487 of file AnimationComponent.hpp.

◆ _frameDelay

std::uint32_t GUI::ECS::Components::AnimationComponent::_frameDelay = 100
protected

An unsigned integer to store the delay to wait between each frame.

Definition at line 481 of file AnimationComponent.hpp.

◆ _frameInitial

std::uint32_t GUI::ECS::Components::AnimationComponent::_frameInitial = 0
protected

An unsigned integer to store the index of the initial frame (the default frame)

Definition at line 482 of file AnimationComponent.hpp.

◆ _frames

std::vector<Recoded::IntRect> GUI::ECS::Components::AnimationComponent::_frames
protected

An std::vector of Rectangle components to store all the derived frames of the animation.

Definition at line 486 of file AnimationComponent.hpp.

◆ _hasTicked

bool GUI::ECS::Components::AnimationComponent::_hasTicked = false
protected

A boolean instance in charge of informing the user that the frame has been changed.

Definition at line 479 of file AnimationComponent.hpp.

◆ _loop

bool GUI::ECS::Components::AnimationComponent::_loop = false
protected

A boolean instance in charge of informing the program to play the animation as a loop.

Definition at line 475 of file AnimationComponent.hpp.

◆ _looped

bool GUI::ECS::Components::AnimationComponent::_looped = false
protected

A boolean instance in charge of informing the user that the program has looped (valid for the first 2 frames after the loop has occurred)

Definition at line 474 of file AnimationComponent.hpp.

◆ _paused

bool GUI::ECS::Components::AnimationComponent::_paused = false
protected

A boolean instance in charge of informing the program to not play the animation but retain the current position.

Definition at line 476 of file AnimationComponent.hpp.

◆ _playing

bool GUI::ECS::Components::AnimationComponent::_playing = false
protected

A boolean instance in charge of informing the program to play or resume the animation.

Definition at line 477 of file AnimationComponent.hpp.

◆ _readReverse

bool GUI::ECS::Components::AnimationComponent::_readReverse = false
protected

A boolean instance in charge of informing the program to read the animation backwards.

Definition at line 480 of file AnimationComponent.hpp.

◆ _stopped

bool GUI::ECS::Components::AnimationComponent::_stopped = false
protected

A boolean instance in charge of informing the program to not play the animation as well as resetting the index to the default one.

Definition at line 478 of file AnimationComponent.hpp.

◆ _totalFrames

std::uint32_t GUI::ECS::Components::AnimationComponent::_totalFrames = 0
protected

An unsigned integer to store the total amount of frames in the animation.

Definition at line 484 of file AnimationComponent.hpp.


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