16 const uint8_t* graphics_buffer,
int width,
int height,
TileType tile_type,
21 int sheet_offset = sheet_id * width * height;
24 tilesheet.
Init(width, height, tile_type);
27 for (
int row = 0; row < height; ++row) {
28 for (
int col = 0; col < width; ++col) {
30 int tile_index = sheet_offset + (row * width + col) * 64;
33 for (
int y = 0; y < 8; ++y) {
34 for (
int x = 0; x < 8; ++x) {
35 int srcIndex = tile_index + (y * 8 + x);
36 int destX = col * 8 + x;
37 int destY = row * 8 + y;
38 int destIndex = (destY * width * 8) + destX;
40 graphics_buffer[srcIndex];
50 bitmap_ = std::make_shared<Bitmap>(width, height, 8, 0x20000);
70 int tile16_column =
num_tiles_ % tiles_per_row;
80 tile_info_.push_back({top_left, top_right, bottom_left, bottom_right});
86 const std::vector<uint8_t>& graphics_buffer,
const TileInfo& tile_info,
87 int baseX,
int baseY) {
88 std::vector<uint8_t> tile_data =
99 for (
int y = 0; y < 8; ++y) {
100 for (
int x = 0; x < 8; ++x) {
101 int srcIndex = y * 8 + x;
102 int destX = baseX + x;
103 int destY = baseY + y;
104 int destIndex = (destY *
bitmap_->width()) + destX;
SNES 16-bit tile metadata container.
Represents a tilesheet, which is a collection of tiles stored in a bitmap.
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)
void MirrorTileDataHorizontally(std::vector< uint8_t > &tileData)
void Init(int width, int height, TileType tile_type)
void MirrorTileDataVertically(std::vector< uint8_t > &tileData)
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)
std::vector< uint8_t > internal_data_
std::shared_ptr< Bitmap > bitmap_
absl::StatusOr< Tilesheet > CreateTilesheetFromGraphicsBuffer(const uint8_t *graphics_buffer, int width, int height, TileType tile_type, int sheet_id)