ui

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SetCellType is the type of cell to place when the grid is clicked.
	SetCellType = game.CellTypeCross
)

Functions

func NewRectangle

func NewRectangle(min pixel.Vec, max pixel.Vec, color color.Color) *imdraw.IMDraw

NewRectangle will create a new rectangle shape.

Types

type Board

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

Board contains batches for drawing the grass and cells.

func NewBoard

func NewBoard() *Board

NewBoard creates a new board.

func (*Board) Draw

func (b *Board) Draw(t pixel.Target, cells game.Grid)

Draw the board to the screen.

func (*Board) Resize added in v1.1.0

func (b *Board) Resize(w, h float64)

Resize the board with new dimensions.

func (*Board) Update

func (b *Board) Update(win *pixelgl.Window, dt float64, running bool, cells game.Grid)

Update the board with any new mouse clicks.

type Button

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

Button can be clicked to perform an action.

func NewButton

func NewButton(position pixel.Vec, text string, action func(button *Button)) *Button

NewButton creates a new button.

func (*Button) Draw

func (b *Button) Draw(t pixel.Target)

Draw the button to the screen.

func (*Button) Position

func (b *Button) Position() pixel.Vec

Position returns the position of the button.

func (*Button) SetActive

func (b *Button) SetActive(enabled bool)

SetActive enables or disables the button.

func (*Button) SetPosition

func (b *Button) SetPosition(position pixel.Vec)

SetPosition sets the position of the button.

func (*Button) SetText

func (b *Button) SetText(text string)

SetText sets the text for the button.

func (*Button) Size

func (b *Button) Size() pixel.Rect

Size returns the size of the button.

func (*Button) Update

func (b *Button) Update(win *pixelgl.Window)

Update will perform an action if the button has been clicked.

type Selector

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

Selector is used to show that something has been selected by drawing a rectangle behind it.

func NewSelector

func NewSelector(position pixel.Vec, image *pixel.Sprite, action func(selector *Selector)) *Selector

NewSelector creates a new selector.

func (*Selector) Draw

func (s *Selector) Draw(t pixel.Target)

Draw the selector to the screen.

func (*Selector) Position added in v1.1.0

func (s *Selector) Position() pixel.Vec

Position returns the position of the selector.

func (*Selector) Selected

func (s *Selector) Selected(selected bool)

Selected sets the state as selected or not selected.

func (*Selector) SetPosition added in v1.1.0

func (s *Selector) SetPosition(position pixel.Vec)

SetPosition sets the position of the selector.

func (*Selector) Size added in v1.1.0

func (s *Selector) Size() pixel.Rect

Size returns the size of the selector.

func (*Selector) Update

func (s *Selector) Update(win *pixelgl.Window)

Update the selector and perform an action if it has been clicked.

Jump to

Keyboard shortcuts

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