grid

package
v0.0.0-...-d322e89 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func At

func At(p Position) ecs.Entity

At returns the entity currently at the grid position.

func Fill

func Fill(newTile func() ecs.Entity)

Fill the grid with new tiles.

func ScreenResized

func ScreenResized(w, h int16)

ScreenResized repositions the grid on the screen

func Setup

func Setup(w, h int8)

Setup prepare a new grid of width w and height h.

func TestAndMark

func TestAndMark(test func(e1, e2 ecs.Entity) bool, mark func(e ecs.Entity))

Types

type Position

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

A Position on the grid

func Nowhere

func Nowhere() Position

Nowhere returns the nil value for grid positions.

func PositionAt

func PositionAt(c pixel.XY) Position

PositionAt returns the grid position containing the screen coordinates c.

func PositionOf

func PositionOf(e ecs.Entity) Position

PositionOf returns the grid position of entity e.

func (Position) ScreenXY

func (p Position) ScreenXY() (x, y int16)

ScreenXY returns the screen coordinates of the grid position, given a cell size of s.

func (Position) String

func (p Position) String() string

String returns a string representation of p.

func (Position) TestAndMark

func (p Position) TestAndMark(test func(e1, e2 ecs.Entity) bool, mark func(e ecs.Entity))

Jump to

Keyboard shortcuts

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