gui

package
v0.0.0-...-3f2acbe Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	White = Color{R: 255, G: 255, B: 255, A: 255}
	Black = Color{R: 0, G: 0, B: 0, A: 255}
)

Functions

func PrintText

func PrintText(screen *eb.Image, text string, pos Point)

Types

type Cell

type Cell struct {
	Coords Point
	Pos    Point
	State  CellState
}

func (*Cell) Draw

func (c *Cell) Draw(screen *ebiten.Image)

func (*Cell) FlipState

func (c *Cell) FlipState()

func (*Cell) IsHovered

func (c *Cell) IsHovered() bool

func (Cell) New

func (c Cell) New(x int, y int, state CellState) Cell

type CellState

type CellState int
const (
	Dead  CellState = 0
	Alive CellState = 1
)

type Color

type Color struct {
	R, G, B, A uint8
}

type Grid

type Grid struct {
	Cells []Cell
}

func (*Grid) AddCell

func (g *Grid) AddCell(x int, y int)

func (*Grid) AdvanceTick

func (g *Grid) AdvanceTick()

func (Grid) Draw

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

func (*Grid) Each

func (g *Grid) Each(callback func(c *Cell))

Executes a callback function on all the cells in the grid.

func (*Grid) GetCell

func (g *Grid) GetCell(col int, row int) (Cell, error)

func (*Grid) GetNeighbors

func (g *Grid) GetNeighbors(cell Cell) []Cell

type Point

type Point struct {
	X, Y int
}

Jump to

Keyboard shortcuts

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