21#ifndef GF_TILE_LAYER_H
22#define GF_TILE_LAYER_H
31#include "GraphicsApi.h"
33#include "Transformable.h"
34#include "VertexArray.h"
35#include "VertexBuffer.h"
38#ifndef DOXYGEN_SHOULD_SKIP_THIS
63 static constexpr int NoTile = -1;
105 return m_tiles.getSize();
239 std::size_t tileset = std::size_t(-1);
250 void fillVertexArray(std::vector<Sheet>& sheets,
RectI rect)
const;
251 void updateGeometry();
252 RectI computeOffsets()
const;
256 std::unique_ptr<Cells> m_properties;
260 std::vector<Sheet> m_sheets;
263 Array2D<Cell> m_tiles;
266#ifndef DOXYGEN_SHOULD_SKIP_THIS
Base class for all render targets (window, texture, ...)
Definition: RenderTarget.h:102
A tile layer.
Definition: TileLayer.h:58
std::size_t createTilesetId()
Create a tileset id.
Tileset & getTileset(std::size_t id)
Get a tileset with a tileset id.
static TileLayer createOrthogonal(Vector2i layerSize, Vector2i tileSize)
Create an orthogonal tile layer.
const Tileset & getTileset(std::size_t id) const
Get a tileset with a tileset id.
Vector2i getMapSize() const
Get the size of the layer.
Definition: TileLayer.h:104
void setAnchor(Anchor anchor)
Set the anchor origin of the entity.
void setTile(Vector2i position, std::size_t tileset, int tile, Flags< Flip > flip=None)
Set a tile.
Flags< Flip > getFlip(Vector2i position) const
Get the flip properties of a tile.
virtual void draw(RenderTarget &target, const RenderStates &states) override
Draw the object to a render target.
void setTilesetSmooth(bool smooth=true)
Enable or disable the smooth filter on the texture of tilesets.
RectF getLocalBounds() const
Get the local bounding rectangle of the layer.
VertexBuffer commitGeometry() const
Create a buffer with the current geometry.
static TileLayer createHexagonal(Vector2i layerSize, Vector2i tileSize, int sideLength, CellAxis axis, CellIndex index)
Create a hexagonal tile layer.
static TileLayer createStaggered(Vector2i layerSize, Vector2i tileSize, CellAxis axis, CellIndex index)
Create a staggered tile layer.
std::size_t getTileTileset(Vector2i position) const
Get the tileset property of a tile.
void clear()
Remove all the tiles.
int getTile(Vector2i position) const
Get a tile.
A tileset.
Definition: Tileset.h:48
A set of primitives.
Definition: VertexArray.h:65
Data in the graphics memory.
Definition: VertexBuffer.h:81
CellAxis
Cell axis for staggered or hexagonal maps.
Definition: CellTypes.h:48
CellIndex
Cell index for staggered or hexagonal maps.
Definition: CellTypes.h:37
CellOrientation
The orientation of the cells.
Definition: CellTypes.h:59
GF_CORE_API Orientation orientation(float angle)
Get an orientation from an angle.
Rect< int > RectI
A int rectangle.
Definition: Rect.h:509
Vector< int, 2 > Vector2i
A int vector with 2 components.
Definition: Vector.h:1165
constexpr NoneType None
Constant to represent "none".
Definition: Types.h:45
Anchor
An anchor of a box.
Definition: Anchor.h:38
The namespace for gf classes.
Define the states used for drawing to a RenderTarget.
Definition: RenderStates.h:82