maprender

package
v0.0.0-...-63dc931 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawMap

func DrawMap(datadir string, m *maps.Map, opts *Options) (*image.RGBA, error)

DrawMap is a helper for drawing a single map. For multiple maps it's more efficient to use Renderer.

Types

type Options

type Options struct {
	FailFast bool // return on the first error
	NoFloor  bool // do not draw floor tiles
	NoWalls  bool // do not draw walls
}

type Renderer

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

Renderer is a Nox map renderer.

func NewRenderer

func NewRenderer(datadir string) (*Renderer, error)

NewRenderer creates a Nox map renderer based on a given Nox data dir. The renderer can be sued to draw multiple maps.

func (*Renderer) Close

func (r *Renderer) Close() error

Close the renderer,

func (*Renderer) DrawMap

func (r *Renderer) DrawMap(m *maps.Map, opts *Options) (*image.RGBA, error)

DrawMap renders the map. It will keep processing the map and return a partial image in case of an error. If FailFast option is set, it will fail on the first error instead of returning the last one. Passing nil options will use defaults.

func (*Renderer) DrawMapFile

func (r *Renderer) DrawMapFile(dir string, opts *Options) (*image.RGBA, error)

DrawMapFile reads and renders the map file. See DrawMap for details. As opposed to DrawMap, the returned image may be nil in case map decoding fails.

Jump to

Keyboard shortcuts

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