Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
Loading...
Searching...
No Matches
Frame Struct Reference

#include <definitions.hpp>

Public Member Functions

 Frame ()=default
 
 Frame (const Rect _rect, const Vector2 _origin={0.5, 0.5f}, const Color _modulate=Color::WHITE)
 
template<class Archive >
void save (Archive &ar) const
 
template<class Archive >
void load (Archive &ar)
 

Public Attributes

Rect rect
 
Vector2 origin = {0.5f, 0.5f}
 
Color modulate = Color::WHITE
 

Detailed Description

Frame

An animation frame. It determines the source rectangle of the sprite, the origin of the rendered sprite and the modulate color of the rendered sprite.

Example usage:

// This will create a frame a sourceRect which has the position of 0, 0 in the texture atlas and the size of 16x16 pixels.
// It has an origin of {0.5f, 0.5f} and a modulate color of blue.
Frame(Rect{Vector2{0.0f, 0.0f}, Vector2{16.0f, 16.0f}}, {0.5f, 0.5f}, Color::BLUE);
static const Color BLUE
Definition definitions.hpp:62
Frame()=default
Definition definitions.hpp:294
Definition definitions.hpp:77

Constructor & Destructor Documentation

◆ Frame() [1/2]

Frame::Frame ( )
default

◆ Frame() [2/2]

Frame::Frame ( const Rect  _rect,
const Vector2  _origin = {0.5, 0.5f},
const Color  _modulate = Color::WHITE 
)
inline

Member Function Documentation

◆ load()

template<class Archive >
void Frame::load ( Archive &  ar)
inline

◆ save()

template<class Archive >
void Frame::save ( Archive &  ar) const
inline

Member Data Documentation

◆ modulate

Color Frame::modulate = Color::WHITE

◆ origin

Vector2 Frame::origin = {0.5f, 0.5f}

◆ rect

Rect Frame::rect

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