1#ifndef YAZE_APP_GFX_SNES_TILE_H
2#define YAZE_APP_GFX_SNES_TILE_H
21 0x08, 0x04, 0x02, 0x01};
23std::vector<uint8_t>
SnesTo8bppSheet(
const std::vector<uint8_t>& sheet,
int bpp,
29 const uint32_t offset,
const uint32_t bpp);
33std::vector<uint8_t>
ConvertBpp(
const std::vector<uint8_t>& tiles,
34 uint32_t from_bpp, uint32_t to_bpp);
39void CopyTile8bpp16(
int x,
int y,
int tile, std::vector<uint8_t>& bitmap,
40 std::vector<uint8_t>& blockset);
58 TileInfo(uint16_t
id, uint8_t palette,
bool v,
bool h,
bool o)
92 Tile32(uint16_t t0, uint16_t t1, uint16_t t2, uint16_t t3)
104 tile0_ = (uint16_t)packedVal;
105 tile1_ = (uint16_t)(packedVal >> 16);
106 tile2_ = (uint16_t)(packedVal >> 32);
107 tile3_ = (uint16_t)(packedVal >> 48);
112 return static_cast<uint64_t
>(
tile3_) << 48 |
113 (
static_cast<uint64_t
>(
tile2_) << 32) |
167 OamTile(
int x,
int y, uint16_t tile,
int pal,
bool upper =
false,
int mx = 0,
171 tile_ = (uint16_t)(tile + 512);
173 tile_ = (uint16_t)(tile + 256 + 512);
187 const std::vector<uint8_t>&
data()
const {
return data_; }
201 if (index >=
data_.size()) {
202 throw std::out_of_range(
"Index out of range");
208 if (index >=
data_.size()) {
209 throw std::out_of_range(
"Index out of range");
std::vector< uint8_t > data_
uint8_t & operator[](size_t index)
GraphicsBuffer(uint8_t bpp, const std::vector< uint8_t > &data)
GraphicsBuffer(uint8_t bpp, std::vector< uint8_t > &&data)
void set_data(const std::vector< uint8_t > &data)
const uint8_t & operator[](size_t index) const
void set_bpp(uint8_t bpp)
const std::vector< uint8_t > & data() const
Object Attribute Memory tile abstraction container.
OamTile(int x, int y, uint16_t tile, int pal, bool upper=false, int mx=0, int my=0)
Tile composition of four 8x8 tiles.
bool operator==(const Tile16 &other) const
std::array< TileInfo, 4 > tiles_info
bool operator!=(const Tile16 &other) const
Tile16(TileInfo t0, TileInfo t1, TileInfo t2, TileInfo t3)
Tile composition of four 16x16 tiles.
Tile32(const Tile32 &other)
bool operator!=(const Tile32 &other) const
Tile32(uint16_t t0, uint16_t t1, uint16_t t2, uint16_t t3)
uint64_t GetPackedValue() const
bool operator==(const Tile32 &other) const
Tile32(uint64_t packedVal)
SNES 16-bit tile metadata container.
TileInfo(uint16_t id, uint8_t palette, bool v, bool h, bool o)
bool operator==(const TileInfo &other) const
std::vector< uint8_t > PackBppTile(const snes_tile8 &tile, const uint32_t bpp)
std::vector< uint8_t > Convert4bppTo3bpp(const std::vector< uint8_t > &tiles)
TileInfo WordToTileInfo(uint16_t word)
constexpr int kTilesheetDepth
std::vector< uint8_t > SnesTo8bppSheet(const std::vector< uint8_t > &sheet, int bpp, int num_sheets)
std::vector< uint8_t > Bpp8SnesToIndexed(std::vector< uint8_t > data, uint64_t bpp)
constexpr int kTilesheetWidth
uint16_t TileInfoToShort(TileInfo tile_info)
constexpr uint8_t kGraphicsBitmap[8]
std::vector< uint8_t > ConvertBpp(const std::vector< uint8_t > &tiles, uint32_t from_bpp, uint32_t to_bpp)
std::vector< uint8_t > Convert3bppTo4bpp(const std::vector< uint8_t > &tiles)
constexpr int kTilesheetHeight
uint16_t TileInfoToWord(TileInfo tile_info)
snes_tile8 UnpackBppTile(const std::vector< uint8_t > &data, const uint32_t offset, const uint32_t bpp)
void CopyTile8bpp16(int x, int y, int tile, std::vector< uint8_t > &bitmap, std::vector< uint8_t > &blockset)
TileInfo GetTilesInfo(uint16_t tile)