Platformer
Platformer
Public Member Functions | Public Attributes | List of all members
Animation Struct Reference

Struct for a single animation. More...

#include <AnimationRenderComponent.hpp>

Collaboration diagram for Animation:
Collaboration graph

Public Member Functions

 Animation (const std::string &spriteSheet, unsigned int srcX, unsigned int srcY, unsigned int srcW, unsigned int srcH, unsigned int numFrames, unsigned int frameDifference, unsigned int FPS)
 Constructs a new animation. More...
 
std::shared_ptr< SDL_Rect > GetRectForFrame (unsigned int frame)
 Gets the rect of the spritesheet representing the current frame. More...
 

Public Attributes

std::string spriteSheet
 The spritesheet for this animation.
 
unsigned int srcX
 The source rect's x coordinate for this animation.
 
unsigned int srcY
 The source rect's y coordinate for this animation.
 
unsigned int srcW
 The source rect's width for this animation.
 
unsigned int srcH
 The source rect's height for this animation.
 
unsigned int numFrames
 The number of frames of this animation.
 
unsigned int frameDifference
 The x-axis distance between each frame of the animation.
 
unsigned int FPS
 The frames per second of this animation.
 

Detailed Description

Struct for a single animation.

Constructor & Destructor Documentation

◆ Animation()

Animation::Animation ( const std::string &  spriteSheet,
unsigned int  srcX,
unsigned int  srcY,
unsigned int  srcW,
unsigned int  srcH,
unsigned int  numFrames,
unsigned int  frameDifference,
unsigned int  FPS 
)

Constructs a new animation.

Parameters
spriteSheetThe spritesheet for this animation
srcXThe source rect's x coordinate for this animation
srcYThe source rect's y coordinate for this animation
srcWThe source rect's width for this animation
srcHThe source rect's height for this animation
numFramesThe number of frames of this animation
frameDifferenceThe x-axis distance between each frame of the animation
FPSThe frames per second of this animation

Member Function Documentation

◆ GetRectForFrame()

std::shared_ptr< SDL_Rect > Animation::GetRectForFrame ( unsigned int  frame)

Gets the rect of the spritesheet representing the current frame.

Parameters
frameThe frame of the rect needed

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