Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type D ¶
type D struct {
Q, R, S int
}
D is the amount of change between two hexagons.
func DiagonalDelta ¶
func DiagonalDelta(d DirectionEnum) D
DiagonalDelta returns the delta required to move a single hex in a direction.
func NeighborDelta ¶
func NeighborDelta(d DirectionEnum) D
NeighborDelta returns the delta required to move a single hex in a direction.
type Diagonal ¶
type Diagonal int
Diagonal represents the direction of each point on a hex.
type DirectionEnum ¶
type DirectionEnum int
DirectionEnum represents the directions of each of the sides of a hex.
const ( DirectionPosQ DirectionEnum = iota DirectionNegR DirectionPosS DirectionNegQ DirectionPosR DirectionNegS DirectionUndefined )
Constants for the directions from a Hex.
func Direction ¶
func Direction(d D) DirectionEnum
Direction returns the Direction one point is in comparison to another point.
func (DirectionEnum) String ¶
func (d DirectionEnum) String() string
String returns the string name of the direction.
type F ¶
type F struct {
X, Y float64
}
F represents a floating point point, used for polygon drawing functions.
type H ¶
type H struct {
Q, R int
}
H is a single hexagon in the grid.
func RotateClockwise ¶
RotateClockwise rotates one point around another point clockwise
func RotateCounterClockwise ¶
RotateCounterClockwise rotates one point around another point counter clockwise
func (H) Neighbor ¶
func (h H) Neighbor(d DirectionEnum) H
Neighbor one step in a specific direction.
type Layout ¶
type Layout struct { Radius F // Radius is the radius of the hexagon; supports stretching on X or Y. Origin F // Origin is the where the center of H{0, 0} will be displayed. // contains filtered or unexported fields }
Layout is the layout of the hex grid.
func MakeLayout ¶
func MakeLayout(hexSize F, originCenter F, orientation Orientation) Layout
MakeLayout for rendering on the screen.
func (Layout) CenterFor ¶
CenterFor returns the point at the center (as a float) of the hex based on the layout.
type Orientation ¶
type Orientation struct {
// contains filtered or unexported fields
}
Orientation is the orientation of the hexagon map
var ( OrientationPointy Orientation = Orientation{ // contains filtered or unexported fields } OrientationFlat Orientation = Orientation{ // contains filtered or unexported fields } )
Define the default set of orientations.