12 #include <unordered_map> 14 #include <SFML/Graphics/RenderTexture.hpp> 15 #include <SFML/Graphics/Sprite.hpp> 16 #include <SFML/Graphics/VertexArray.hpp> 17 #include <SFML/System/Clock.hpp> 18 #include <SFML/System/Vector2.hpp> 20 #include <NasNas/core/graphics/Renderable.hpp> 21 #include <NasNas/tilemapping/Layer.hpp> 22 #include <NasNas/tilemapping/Tile.hpp> 23 #include <NasNas/tilemapping/Tileset.hpp> 30 struct AnimatedTileInfo {
33 std::vector<sf::Vector2u> positions;
39 auto getTile(
int x,
int y)
const ->
const std::optional<Tile>&;
40 auto getTile(sf::Vector2i pos)
const ->
const std::optional<Tile>&;
41 void setTile(
int x,
int y, std::uint32_t gid);
49 std::vector<std::optional<Tile>> m_tiles;
50 std::map<std::uint32_t, AnimatedTileInfo> m_animated_tiles_pos;
51 std::unordered_map<const Tileset*, sf::VertexArray> m_vertices;
52 sf::RenderTexture m_render_texture;
55 void addTile(
int tile_index, std::uint32_t gid);
56 void updateTileTexCoo(
const Tileset& tileset,
unsigned tile_index,
const std::vector<sf::Vector2f>& tex_coo);
58 void render()
override;
59 void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;