Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
KatanaEngine::Animation Class Reference

Represents timing and framing values for texture animations. More...

#include <Animation.h>

Inheritance diagram for KatanaEngine::Animation:

Public Member Functions

 Animation ()
 
virtual ~Animation ()
 
virtual void Update (const GameTime &gameTime)
 Updates the animation.
 
virtual bool Load (const std::string &path, ResourceManager *pManager)
 Load the desired animation into memory.
 
virtual bool IsCloneable () const
 Used to determine if the animation is cloneable.
 
virtual ResourceClone ()
 Used to create a clone of the animation.
 
virtual RegionGetCurrentFrame ()
 Gets a pointer to the current frame.
 
virtual int GetCurrentIndex ()
 Gets the index of the current frame.
 
virtual RegionGetFrame (const int index)
 Gets a pointer to the indexed frame.
 
virtual TextureGetTexture () const
 Gets a pointer to the texture of the animation.
 
virtual void SetTexture (Texture *pTexture)
 Sets the texture of the animation.
 
virtual void SetCurrentFrame (const unsigned int index)
 Sets the current frame of the animation.
 
virtual bool IsPlaying () const
 Determines if the animation is playing.
 
virtual void Play ()
 Starts or resumes the animation.
 
virtual void Pause ()
 Pauses the animation.
 
virtual void Stop ()
 Stops the animation.
 
virtual void SetLoopCount (uint16_t loops=-1)
 Sets how many times the animation will run before it stops.
 
- Public Member Functions inherited from KatanaEngine::Resource
virtual ~Resource ()
 
unsigned short GetResourceID () const
 Gets the ID of the resource.
 

Additional Inherited Members

- Protected Member Functions inherited from KatanaEngine::Resource
void Split (const std::string &line, const char delimeter, std::vector< std::string > &elements)
 Splits a string into a vector of strings.
 
void ParseComments (std::string &line)
 Removes c-style, single-line comments from a line of text.
 
void TrimLine (std::string &line)
 Removes white-space at the front and end of a line of text.
 
ResourceManagerGetResourceManager ()
 Gets a pointer to the ResourceManager that was used to load the resource.
 

Detailed Description

Represents timing and framing values for texture animations.

Definition at line 20 of file Animation.h.

Constructor & Destructor Documentation

◆ Animation()

KatanaEngine::Animation::Animation ( )

Definition at line 19 of file Animation.cpp.

◆ ~Animation()

KatanaEngine::Animation::~Animation ( )
virtual

Definition at line 29 of file Animation.cpp.

Member Function Documentation

◆ Clone()

Resource * KatanaEngine::Animation::Clone ( )
virtual

Used to create a clone of the animation.

Returns
Returns a clone of the animation.

Reimplemented from KatanaEngine::Resource.

Definition at line 129 of file Animation.cpp.

◆ GetCurrentFrame()

virtual Region * KatanaEngine::Animation::GetCurrentFrame ( )
inlinevirtual

Gets a pointer to the current frame.

Returns
Returns a Region that defines the size and position of the current frame.

Definition at line 51 of file Animation.h.

◆ GetCurrentIndex()

virtual int KatanaEngine::Animation::GetCurrentIndex ( )
inlinevirtual

Gets the index of the current frame.

Returns
Returns the current frame's index.

Definition at line 55 of file Animation.h.

◆ GetFrame()

virtual Region * KatanaEngine::Animation::GetFrame ( const int index)
inlinevirtual

Gets a pointer to the indexed frame.

Returns
Returns a Region that defines the size and position of the indexed frame.

Definition at line 59 of file Animation.h.

◆ GetTexture()

virtual Texture * KatanaEngine::Animation::GetTexture ( ) const
inlinevirtual

Gets a pointer to the texture of the animation.

Returns
Returns a pointer to the texture.

Definition at line 63 of file Animation.h.

◆ IsCloneable()

virtual bool KatanaEngine::Animation::IsCloneable ( ) const
inlinevirtual

Used to determine if the animation is cloneable.

Returns
Returns true if the animation is clonable, false otherwise.
Remarks
Animations should usually be kept as cloneable. Sharing an animation will result in the animations playing syncronized.

Implements KatanaEngine::Resource.

Definition at line 43 of file Animation.h.

◆ IsPlaying()

virtual bool KatanaEngine::Animation::IsPlaying ( ) const
inlinevirtual

Determines if the animation is playing.

Returns
Returns true if the animation is playing, false otherwise.

Definition at line 76 of file Animation.h.

◆ Load()

bool KatanaEngine::Animation::Load ( const std::string & path,
ResourceManager * pManager )
virtual

Load the desired animation into memory.

Parameters
pathThe path to the desired animation.
pManagerA pointer to the resource manager that will manage the animation.
Returns
Returns true if the animation was loaded, false otherwise.

Implements KatanaEngine::Resource.

Definition at line 62 of file Animation.cpp.

◆ Pause()

virtual void KatanaEngine::Animation::Pause ( )
inlinevirtual

Pauses the animation.

Definition at line 82 of file Animation.h.

◆ Play()

virtual void KatanaEngine::Animation::Play ( )
inlinevirtual

Starts or resumes the animation.

Definition at line 79 of file Animation.h.

◆ SetCurrentFrame()

void KatanaEngine::Animation::SetCurrentFrame ( const unsigned int index)
virtual

Sets the current frame of the animation.

Parameters
indexThe index of the frame to set as the current frame.
Remarks
If the indexed frame is invalid it will be ignored.

Definition at line 113 of file Animation.cpp.

◆ SetLoopCount()

virtual void KatanaEngine::Animation::SetLoopCount ( uint16_t loops = -1)
inlinevirtual

Sets how many times the animation will run before it stops.

Parameters
loopsThe number of loops to play. Setting loops to -1 will make the animation loop infinitely.

Definition at line 90 of file Animation.h.

◆ SetTexture()

virtual void KatanaEngine::Animation::SetTexture ( Texture * pTexture)
inlinevirtual

Sets the texture of the animation.

Parameters
pTextureA pointer to the texture resource.

Definition at line 67 of file Animation.h.

◆ Stop()

void KatanaEngine::Animation::Stop ( )
virtual

Stops the animation.

Definition at line 123 of file Animation.cpp.

◆ Update()

void KatanaEngine::Animation::Update ( const GameTime & gameTime)
virtual

Updates the animation.

Parameters
gameTimeA reference to the game time object.

Definition at line 40 of file Animation.cpp.


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