1#ifndef YAZE_APP_GFX_TILESHEET_H
2#define YAZE_APP_GFX_TILESHEET_H
42 void ComposeTile16(
const std::vector<uint8_t>& graphics_buffer,
45 int sheet_offset = 0);
46 void ModifyTile16(
const std::vector<uint8_t>& graphics_buffer,
49 int sheet_offset = 0);
57 int tile_data_offset = 0;
59 tileData, tile_data_offset);
60 return Bitmap(bmp_width, bmp_height,
bitmap_->depth(), tileData);
64 std::cout <<
"GetTile16: " << tile_id << std::endl;
66 int tile_x = (tile_id % tiles_per_row) *
tile_width_;
68 std::cout <<
"Tile X: " << tile_x <<
" Tile Y: " << tile_y << std::endl;
71 int tile_data_offset = 0;
72 bitmap_->Get16x16Tile(tile_x, tile_y, tile_data, tile_data_offset);
78 void CopyTile(
int srcX,
int srcY,
int destX,
int destY,
bool mirror_x =
false,
79 bool mirror_y =
false) {
81 auto dest_tile_data = src_tile.vector();
110 const std::vector<uint8_t>& graphics_buffer,
int tile_id);
114 void MirrorTileData(std::vector<uint8_t>& tileData,
bool mirror_x,
117 void WriteTile(
int x,
int y,
const std::vector<uint8_t>& tileData) {
118 int tileDataOffset = 0;
120 const_cast<std::vector<uint8_t>&
>(tileData),
137 const uint8_t* graphics_buffer,
int width,
int height,
TileType tile_type,
Represents a bitmap image.
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Tile composition of four 8x8 tiles.
SNES 16-bit tile metadata container.
Represents a tilesheet, which is a collection of tiles stored in a bitmap.
auto set_palette(gfx::SnesPalette &palette)
std::vector< InternalTile16 > tile_info_
std::vector< uint8_t > FetchTileDataFromGraphicsBuffer(const std::vector< uint8_t > &graphics_buffer, int tile_id)
void ComposeAndPlaceTilePart(const std::vector< uint8_t > &graphics_buffer, const TileInfo &tile_info, int baseX, int baseY)
Tilesheet(std::shared_ptr< Bitmap > bitmap, int tileWidth, int tileHeight, TileType tile_type)
void WriteTile(int x, int y, const std::vector< uint8_t > &tileData)
void MirrorTileDataHorizontally(std::vector< uint8_t > &tileData)
void Init(int width, int height, TileType tile_type)
Bitmap GetTile16(int tile_id)
void MirrorTileDataVertically(std::vector< uint8_t > &tileData)
void MirrorTileData(std::vector< uint8_t > &tileData, bool mirror_x, bool mirror_y)
void CopyTile(int srcX, int srcY, int destX, int destY, bool mirror_x=false, bool mirror_y=false)
void ModifyTile16(const std::vector< uint8_t > &graphics_buffer, const TileInfo &top_left, const TileInfo &top_right, const TileInfo &bottom_left, const TileInfo &bottom_right, int tile_id, int sheet_offset=0)
Bitmap GetTile(int tileX, int tileY, int bmp_width, int bmp_height)
int CalculateTileIndex(int x, int y)
std::vector< uint8_t > internal_data_
std::shared_ptr< Bitmap > bitmap_
void ComposeTile16(const std::vector< uint8_t > &graphics_buffer, const TileInfo &top_left, const TileInfo &top_right, const TileInfo &bottom_left, const TileInfo &bottom_right, int sheet_offset=0)
absl::StatusOr< Tilesheet > CreateTilesheetFromGraphicsBuffer(const uint8_t *graphics_buffer, int width, int height, TileType tile_type, int sheet_id)
std::array< TileInfo, 4 > tiles