Documentation ¶
Index ¶
- type HexGrid
- func (grid *HexGrid) DrawFunc(function func(x, y, h, w int, cell *Hexagon) error) error
- func (grid *HexGrid) DrawGrid()
- func (grid *HexGrid) GetNeighbors(x, y int) ([]*Hexagon, error)
- func (grid *HexGrid) SavePNG(path string) error
- func (grid *HexGrid) SetFill(x, y int, r, g, b, a float64) error
- func (grid *HexGrid) SetFillAll(r, g, b, a float64)
- func (grid *HexGrid) SetStroke(x, y int, r, g, b, a, w float64) error
- func (grid *HexGrid) SetStrokeAll(r, g, b, a, w float64)
- func (grid *HexGrid) SetText(x, y int, r, g, b, a float64, txt string, fontSize float64) error
- type Hexagon
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HexGrid ¶
type HexGrid struct { Context *gg.Context Tiles [][]*Hexagon Width, Height int Rows, Cols int Radius float64 // contains filtered or unexported fields }
func MakeHexGrid ¶
MakeHexGrid creates a <w> wide and <h> high grid with <r> rows and <c> columns
func MakeHexGridWithContext ¶
MakeHexGridWithContext creates a grid with external context Uses context width and height
func (*HexGrid) DrawFunc ¶
DrawFunc recieves a function and applies that function to each cell of the grid the function recieves coordinates of each cell (x,y), the rows and cols (h,w) and a pointer to the cell itself
func (*HexGrid) GetNeighbors ¶
GetNeighbors returns the direct neighbors of a given cell
func (*HexGrid) SetFillAll ¶
SetFillAll sets all of the tiles' fill colour
func (*HexGrid) SetStrokeAll ¶
SetStrokeAll sets all of the tiles' stroke colour and width
Click to show internal directories.
Click to hide internal directories.