Skip to content

Struct Engine::AnimationClip

ClassList > Engine > AnimationClip

Encapsulates static configuration data for a single animation state. More...

  • #include <Animation.hpp>

Public Attributes

Type Name
std::vector< std::string > assetPaths
std::vector< FrameData > frameData
float frameDuration = 0.1f
float frameHeight = 0.0f
float frameWidth = 0.0f
bool loop = true
std::string name = "Idle"
std::size_t totalFrames = 0

Public Functions

Type Name
AnimationClip () = default
Default constructor.
AnimationClip (std::string clipName, std::vector< std::string > paths, float duration=0.1f, bool isLooping=true)
Constructs a clip from multiple individual image files.
AnimationClip (std::string clipName, const std::string & sheetPath, float width, float height, std::size_t total=0, float duration=0.1f, bool isLooping=true)
Constructs a clip for uniform grid-based spritesheets.
AnimationClip (std::string clipName, const std::string & sheetPath, std::vector< FrameData > frames, float duration=0.1f, bool isLooping=true)
Constructs a clip using explicit custom FrameData definitions.

Detailed Description

Stores frame sources, slicing geometry, timing, and looping settings. Supports three workflows: * Multiple discrete file paths (assetPaths). * Uniform spritesheet slicing (frameWidth x frameHeight). * Custom variable-sized frames (frameData).

Public Attributes Documentation

variable assetPaths

std::vector<std::string> Engine::AnimationClip::assetPaths;

Paths to image assets or a single spritesheet.


variable frameData

std::vector<FrameData> Engine::AnimationClip::frameData;

Explicit frame rectangles for variable spritesheets.


variable frameDuration

float Engine::AnimationClip::frameDuration;

Playback time per frame in seconds.


variable frameHeight

float Engine::AnimationClip::frameHeight;

Height of each frame for uniform slicing (0 = full sprite).


variable frameWidth

float Engine::AnimationClip::frameWidth;

Width of each frame for uniform slicing (0 = full sprite).


variable loop

bool Engine::AnimationClip::loop;

Indicates whether playback repeats after finishing.


variable name

std::string Engine::AnimationClip::name;

Unique identifier name of the clip.


variable totalFrames

std::size_t Engine::AnimationClip::totalFrames;

Total frame count override (0 = auto-calculate).


Public Functions Documentation

function AnimationClip [¼]

Default constructor.

Engine::AnimationClip::AnimationClip () = default


function AnimationClip [2/4]

Constructs a clip from multiple individual image files.

Engine::AnimationClip::AnimationClip (
    std::string clipName,
    std::vector< std::string > paths,
    float duration=0.1f,
    bool isLooping=true
) 

Parameters:

  • clipName Identifier for the animation clip.
  • paths List of asset paths representing sequential frames.
  • duration Display time per frame in seconds.
  • isLooping Whether the animation loops continuously.

function AnimationClip [¾]

Constructs a clip for uniform grid-based spritesheets.

Engine::AnimationClip::AnimationClip (
    std::string clipName,
    const std::string & sheetPath,
    float width,
    float height,
    std::size_t total=0,
    float duration=0.1f,
    bool isLooping=true
) 

Parameters:

  • clipName Identifier for the animation clip.
  • sheetPath Path to the spritesheet texture asset.
  • width Width of a single frame cell in pixels.
  • height Height of a single frame cell in pixels.
  • total Total number of frames in the grid (0 = auto-calculate).
  • duration Display time per frame in seconds.
  • isLooping Whether the animation loops continuously.

function AnimationClip [4/4]

Constructs a clip using explicit custom FrameData definitions.

Engine::AnimationClip::AnimationClip (
    std::string clipName,
    const std::string & sheetPath,
    std::vector< FrameData > frames,
    float duration=0.1f,
    bool isLooping=true
) 

Parameters:

  • clipName Identifier for the animation clip.
  • sheetPath Path to the texture atlas asset.
  • frames Array of explicit frame rectangles and pivots.
  • duration Display time per frame in seconds.
  • isLooping Whether the animation loops continuously.


The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Components/Animation.hpp