16 std::array<P, kTileSize> pix_;
19 [[nodiscard]]
const std::array<P, kTileSize> &
pix()
const {
26 explicit Tile() : pix_{} {}
29 return std::ranges::all_of(
pix(), [=](
const auto &pixel) {
return pixel == transparency; });
32 [[nodiscard]] P
At(std::size_t i)
const {
34 Panic(fmt::format(
"Index {} out of bounds", i));
39 [[nodiscard]] P
At(std::size_t row, std::size_t col)
const {
41 Panic(fmt::format(
"Row index {} out of bounds", row));
44 Panic(fmt::format(
"Col index {} out of bounds", col));
49 void Set(std::size_t i,
const P &p) {
51 Panic(fmt::format(
"Index {} out of bounds", i));
56 void Set(std::size_t row, std::size_t col,
const P &p) {
58 Panic(fmt::format(
"Row index {} out of bounds", row));
61 Panic(fmt::format(
"Col index {} out of bounds", col));
A single 8x8 pixel tile with an arbitrary pixel data type.
const std::array< P, kTileSize > & pix() const
void Set(std::size_t row, std::size_t col, const P &p)
P At(std::size_t i) const
virtual bool IsTransparent(const P &transparency) const
P At(std::size_t row, std::size_t col) const
void Set(std::size_t i, const P &p)
void Panic(const StringViewSourceLoc &s) noexcept
constexpr std::size_t kTileSideLength
constexpr std::size_t kTileSize