ui

package
v0.0.0-...-883f3e4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anchor

type Anchor func(bounds geometry.Rect) (offset geometry.Vec)

An Anchor computes a point to treat as the position of an image, relative to image bounds. The computed point does not have to live within the image bounds.

func AnchorCenter

func AnchorCenter() Anchor

AnchorCenter sets the anchor point in the middle of the image.

func AnchorNorthWest

func AnchorNorthWest() Anchor

AnchorNorthWest sets the anchor point at the upper-leftmost corner of the image.

func AnchorSouth

func AnchorSouth() Anchor

AnchorSouth sets the anchor point at the middle of the lower edge of the image.

func (Anchor) For

func (anc Anchor) For(bounds geometry.Rect) (offset geometry.Vec)

type Camera

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

A Camera describes the coordinate tranformation between the world and the window.

The zero value looks at the origin point (pixel.ZV) in world coordinates.

func NewCamera

func NewCamera(lookAt geometry.Vec) Camera

NewCamera creates a camera that will put lookAt in the center of the window.

func (*Camera) Matrix

func (cam *Camera) Matrix(bounds geometry.Rect) geometry.Mat

Matrix computes the world-to-window coordinate transformation matrix.

func (*Camera) MoveBy

func (cam *Camera) MoveBy(delta geometry.Vec)

MoveBy changes the point being looked at by delta in window coordinates.

type CameraController

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

func NewCamController

func NewCamController(cam *Camera) *CameraController

func (*CameraController) Process

func (cont *CameraController) Process(src input.Source)

type GridDimensions

type GridDimensions struct {
	CellWidth  float64
	CellHeight float64
}

func (GridDimensions) Matrix

func (d GridDimensions) Matrix(col, row int) geometry.Mat

func (GridDimensions) UnderCursor

func (d GridDimensions) UnderCursor(src input.Source, cam Camera) grid.Point

type GridOutline

type GridOutline struct {
	Sprite  Sprite
	Space   *grid.Space
	Dims    GridDimensions
	Margins Margins
}

func (GridOutline) Draw

func (o GridOutline) Draw(dst draw.Target)

type Margins

type Margins struct{ X, Y float64 }

type OrderedSpriteGroup

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

An OrderedSpriteGroup keeps track of a bunch of sprites and knows how to draw in the correct order. This assumes all the sprites are anchored at their bottom.

func (*OrderedSpriteGroup) Add

func (group *OrderedSpriteGroup) Add(sprites ...Sprite)

Add sprites to draw. You need to add the sprites before each Draw call.

func (*OrderedSpriteGroup) Draw

func (group *OrderedSpriteGroup) Draw()

Draw the added sprites. The set of sprites to draw and their order is forgotten afterwards.

type Sprite

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

func NewSprite

func NewSprite(img draw.Image, anchor Anchor) Sprite

func (Sprite) Draw

func (s Sprite) Draw()

func (Sprite) Transform

func (s Sprite) Transform(m geometry.Mat) Sprite

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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