Platformer
Platformer
Public Member Functions | Private Attributes | List of all members
AnimationRenderComponent Class Reference

An AnimationRenderComponent class. More...

#include <AnimationRenderComponent.hpp>

Inheritance diagram for AnimationRenderComponent:
Inheritance graph
Collaboration diagram for AnimationRenderComponent:
Collaboration graph

Public Member Functions

 AnimationRenderComponent (std::unordered_map< unsigned int, Animation > map)
 Constructs a new AnimationRenderComponent. More...
 
void SwitchState (unsigned int state)
 Switches the current animation state. More...
 
void Update () override
 Updates this component.
 
- Public Member Functions inherited from RenderComponent
 RenderComponent ()
 Constructs a new RenderComponent.
 
virtual void Render ()
 Renders this component based on the given camera.
 
- Public Member Functions inherited from Component
void SetParentGameObject (std::weak_ptr< GameObject > g)
 Sets the given GameObject as this component's parent. More...
 
virtual void Init ()
 Initializes this component.
 
std::shared_ptr< GameObjectGetGameObject ()
 Gets a shared ptr reference to this component's GameObject. More...
 

Private Attributes

std::unordered_map< unsigned int, AnimationstateMap
 The map of state IDs to animations.
 
unsigned int curState
 The current state of this animation eg: running.
 
unsigned int curIndex
 The current frame of the animation.
 
float timer
 Times when the next frame of the animation is needed.
 

Additional Inherited Members

- Public Attributes inherited from RenderComponent
SDL_RendererFlip renderFlip = SDL_FLIP_NONE
 Whether the renderer should be flipped.
 
- Protected Attributes inherited from RenderComponent
std::shared_ptr< SDLTextureWrappertexture
 The texture for this RenderComponent.
 
std::shared_ptr< SDL_Rect > renderSrc
 The source rect to be used, null if the whole texture is used.
 
- Protected Attributes inherited from Component
std::weak_ptr< GameObjectgameObject
 This component's parent GameObject.
 

Detailed Description

An AnimationRenderComponent class.

This represents an animation object within our game, which has multiple states and spritesheets.

Constructor & Destructor Documentation

◆ AnimationRenderComponent()

AnimationRenderComponent::AnimationRenderComponent ( std::unordered_map< unsigned int, Animation map)

Constructs a new AnimationRenderComponent.

Parameters
mapThe map of state IDs to animations
Here is the call graph for this function:

Member Function Documentation

◆ SwitchState()

void AnimationRenderComponent::SwitchState ( unsigned int  state)

Switches the current animation state.

Parameters
stateThe state to be switched to
Here is the call graph for this function:
Here is the caller graph for this function:

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