17#ifndef _FGE_C_TILELAYER_HPP_INCLUDED
18#define _FGE_C_TILELAYER_HPP_INCLUDED
20#include "FastEngine/fge_extern.hpp"
21#include "FastEngine/C_matrix.hpp"
22#include "FastEngine/C_tileset.hpp"
23#include "FastEngine/graphic/C_color.hpp"
24#include "FastEngine/graphic/C_drawable.hpp"
25#include "FastEngine/graphic/C_transformable.hpp"
26#include "FastEngine/vulkan/C_vertexBuffer.hpp"
32using TileId = int32_t;
33using TileSetList = std::vector<std::shared_ptr<fge::TileSet>>;
113 [[nodiscard]] std::shared_ptr<fge::TileSet>
const&
getTileSet()
const;
116 void updatePositions();
117 void updateTexCoords();
120 std::shared_ptr<fge::TileSet> g_tileSet;
122 fge::Vector2f g_position;
129#ifndef FGE_DEF_SERVER
162 [[nodiscard]] std::string
const&
getName()
const;
178 void setGid(std::size_t x, std::size_t y, TileSetList
const& tileSets, TileId gid);
186 void setGid(std::size_t x, std::size_t y, TileId gid);
203 static std::shared_ptr<fge::TileSet> retrieveAssociatedTileSet(TileSetList
const& tileSets, TileId gid);
211FGE_API
void from_json(nlohmann::json
const& j,
fge::TileLayer& p);
Definition C_color.hpp:35
Definition C_drawable.hpp:36
A container to store a 2D matrix of any type.
Definition C_matrix.hpp:40
The RenderStates class contains all the information needed to render something.
Definition C_renderStates.hpp:412
Definition C_renderTarget.hpp:56
A tile that contain drawing information and its global id.
Definition C_tilelayer.hpp:55
void setTileSet(std::shared_ptr< fge::TileSet > tileSet)
Set the associated tileset pointer.
void setColor(fge::Color const &color)
Set the color of the tile.
fge::Vector2f const & getPosition() const
Get the local position of the tile.
std::shared_ptr< fge::TileSet > const & getTileSet() const
Get the associated tileset pointer.
void setGid(TileId gid)
Set the global id of the tile.
TileId getGid() const
Get the global id of the tile.
fge::Color getColor() const
Get the color of the tile.
void setPosition(fge::Vector2f const &position)
Set the local position of the tile.
A tile layer contain a matrix of global tile id and a list of TileSet.
Definition C_tilelayer.hpp:47
fge::Matrix< TileLayer::Tile > const & getTiles() const
Get the matrix of tiles.
TileId getId() const
Get the id of the layer.
void clear()
Clear the matrix of tiles.
void setGid(std::size_t x, std::size_t y, TileId gid)
Shortcut to set a global tile id.
void setId(TileId id)
Set the id of the layer (mostly for "Tiled" map editor compatibility)
std::string const & getName() const
Get the name of the layer.
void setName(std::string name)
Set the name of the layer.
void setGid(std::size_t x, std::size_t y, TileSetList const &tileSets, TileId gid)
Shortcut to set a global tile id and a new tileset.
void refreshTextures(TileSetList const &tileSets)
Refresh all tiles with a list of tilesets.
void setGridSize(std::size_t x, std::size_t y)
Set the tiles matrix size.
Definition C_vertexBuffer.hpp:45