HEXAGÖN is a library for LÖVE used to draw and interact with hexagonal grids.
The library is small and consists only of the following methods:
hexagon.grid(width, height, hexagonSize, pointyTopped, shifted)Return an object representing a grid of hexagon. Can be passed to the
hexagon.drawGrid method in order to draw it on screen.
widthis the number of hexagon on the horizontal side of the grid.heightis the number of hexagon on the vertical side of the grid.hexagonSizeis the size of the hexagons sides.pointyToppedis a boolean that makes the hexagons pointy topped if true.shiftedis a boolean that makes the grid shifted if true.
hexagon.drawGrid(grid, canvas)Draw an hexagon grid on the given canvas.
gridis the grid to draw.canvasis the canvas on which to draw the grid.
hexagon.toPlanCoordinates(x, y, grid)Given the coordinates x, y of an hexagon in grid, returns the coordinates of
its center.
hexagon.toHexagonCoordinates(x, y, gridOptions)Given the coordinates x, y of a point, returns the coordinates of the hexagon
under that point in grid.
See the demo for an example.