Template Function tcod::load_tilesheet

Function Documentation

template<typename ArrayType>
inline auto tcod::load_tilesheet(const std::filesystem::path &path, const std::array<int, 2> &columns_rows, const ArrayType &charmap) -> Tileset

Load a tilesheet from a PNG file.

An exception will be thrown if the file is missing or corrupt.

Tiles are indexed in row-major order and should be assigned to Unicode codepoints.

New in version 1.19.

Template Parameters

ArrayType – Must be a std::vector or std::array like type. With size() and data() methods.

Parameters
  • path – The file path to the PNG tilesheet image.

  • columns_rows – The shape of the grid on the tileset as {columns, rows}.

  • charmap – An array of characters where charmap[tile_index] = codepoint. tcod::CHARMAP_CP437 or tcod::CHARMAP_TCOD are typical values for this argument.

Returns

TilesetPtr A unique pointer to a TCOD_Tileset.