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

Orthogonal cells. More...

#include <gf/Cells.h>

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

Public Member Functions

 OrthogonalCells (Vector2f tileSize)
 Make orthogonal cells of the specified size. More...
 
RectF computeBounds (Vector2i layerSize) const noexcept override
 Compute the local bounds of the cells. More...
 
RectI computeVisibleArea (const RectF &local) const noexcept override
 Compute the visible area in terms of coordinates. More...
 
RectF computeCellBounds (Vector2i coords) const noexcept override
 Compute the cell bounds. More...
 
Vector2i computeCoordinates (Vector2f position) const noexcept override
 Compute the coordinates of a cell. More...
 
Polyline computePolyline (Vector2i coords) const override
 Compute the polyline representing a cell. More...
 
std::vector< Vector2icomputeNeighbors (Vector2i coords, Vector2i layerSize, Flags< CellNeighborQuery > flags=gf::None) const override
 Compute the neighbors of a cell. More...
 
- Public Member Functions inherited from gf::Cells
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

Orthogonal cells.

Constructor & Destructor Documentation

◆ OrthogonalCells()

gf::OrthogonalCells::OrthogonalCells ( Vector2f  tileSize)
inline

Make orthogonal cells of the specified size.

Parameters
tileSizeThe size of a cell

Member Function Documentation

◆ computeBounds()

RectF gf::OrthogonalCells::computeBounds ( Vector2i  layerSize) const
overridevirtualnoexcept

Compute the local bounds of the cells.

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

Implements gf::Cells.

◆ computeCellBounds()

RectF gf::OrthogonalCells::computeCellBounds ( Vector2i  coords) const
overridevirtualnoexcept

Compute the cell bounds.

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

Implements gf::Cells.

◆ computeCoordinates()

Vector2i gf::OrthogonalCells::computeCoordinates ( Vector2f  position) const
overridevirtualnoexcept

Compute the coordinates of a cell.

Parameters
positionThe local position
Returns
The coordinates of the cell

Implements gf::Cells.

◆ computeNeighbors()

std::vector< Vector2i > gf::OrthogonalCells::computeNeighbors ( Vector2i  coords,
Vector2i  layerSize,
Flags< CellNeighborQuery flags = gf::None 
) const
overridevirtual

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

Implements gf::Cells.

◆ computePolyline()

Polyline gf::OrthogonalCells::computePolyline ( Vector2i  coords) const
overridevirtual

Compute the polyline representing a cell.

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

Implements gf::Cells.

◆ computeVisibleArea()

RectI gf::OrthogonalCells::computeVisibleArea ( const RectF local) const
overridevirtualnoexcept

Compute the visible area in terms of coordinates.

Parameters
localThe visible area
Returns
The visible coordinates

Implements gf::Cells.