grid

package
v0.0.0-...-4ede3f3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Each

func Each[T any](g Grid[T], f EachFunc[T])

func EachIn

func EachIn[T any](g Grid[T], b geo.Box, f EachFunc[T])

func EachInNot

func EachInNot[T comparable](g Grid[T], b geo.Box, f EachFunc[T], not T)

func EachNot

func EachNot[T comparable](g Grid[T], f EachFunc[T], not T)

func Find

func Find[T any](g Grid[T], f FindFunc[T]) (T, bool)

func FindIn

func FindIn[T any](g Grid[T], b geo.Box, f FindFunc[T]) (T, bool)

Types

type Data

type Data struct {
	geo.Box
	Raw []uint16 `json:"raw"`
}

func (*Data) B

func (g *Data) B() geo.Box

func (*Data) Clear

func (g *Data) Clear()

func (Data) Copy

func (g Data) Copy() Data

func (*Data) MarshalBinary

func (g *Data) MarshalBinary() ([]byte, error)

func (*Data) UnmarshalBinary

func (g *Data) UnmarshalBinary(b []byte) error

type EachFunc

type EachFunc[T any] func(geo.Pos, T)

type Edit

type Edit[T ~uint16] struct {
	Copy bool `json:"copy,omitempty"`
	Repl bool `json:"repl,omitempty"`
	Fill *T   `json:"fill,omitempty"`
	Data
}

func (*Edit[T]) Apply

func (e *Edit[T]) Apply(d geo.Box, dst *Tiles[T]) error

Apply changes to dst with the given edit or returns an error.

type FindFunc

type FindFunc[T any] func(geo.Pos, T) bool

type Grid

type Grid[T any] interface {
	B() geo.Box
	Get(geo.Pos) T
	Set(geo.Pos, T)
}

type Sel

type Sel struct {
	Data
}

func (*Sel) Get

func (g *Sel) Get(p geo.Pos) bool

func (*Sel) Set

func (g *Sel) Set(p geo.Pos, t bool)

type Tiles

type Tiles[T ~uint16] struct {
	Data
}

func (*Tiles[T]) Get

func (g *Tiles[T]) Get(p geo.Pos) T

func (*Tiles[T]) Set

func (g *Tiles[T]) Set(p geo.Pos, t T)

Jump to

Keyboard shortcuts

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