gen

package
v0.0.0-...-154d7ca Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const StyleBox string = "default-box"
View Source
const StyleRooms string = "default-rooms"

Variables

View Source
var (
	ErrWrongConfig = errors.New("wrong config type provided")
)
View Source
var Styles = map[string]Styler{}

Functions

func FillRange

func FillRange(getCell func(x, y int) Cell, setCell func(x, y int, cell Cell), x1, y1, x2, y2 int, flag ...string)

func Generate

func Generate(styler Styler, cfg Config) error

func RegisterStyle

func RegisterStyle(name string, cfg Styler)

Types

type Cell

type Cell interface {
	Value() int
	SetValue(v int)
	Flags() Flags
	SetFlags(v Flags)
	Data() interface{}
	SetData(d interface{})
}

type Config

type Config interface {
}

type ConfigBox

type ConfigBox struct {
	Width   int
	Height  int
	Cell    func(x, y int) Cell
	SetCell func(x, y int, cell Cell)
}

type ConfigRooms

type ConfigRooms struct {
	Width           int
	Height          int
	MinRoomSize     int
	MaxRoomSize     int
	MaxRooms        int
	JoinSharedWalls bool
	OverlapPadding  int
	Cell            func(x, y int) Cell
	SetCell         func(x, y int, cell Cell)
}

type Fixture

type Fixture struct {
	ID   id.UUID
	Keys map[string]id.UUID
	Rows []string
}

func (Fixture) Height

func (f Fixture) Height() int

func (Fixture) Width

func (f Fixture) Width() (w int)

type FixtureEntry

type FixtureEntry struct {
	Targets []FixtureTarget
	Count   MinMax
	X       MinMax
	Y       MinMax
}

type FixtureTarget

type FixtureTarget struct {
	ID        id.UUID
	Rotate    bool
	Overlap   bool
	Intersect bool
}

type Flags

type Flags []string

func (Flags) Has

func (f Flags) Has(v string) bool

type MapConfig

type MapConfig struct {
	Width  int
	Height int
}

type MinMax

type MinMax [2]int

func (MinMax) Max

func (m MinMax) Max() int

func (MinMax) Min

func (m MinMax) Min() int

func (MinMax) Roll

func (m MinMax) Roll() int

type Place

type Place struct {
	Title    string
	ID       id.UUID
	Width    MinMax
	Height   MinMax
	Fixtures []FixtureEntry
	WFC      []WFCEntry
}

type Styler

type Styler struct {
	Passes      int
	ProcessPass func(cfg Config, pass int) error
}

type WFCEntry

type WFCEntry struct {
	ID       id.UUID
	Adjacent []id.UUID
}

Jump to

Keyboard shortcuts

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