Porytiles
Loading...
Searching...
No Matches
porytiles::AnimFrame< PixelType > Class Template Reference

Represents a single frame of an animation, containing tiles and a frame name. More...

#include <anim_frame.hpp>

Public Member Functions

 AnimFrame ()=default
 
 AnimFrame (std::string frame_name)
 
 AnimFrame (std::string frame_name, std::vector< PixelTile< PixelType > > tiles)
 
const std::string & frame_name () const
 
void frame_name (std::string name)
 
const std::vector< PixelTile< PixelType > > & tiles () const
 
void tiles (std::vector< PixelTile< PixelType > > t)
 
void add_tile (PixelTile< PixelType > tile)
 
std::size_t tile_count () const
 
const PixelTile< PixelType > & tile_at (std::size_t index) const
 
bool has_palette () const
 
const Palette< Rgba32 > & palette () const
 
void palette (Palette< Rgba32 > pal)
 

Detailed Description

template<SupportsTransparency PixelType>
class porytiles::AnimFrame< PixelType >

Represents a single frame of an animation, containing tiles and a frame name.

AnimFrame holds the pixel data for one frame of an animation. Each frame consists of one or more 8x8 tiles arranged in a grid. The frame name typically corresponds to the PNG filename (e.g., "0", "1", "2" for 0.png, 1.png, 2.png).

The template parameter PixelType determines whether the frame uses RGBA pixels (for Porytiles component, source format) or indexed pixels (for Porymap component, compiled format).

Key concepts:

  • A special "key frame" that appears in tiles.png, but isn't part of the animation loop
    • Users tell Porytiles which metatile subtiles should be animated by using key frame tiles on the layer PNGs
  • Other frames (0, 1, 2, ...) are stored as separate .4bpp files and swapped at runtime
  • All frames of an animation must have the same tile count
Template Parameters
PixelTypeThe pixel type for tiles; must satisfy SupportsTransparency concept

Definition at line 34 of file anim_frame.hpp.

Constructor & Destructor Documentation

◆ AnimFrame() [1/3]

template<SupportsTransparency PixelType>
porytiles::AnimFrame< PixelType >::AnimFrame ( )
default

◆ AnimFrame() [2/3]

template<SupportsTransparency PixelType>
porytiles::AnimFrame< PixelType >::AnimFrame ( std::string  frame_name)
inlineexplicit

Definition at line 38 of file anim_frame.hpp.

◆ AnimFrame() [3/3]

template<SupportsTransparency PixelType>
porytiles::AnimFrame< PixelType >::AnimFrame ( std::string  frame_name,
std::vector< PixelTile< PixelType > >  tiles 
)
inline

Definition at line 40 of file anim_frame.hpp.

Member Function Documentation

◆ add_tile()

template<SupportsTransparency PixelType>
void porytiles::AnimFrame< PixelType >::add_tile ( PixelTile< PixelType >  tile)
inline

Definition at line 65 of file anim_frame.hpp.

◆ frame_name() [1/2]

template<SupportsTransparency PixelType>
const std::string & porytiles::AnimFrame< PixelType >::frame_name ( ) const
inline

Definition at line 45 of file anim_frame.hpp.

◆ frame_name() [2/2]

template<SupportsTransparency PixelType>
void porytiles::AnimFrame< PixelType >::frame_name ( std::string  name)
inline

Definition at line 50 of file anim_frame.hpp.

◆ has_palette()

template<SupportsTransparency PixelType>
bool porytiles::AnimFrame< PixelType >::has_palette ( ) const
inline

Definition at line 81 of file anim_frame.hpp.

◆ palette() [1/2]

template<SupportsTransparency PixelType>
const Palette< Rgba32 > & porytiles::AnimFrame< PixelType >::palette ( ) const
inline

Definition at line 86 of file anim_frame.hpp.

◆ palette() [2/2]

template<SupportsTransparency PixelType>
void porytiles::AnimFrame< PixelType >::palette ( Palette< Rgba32 pal)
inline

Definition at line 91 of file anim_frame.hpp.

◆ tile_at()

template<SupportsTransparency PixelType>
const PixelTile< PixelType > & porytiles::AnimFrame< PixelType >::tile_at ( std::size_t  index) const
inline

Definition at line 76 of file anim_frame.hpp.

◆ tile_count()

template<SupportsTransparency PixelType>
std::size_t porytiles::AnimFrame< PixelType >::tile_count ( ) const
inline

Definition at line 70 of file anim_frame.hpp.

◆ tiles() [1/2]

template<SupportsTransparency PixelType>
const std::vector< PixelTile< PixelType > > & porytiles::AnimFrame< PixelType >::tiles ( ) const
inline

Definition at line 55 of file anim_frame.hpp.

◆ tiles() [2/2]

template<SupportsTransparency PixelType>
void porytiles::AnimFrame< PixelType >::tiles ( std::vector< PixelTile< PixelType > >  t)
inline

Definition at line 60 of file anim_frame.hpp.


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