|
Porytiles
|
Wraps a ColorSet with a tile ID for tracking during palette packing. More...
#include <packable_tile.hpp>
Classes | |
| struct | AnimId |
| Identifies a tile created from an animation. More... | |
| struct | HintId |
| Identifies a tile created from a palette hint. More... | |
| class | PrefilledPaletteId |
| Identifies a tile created from a prefilled palette. More... | |
| struct | PrimaryTileId |
| Identifies a tile reconstructed from a compiled primary tileset. More... | |
| struct | RegularId |
| Identifies a regular input tile. More... | |
Public Types | |
| using | Id = std::variant< HintId, PrefilledPaletteId, RegularId, AnimId, PrimaryTileId > |
| Variant type for tile identification. | |
Public Member Functions | |
| PackableTile (HintId id, ColorSet color_set) | |
| Constructs a PackableTile from a palette hint. | |
| PackableTile (PrefilledPaletteId id, ColorSet color_set) | |
| Constructs a PackableTile from a prefilled palette. | |
| PackableTile (RegularId id, ColorSet color_set) | |
| Constructs a PackableTile from a regular input tile. | |
| PackableTile (AnimId id, ColorSet color_set) | |
| Constructs a PackableTile from an animation. | |
| PackableTile (PrimaryTileId id, ColorSet color_set) | |
| Constructs a PackableTile from a reconstructed primary tile. | |
| PackableTile (Id id, ColorSet color_set) | |
| Constructs a PackableTile from an Id variant. | |
| const Id & | id () const |
| const std::string & | hint_name () const |
| std::size_t | prefilled_index () const |
| std::size_t | regular_index () const |
| bool | is_hint () const |
| bool | is_prefilled_palette () const |
| bool | is_regular () const |
| const ColorSet & | color_set () const |
| std::size_t | color_count () const |
| auto | operator<=> (const PackableTile &other) const |
| Three-way comparison operator. | |
| bool | operator== (const PackableTile &other) const |
| Equality comparison operator. | |
Wraps a ColorSet with a tile ID for tracking during palette packing.
PackableTile represents a tile that needs to be assigned to a hardware palette. It associates a unique tile ID with the set of colors present in that tile, enabling the palette packer to track which tiles have been assigned to which palettes.
Several types of tiles are supported:
PackableTiles are sortable with the following order:
Definition at line 35 of file packable_tile.hpp.
| using porytiles::PackableTile::Id = std::variant<HintId, PrefilledPaletteId, RegularId, AnimId, PrimaryTileId> |
Variant type for tile identification.
The order of alternatives determines sorting: HintId < PrefilledPaletteId < RegularId < AnimId < PrimaryTileId.
Definition at line 115 of file packable_tile.hpp.
Constructs a PackableTile from a palette hint.
| id | The hint identifier |
| color_set | The set of colors present in this tile |
Definition at line 10 of file packable_tile.cpp.
| porytiles::PackableTile::PackableTile | ( | PrefilledPaletteId | id, |
| ColorSet | color_set | ||
| ) |
Constructs a PackableTile from a prefilled palette.
| id | The prefilled palette identifier |
| color_set | The set of colors present in this tile |
Definition at line 12 of file packable_tile.cpp.
Constructs a PackableTile from a regular input tile.
| id | The regular tile identifier |
| color_set | The set of colors present in this tile |
Definition at line 14 of file packable_tile.cpp.
Constructs a PackableTile from an animation.
| id | The anim identifier |
| color_set | The set of colors present in this tile |
Definition at line 16 of file packable_tile.cpp.
| porytiles::PackableTile::PackableTile | ( | PrimaryTileId | id, |
| ColorSet | color_set | ||
| ) |
Constructs a PackableTile from a reconstructed primary tile.
| id | The primary tile identifier |
| color_set | The set of colors present in this tile |
Definition at line 18 of file packable_tile.cpp.
Constructs a PackableTile from an Id variant.
This constructor allows direct construction from a type-erased Id variant, useful when the specific ID type is not known at compile time (e.g., when reconstructing tiles from stored IDs).
| id | The tile identifier variant |
| color_set | The set of colors present in this tile |
Definition at line 20 of file packable_tile.cpp.
| std::size_t porytiles::PackableTile::color_count | ( | ) | const |
Definition at line 37 of file packable_tile.cpp.
|
inline |
Definition at line 198 of file packable_tile.hpp.
| const std::string & porytiles::PackableTile::hint_name | ( | ) | const |
Definition at line 22 of file packable_tile.cpp.
|
inline |
Definition at line 169 of file packable_tile.hpp.
|
inline |
Definition at line 183 of file packable_tile.hpp.
|
inline |
Definition at line 188 of file packable_tile.hpp.
|
inline |
Definition at line 193 of file packable_tile.hpp.
|
inline |
Three-way comparison operator.
Compares tiles by their Id only. The variant ordering ensures hint tiles come first, then prefilled palette tiles, then regular tiles.
| other | The tile to compare against |
Definition at line 215 of file packable_tile.hpp.
|
inline |
Equality comparison operator.
| other | The tile to compare against |
Definition at line 226 of file packable_tile.hpp.
| std::size_t porytiles::PackableTile::prefilled_index | ( | ) | const |
Definition at line 27 of file packable_tile.cpp.
| std::size_t porytiles::PackableTile::regular_index | ( | ) | const |
Definition at line 32 of file packable_tile.cpp.