painter

package
v0.0.0-...-9b838e3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UpdateOperation = updateOperation{}

UpdateOperation is an operation that does not change the texture, but signals that it should be considered ready.

Functions

func GreenFill

func GreenFill(texture screen.Texture)

GreenFill fills the texture with green color. Can be used as a PainterOperation using OperationFunc(GreenFill).

func ResetScreen

func ResetScreen(texture screen.Texture)

func WhiteFill

func WhiteFill(texture screen.Texture)

WhiteFill fills the texture with white color. Can be used as a PainterOperation using OperationFunc(WhiteFill).

Types

type BgRectangle

type BgRectangle struct {
	X1, Y1, X2, Y2 int
}

func (*BgRectangle) Do

func (operation *BgRectangle) Do(texture screen.Texture) bool

type Figure

type Figure struct {
	X, Y int
	C    color.RGBA
}

func (*Figure) Do

func (operation *Figure) Do(texture screen.Texture) bool

type Loop

type Loop struct {
	Receiver Receiver

	MsgQueue messageQueue
	// contains filtered or unexported fields
}

Loop implements an event loop to create a texture obtained by executing PainterOperations received from an internal queue.

func (*Loop) Post

func (l *Loop) Post(op PainterOperation)

func (*Loop) Start

func (l *Loop) Start(s screen.Screen)

Start starts the event loop. This method must be called before calling any other method on it.

func (*Loop) StopAndWait

func (l *Loop) StopAndWait()

StopAndWait signals the event loop to stop.

type Move

type Move struct {
	X, Y    int
	Figures []*Figure
}

func (*Move) Do

func (operation *Move) Do(texture screen.Texture) bool

type OperationFunc

type OperationFunc func(texture screen.Texture)

OperationFunc is used to convert a texture update function to a PainterOperation.

func (OperationFunc) Do

func (f OperationFunc) Do(texture screen.Texture) bool

type PainterOperation

type PainterOperation interface {
	// Do performs the operation and returns true if the texture is ready for display.
	Do(texture screen.Texture) (ready bool)
}

type PainterOperationList

type PainterOperationList []PainterOperation

PainterOperationList groups a list of operations into one.

func (PainterOperationList) Do

func (operationList PainterOperationList) Do(texture screen.Texture) (ready bool)

type Receiver

type Receiver interface {
	Update(t screen.Texture)
}

Receiver receives a texture prepared as a result of executing commands in an event context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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