Represents a tilesheet, which is a collection of tiles stored in a bitmap. More...
#include <tilesheet.h>
Public Member Functions | |
Tilesheet ()=default | |
Tilesheet (std::shared_ptr< Bitmap > bitmap, int tileWidth, int tileHeight, TileType tile_type) | |
void | Init (int width, int height, TileType tile_type) |
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) |
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) |
void | ComposeAndPlaceTilePart (const std::vector< uint8_t > &graphics_buffer, const TileInfo &tile_info, int baseX, int baseY) |
Bitmap | GetTile (int tileX, int tileY, int bmp_width, int bmp_height) |
Bitmap | GetTile16 (int tile_id) |
void | CopyTile (int srcX, int srcY, int destX, int destY, bool mirror_x=false, bool mirror_y=false) |
auto | bitmap () const |
auto | mutable_bitmap () |
auto | num_tiles () const |
auto | tile_width () const |
auto | tile_height () const |
auto | set_palette (gfx::SnesPalette &palette) |
auto | palette () const |
auto | tile_type () const |
auto | tile_info () const |
auto | mutable_tile_info () |
void | clear () |
Private Member Functions | |
int | CalculateTileIndex (int x, int y) |
std::vector< uint8_t > | FetchTileDataFromGraphicsBuffer (const std::vector< uint8_t > &graphics_buffer, int tile_id) |
void | MirrorTileDataVertically (std::vector< uint8_t > &tileData) |
void | MirrorTileDataHorizontally (std::vector< uint8_t > &tileData) |
void | MirrorTileData (std::vector< uint8_t > &tileData, bool mirror_x, bool mirror_y) |
void | WriteTile (int x, int y, const std::vector< uint8_t > &tileData) |
Private Attributes | |
int | num_tiles_ = 0 |
int | tile_width_ = 0 |
int | tile_height_ = 0 |
int | sheet_offset_ = 0 |
TileType | tile_type_ |
SnesPalette | palette_ |
std::vector< uint8_t > | internal_data_ |
std::vector< InternalTile16 > | tile_info_ |
std::shared_ptr< Bitmap > | bitmap_ |
Represents a tilesheet, which is a collection of tiles stored in a bitmap.
The Tilesheet class provides methods to manipulate and extract tiles from the tilesheet. It also supports copying and mirroring tiles within the tilesheet.
Definition at line 30 of file tilesheet.h.
|
default |
|
inline |
Definition at line 33 of file tilesheet.h.
void yaze::app::gfx::Tilesheet::Init | ( | int | width, |
int | height, | ||
TileType | tile_type ) |
Definition at line 49 of file tilesheet.cc.
References bitmap_, internal_data_, yaze::app::gfx::Tile8, tile_height_, tile_type(), tile_type_, and tile_width_.
Referenced by yaze::app::gfx::CreateTilesheetFromGraphicsBuffer(), and yaze::app::editor::ScreenEditor::LoadDungeonMapTile16().
void yaze::app::gfx::Tilesheet::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 ) |
Definition at line 62 of file tilesheet.cc.
References bitmap_, ComposeAndPlaceTilePart(), num_tiles_, sheet_offset_, tile_height_, tile_info_, and tile_width_.
Referenced by yaze::app::editor::ScreenEditor::LoadDungeonMapTile16().
void yaze::app::gfx::Tilesheet::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 ) |
Definition at line 87 of file tilesheet.cc.
References bitmap_, ComposeAndPlaceTilePart(), sheet_offset_, tile_height_, tile_info_, and tile_width_.
Referenced by yaze::app::editor::ScreenEditor::DrawDungeonMapsEditor().
void yaze::app::gfx::Tilesheet::ComposeAndPlaceTilePart | ( | const std::vector< uint8_t > & | graphics_buffer, |
const TileInfo & | tile_info, | ||
int | baseX, | ||
int | baseY ) |
Definition at line 111 of file tilesheet.cc.
References bitmap_, FetchTileDataFromGraphicsBuffer(), internal_data_, MirrorTileDataHorizontally(), MirrorTileDataVertically(), and tile_info().
Referenced by ComposeTile16(), and ModifyTile16().
|
inline |
Definition at line 55 of file tilesheet.h.
References bitmap_, CalculateTileIndex(), tile_height_, and tile_width_.
Referenced by CopyTile().
|
inline |
Definition at line 63 of file tilesheet.h.
References bitmap_, tile_height_, tile_width_, and yaze::app::gfx::Bitmap::width().
Referenced by yaze::app::editor::ScreenEditor::DrawDungeonMapsEditor(), yaze::app::editor::ScreenEditor::DrawDungeonMapsTabs(), and yaze::app::editor::ScreenEditor::LoadDungeonMapTile16().
|
inline |
Definition at line 78 of file tilesheet.h.
References GetTile(), MirrorTileData(), tile_height_, tile_width_, and WriteTile().
|
inline |
Definition at line 86 of file tilesheet.h.
References bitmap_.
Referenced by yaze::app::editor::ScreenEditor::DrawDungeonMapsEditor().
|
inline |
Definition at line 87 of file tilesheet.h.
References bitmap_.
Referenced by yaze::app::gfx::CreateTilesheetFromGraphicsBuffer(), and yaze::app::editor::ScreenEditor::LoadDungeonMapTile16().
|
inline |
Definition at line 88 of file tilesheet.h.
References num_tiles_.
Referenced by yaze::app::editor::ScreenEditor::LoadDungeonMapTile16().
|
inline |
Definition at line 89 of file tilesheet.h.
References tile_width_.
Referenced by FetchTileDataFromGraphicsBuffer().
|
inline |
Definition at line 90 of file tilesheet.h.
References tile_height_.
Referenced by FetchTileDataFromGraphicsBuffer().
|
inline |
Definition at line 91 of file tilesheet.h.
References palette(), and palette_.
|
inline |
|
inline |
|
inline |
Definition at line 94 of file tilesheet.h.
References tile_info_.
Referenced by ComposeAndPlaceTilePart(), yaze::app::editor::ScreenEditor::DrawDungeonMapsEditor(), and yaze::app::editor::ScreenEditor::SaveDungeonMapTile16().
|
inline |
Definition at line 95 of file tilesheet.h.
References tile_info_.
|
inline |
Definition at line 96 of file tilesheet.h.
References bitmap_, yaze::app::gfx::SnesPalette::clear(), internal_data_, num_tiles_, palette_, and tile_info_.
Referenced by yaze::app::editor::ScreenEditor::LoadBinaryGfx().
|
inlineprivate |
Definition at line 105 of file tilesheet.h.
References bitmap_, and tile_width_.
Referenced by GetTile(), and WriteTile().
|
private |
Definition at line 138 of file tilesheet.cc.
References sheet_offset_, tile_height(), and tile_width().
Referenced by ComposeAndPlaceTilePart().
|
private |
Definition at line 176 of file tilesheet.cc.
Referenced by ComposeAndPlaceTilePart(), and MirrorTileData().
|
private |
Definition at line 188 of file tilesheet.cc.
Referenced by ComposeAndPlaceTilePart(), and MirrorTileData().
|
private |
Definition at line 200 of file tilesheet.cc.
References MirrorTileDataHorizontally(), and MirrorTileDataVertically().
Referenced by CopyTile().
|
inlineprivate |
Definition at line 117 of file tilesheet.h.
References bitmap_, and CalculateTileIndex().
Referenced by CopyTile().
|
private |
Definition at line 124 of file tilesheet.h.
Referenced by clear(), ComposeTile16(), and num_tiles().
|
private |
Definition at line 125 of file tilesheet.h.
Referenced by CalculateTileIndex(), ComposeTile16(), CopyTile(), GetTile(), GetTile16(), Init(), ModifyTile16(), and tile_width().
|
private |
Definition at line 126 of file tilesheet.h.
Referenced by ComposeTile16(), CopyTile(), GetTile(), GetTile16(), Init(), ModifyTile16(), and tile_height().
|
private |
Definition at line 127 of file tilesheet.h.
Referenced by ComposeTile16(), FetchTileDataFromGraphicsBuffer(), and ModifyTile16().
|
private |
Definition at line 129 of file tilesheet.h.
Referenced by Init(), and tile_type().
|
private |
Definition at line 130 of file tilesheet.h.
Referenced by clear(), palette(), and set_palette().
|
private |
Definition at line 131 of file tilesheet.h.
Referenced by clear(), ComposeAndPlaceTilePart(), and Init().
|
private |
Definition at line 132 of file tilesheet.h.
Referenced by clear(), ComposeTile16(), ModifyTile16(), mutable_tile_info(), and tile_info().
|
private |
Definition at line 133 of file tilesheet.h.
Referenced by bitmap(), CalculateTileIndex(), clear(), ComposeAndPlaceTilePart(), ComposeTile16(), GetTile(), GetTile16(), Init(), ModifyTile16(), mutable_bitmap(), and WriteTile().