painter

package
v0.0.0-...-29bcc9c Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UpdateOp = updateOp{}

UpdateOp операція, яка не змінює текстуру, але сигналізує, що текстуру потрібно розглядати як готову.

Functions

func GreenFill

func GreenFill(t screen.Texture)

GreenFill зафарбовує тестуру у зелений колір. Може бути викоистана як Operation через OperationFunc(GreenFill).

func Reset

func Reset(t screen.Texture)

func WhiteFill

func WhiteFill(t screen.Texture)

WhiteFill зафарбовує тестуру у білий колір. Може бути викоистана як Operation через OperationFunc(WhiteFill).

Types

type BgRectOp

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

func (*BgRectOp) Do

func (op *BgRectOp) Do(t screen.Texture) bool

type FigureOp

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

func (*FigureOp) Do

func (op *FigureOp) Do(t screen.Texture) bool

type Loop

type Loop struct {
	Receiver Receiver

	MsgQueue MessageQueue
	Done     chan struct{}
	Stopped  bool
	// contains filtered or unexported fields
}

Loop реалізує цикл подій для формування текстури отриманої через виконання операцій отриманих з внутрішньої черги.

func (*Loop) Post

func (l *Loop) Post(op Operation)

Post додає нову операцію у внутрішню чергу.

func (*Loop) Start

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

Start запускає цикл подій. Цей метод потрібно запустити до того, як викликати на ньому будь-які інші методи.

func (*Loop) StopAndWait

func (l *Loop) StopAndWait()

StopAndWait сигналізує

type MessageQueue

type MessageQueue struct {
	Queue []Operation
	// contains filtered or unexported fields
}

func (*MessageQueue) Pull

func (mq *MessageQueue) Pull() Operation

func (*MessageQueue) Push

func (mq *MessageQueue) Push(op Operation)

type MoveOp

type MoveOp struct {
	X, Y    int
	Figures []*FigureOp
}

func (*MoveOp) Do

func (op *MoveOp) Do(t screen.Texture) bool

type Operation

type Operation interface {
	// Do виконує зміну операції, повертаючи true, якщо текстура вважається готовою для відображення.
	Do(t screen.Texture) (ready bool)
}

Operation змінює вхідну текстуру.

type OperationFunc

type OperationFunc func(t screen.Texture)

OperationFunc використовується для перетворення функції оновлення текстури в Operation.

func (OperationFunc) Do

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

type OperationList

type OperationList []Operation

OperationList групує список операції в одну.

func (OperationList) Do

func (ol OperationList) Do(t screen.Texture) (ready bool)

type Receiver

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

Receiver отримує текстуру, яка була підготовлена в результаті виконання команд у циелі подій.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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