gol

package
v0.0.0-...-e79ed84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScreenWidth  = 1024
	ScreenHeight = 1024
)

Variables

View Source
var (
	GolFont font.Face
)

Functions

func DrawCenteredText

func DrawCenteredText(screen *ebiten.Image, s string, font font.Face, cx, cy int, color color.Color)

func Max

func Max(x, y int) int

func Min

func Min(x, y int) int

func NewGrid

func NewGrid() map[Hex]bool

Types

type FractionalHex

type FractionalHex struct {
	// contains filtered or unexported fields
}

func (*FractionalHex) Round

func (fh *FractionalHex) Round() *Hex

type Game

type Game struct {
	// contains filtered or unexported fields
}

func NewGame

func NewGame() *Game

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) DrawInfo

func (g *Game) DrawInfo(screen *ebiten.Image)

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*Game) NextGen

func (g *Game) NextGen()

func (*Game) Update

func (g *Game) Update() error

type Hex

type Hex struct {
	// contains filtered or unexported fields
}

func (*Hex) Add

func (h1 *Hex) Add(h2 Hex) Hex

func (*Hex) Neighbors

func (h *Hex) Neighbors() [6]Hex

func (*Hex) ToString

func (h *Hex) ToString() string

type Layout

type Layout struct {
	// contains filtered or unexported fields
}

func NewLayout

func NewLayout(orientation *Orientation, size, origin Point) *Layout

func (*Layout) GetCorners

func (l *Layout) GetCorners(hex *Hex) []Point

func (*Layout) HexCornerOffset

func (l *Layout) HexCornerOffset(corner int) Point

func (*Layout) HexToPixel

func (l *Layout) HexToPixel(hex *Hex) Point

func (*Layout) PixelToHex

func (l *Layout) PixelToHex(p Point) FractionalHex

type Orientation

type Orientation struct {
	// contains filtered or unexported fields
}
var FlatTop Orientation = Orientation{
	float32(3.0 / 2.0),
	float32(0.0),
	float32(math.Sqrt(3.0) / 2.0),
	float32(math.Sqrt(3.0)),
	float32(2.0 / 3.0),
	float32(0.0),
	float32(-1.0 / 3.0),
	float32(math.Sqrt(3.0) / 3.0),
	float32(0.0),
}
var PointyTop Orientation = Orientation{
	float32(math.Sqrt(3.0)),
	float32(math.Sqrt(3.0) / 2.0),
	float32(0.0),
	float32(3.0 / 2.0),
	float32(math.Sqrt(3.0) / 3.0),
	float32(-1.0 / 3.0),
	float32(0.0),
	float32(2.0 / 3.0),
	float32(0.5),
}

type Point

type Point struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL