![]() |
Gamedev Framework (gf)
0.19.0
A C++17 framework for 2D games
|
A helper for computing coordinates in a hexagonal map. More...
#include <gf/Hexagon.h>
Public Member Functions | |
HexagonHelper (MapCellAxis axis, MapCellIndex index) | |
Constructor. More... | |
Vector2f | getHexagonSize (float radius) const noexcept |
Get the hexagon size. More... | |
RectF | computeBounds (Vector2i size, float radius) const noexcept |
Get the bounds for hexagon cells. More... | |
Vector2f | computeCenter (Vector2i coords, float radius) const |
Compute the center of the hexagon. More... | |
std::vector< Vector2f > | computeCorners (Vector2i coords, float radius) const |
Compute the six corners of the hexagon. More... | |
A helper for computing coordinates in a hexagonal map.
|
inline |
Constructor.
axis | The orientation of hexagon cells. X for pointy and Y for flat |
index | The index of data storage. Odd or Even indicate on which col or row is the offset |
Get the bounds for hexagon cells.
size | Number of cells |
radius | Radius of hexagon |
Compute the center of the hexagon.
coords | The size of the hexagon in the map |
radius | Radius of hexagon |
Compute the six corners of the hexagon.
coords | The size of the hexagon in the map |
radius | Radius of hexagon |
|
noexcept |
Get the hexagon size.
radius | Radius of hexagon |