le2d v0.4.3
2D game engine framework
 
Loading...
Searching...
No Matches
tile_set.hpp
Go to the documentation of this file.
1#pragma once
3#include <le2d/tile/tile.hpp>
4#include <span>
5#include <vector>
6
7namespace le {
9class TileSet : public IAsset {
10 public:
11 [[nodiscard]] auto get_tiles() const -> std::span<Tile const> { return m_sorted_tiles; }
13 void set_tiles(std::vector<Tile> tiles);
14
18 [[nodiscard]] auto get_uv(TileId id) const -> kvf::UvRect;
19
20 [[nodiscard]] auto is_loaded() const -> bool { return !m_sorted_tiles.empty(); }
21
22 private:
23 std::vector<Tile> m_sorted_tiles{};
24};
25} // namespace le
Interface for asset types.
Definition asset.hpp:8
Sorted set of Tiles.
Definition tile_set.hpp:9
void set_tiles(std::vector< Tile > tiles)
auto get_tiles() const -> std::span< Tile const >
Definition tile_set.hpp:11
auto is_loaded() const -> bool
Definition tile_set.hpp:20
auto get_uv(TileId id) const -> kvf::UvRect
Get the UV coordinates for a given Tile ID.
Definition animation.hpp:8
TileId
Unique identifier for a Tile.
Definition tile_id.hpp:6
Tile in a sprite sheet.
Definition tile.hpp:7