Represents a tilesheet, which is a collection of tiles stored in a bitmap. More...
#include <tilesheet.h>
Classes | |
struct | InternalTile16 |
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) |
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_x, int tile_y) |
Bitmap | GetTile16 (int tile_id) |
void | CopyTile (int srcX, int srcY, int destX, int destY, bool mirrorX=false, bool mirrorY=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 () |
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 mirrorX, bool mirrorY) |
void | WriteTile (int x, int y, const std::vector< uint8_t > &tileData) |
Private Attributes | |
gfx::SnesPalette | palette_ |
std::vector< uint8_t > | internal_data_ |
std::shared_ptr< Bitmap > | bitmap_ |
std::vector< InternalTile16 > | tile_info_ |
int | num_tiles_ = 0 |
int | tile_width_ = 0 |
int | tile_height_ = 0 |
TileType | tile_type_ |
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 26 of file tilesheet.h.
|
default |
|
inline |
Definition at line 29 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 ) |
Definition at line 62 of file tilesheet.cc.
References bitmap_, ComposeAndPlaceTilePart(), num_tiles_, tile_height_, tile_info_, and tile_width_.
Referenced by yaze::app::editor::ScreenEditor::LoadDungeonMapTile16().
void yaze::app::gfx::Tilesheet::ComposeAndPlaceTilePart | ( | const std::vector< uint8_t > & | graphics_buffer, |
const TileInfo & | tile_info, | ||
int | baseX, | ||
int | baseY ) |
Definition at line 85 of file tilesheet.cc.
References bitmap_, FetchTileDataFromGraphicsBuffer(), internal_data_, MirrorTileDataHorizontally(), MirrorTileDataVertically(), and tile_info().
Referenced by ComposeTile16().
|
inline |
Definition at line 46 of file tilesheet.h.
References bitmap_, CalculateTileIndex(), tile_height_, and tile_width_.
Referenced by CopyTile().
|
inline |
Definition at line 54 of file tilesheet.h.
References bitmap_, tile_height_, and tile_width_.
Referenced by yaze::app::editor::ScreenEditor::DrawDungeonMapsTabs(), GetTile16(), and yaze::app::editor::ScreenEditor::LoadDungeonMapTile16().
|
inline |
Definition at line 61 of file tilesheet.h.
References bitmap_, GetTile16(), tile_height_, tile_width_, and yaze::app::gfx::Bitmap::width().
|
inline |
Definition at line 69 of file tilesheet.h.
References GetTile(), MirrorTileData(), tile_height_, tile_width_, and WriteTile().
|
inline |
Definition at line 78 of file tilesheet.h.
References bitmap_.
Referenced by yaze::app::editor::ScreenEditor::DrawDungeonMapsEditor().
|
inline |
Definition at line 79 of file tilesheet.h.
References bitmap_.
Referenced by yaze::app::gfx::CreateTilesheetFromGraphicsBuffer(), and yaze::app::editor::ScreenEditor::LoadDungeonMapTile16().
|
inline |
Definition at line 80 of file tilesheet.h.
References num_tiles_.
Referenced by yaze::app::editor::ScreenEditor::LoadDungeonMapTile16().
|
inline |
Definition at line 81 of file tilesheet.h.
References tile_width_.
|
inline |
Definition at line 82 of file tilesheet.h.
References tile_height_.
|
inline |
Definition at line 83 of file tilesheet.h.
References palette(), and palette_.
|
inline |
|
inline |
|
inline |
Definition at line 86 of file tilesheet.h.
References tile_info_.
Referenced by ComposeAndPlaceTilePart().
|
inline |
Definition at line 87 of file tilesheet.h.
References tile_info_.
|
inlineprivate |
Definition at line 90 of file tilesheet.h.
References bitmap_, and tile_width_.
Referenced by GetTile(), and WriteTile().
|
inlineprivate |
Definition at line 94 of file tilesheet.h.
Referenced by ComposeAndPlaceTilePart().
|
inlineprivate |
Definition at line 133 of file tilesheet.h.
Referenced by ComposeAndPlaceTilePart(), and MirrorTileData().
|
inlineprivate |
Definition at line 145 of file tilesheet.h.
Referenced by ComposeAndPlaceTilePart(), and MirrorTileData().
|
inlineprivate |
Definition at line 157 of file tilesheet.h.
References MirrorTileDataHorizontally(), and MirrorTileDataVertically().
Referenced by CopyTile().
|
inlineprivate |
Definition at line 170 of file tilesheet.h.
References bitmap_, and CalculateTileIndex().
Referenced by CopyTile().
|
private |
Definition at line 177 of file tilesheet.h.
Referenced by palette(), and set_palette().
|
private |
Definition at line 178 of file tilesheet.h.
Referenced by ComposeAndPlaceTilePart(), and Init().
|
private |
Definition at line 179 of file tilesheet.h.
Referenced by bitmap(), CalculateTileIndex(), ComposeAndPlaceTilePart(), ComposeTile16(), GetTile(), GetTile16(), GetTile16(), Init(), mutable_bitmap(), and WriteTile().
|
private |
Definition at line 183 of file tilesheet.h.
Referenced by ComposeTile16(), mutable_tile_info(), and tile_info().
|
private |
Definition at line 184 of file tilesheet.h.
Referenced by ComposeTile16(), and num_tiles().
|
private |
Definition at line 185 of file tilesheet.h.
Referenced by CalculateTileIndex(), ComposeTile16(), CopyTile(), GetTile(), GetTile16(), GetTile16(), Init(), and tile_width().
|
private |
Definition at line 186 of file tilesheet.h.
Referenced by ComposeTile16(), CopyTile(), GetTile(), GetTile16(), GetTile16(), Init(), and tile_height().
|
private |
Definition at line 187 of file tilesheet.h.
Referenced by Init(), and tile_type().