Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
Public Member Functions | List of all members
gf::Cells Class Referenceabstract

The properties of cells. More...

#include <gf/Cells.h>

Inheritance diagram for gf::Cells:
Inheritance graph
[legend]

Public Member Functions

virtual ~Cells ()
 Virtual destructor. More...
 
virtual RectF computeBounds (Vector2i layerSize) const noexcept=0
 Compute the local bounds of the cells. More...
 
virtual RectI computeVisibleArea (const RectF &local) const noexcept=0
 Compute the visible area in terms of coordinates. More...
 
virtual RectF computeCellBounds (Vector2i coords) const noexcept=0
 Compute the cell bounds. More...
 
virtual Vector2i computeCoordinates (Vector2f position) const noexcept=0
 Compute the coordinates of a cell. More...
 
virtual Polyline computePolyline (Vector2i coords) const =0
 Compute the polyline representing a cell. More...
 
virtual std::vector< Vector2icomputeNeighbors (Vector2i coords, Vector2i layerSize, Flags< CellNeighborQuery > flags=gf::None) const =0
 Compute the neighbors of a cell. More...
 

Detailed Description

The properties of cells.

These properties depend on the orientation of the cells in the map:

See also
gf::CellOrientation, gf::Grid, gf::TileLayer

Constructor & Destructor Documentation

◆ ~Cells()

virtual gf::Cells::~Cells ( )
virtual

Virtual destructor.

Member Function Documentation

◆ computeBounds()

virtual RectF gf::Cells::computeBounds ( Vector2i  layerSize) const
pure virtualnoexcept

Compute the local bounds of the cells.

Parameters
layerSizeThe size of the layer
Returns
The bounds of the cells

Implemented in gf::OrthogonalCells, gf::StaggeredCells, and gf::HexagonalCells.

◆ computeCellBounds()

virtual RectF gf::Cells::computeCellBounds ( Vector2i  coords) const
pure virtualnoexcept

Compute the cell bounds.

Parameters
coordsThe coordinates of the cell
Returns
The rectangular bounding box of the cell

Implemented in gf::OrthogonalCells, gf::StaggeredCells, and gf::HexagonalCells.

◆ computeCoordinates()

virtual Vector2i gf::Cells::computeCoordinates ( Vector2f  position) const
pure virtualnoexcept

Compute the coordinates of a cell.

Parameters
positionThe local position
Returns
The coordinates of the cell

Implemented in gf::OrthogonalCells, gf::StaggeredCells, and gf::HexagonalCells.

◆ computeNeighbors()

virtual std::vector< Vector2i > gf::Cells::computeNeighbors ( Vector2i  coords,
Vector2i  layerSize,
Flags< CellNeighborQuery flags = gf::None 
) const
pure virtual

Compute the neighbors of a cell.

Parameters
coordsThe coordinates of the cell
layerSizeThe size of the layer
flagsThe parameters of the query
Returns
An array of coordinates of the neighbors

Implemented in gf::OrthogonalCells, gf::StaggeredCells, and gf::HexagonalCells.

◆ computePolyline()

virtual Polyline gf::Cells::computePolyline ( Vector2i  coords) const
pure virtual

Compute the polyline representing a cell.

Parameters
coordsThe coordinates of the cell
Returns
A polyline (loop) that represents the cell

Implemented in gf::OrthogonalCells, gf::StaggeredCells, and gf::HexagonalCells.

◆ computeVisibleArea()

virtual RectI gf::Cells::computeVisibleArea ( const RectF local) const
pure virtualnoexcept

Compute the visible area in terms of coordinates.

Parameters
localThe visible area
Returns
The visible coordinates

Implemented in gf::OrthogonalCells, gf::StaggeredCells, and gf::HexagonalCells.