painter

package
v0.0.0-...-2d6ac73 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GreenFill

func GreenFill(t screen.Texture)

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

func Reset

func Reset(t screen.Texture)

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

func WhiteFill

func WhiteFill(t screen.Texture)

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

Types

type BgrectOp

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

func (BgrectOp) Do

func (r BgrectOp) Do(t screen.Texture) bool

type CustomFill

type CustomFill struct {
	R, G, B, A int
}

Тестова операція для використання у сриптах. Не бажана для використання

func (CustomFill) Do

func (c CustomFill) Do(t screen.Texture) bool

type FigureOp

type FigureOp struct{ X, Y int }

func (FigureOp) Do

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

type Loop

type Loop struct {
	Receiver Receiver

	MQ messageQueue
	// 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 MoveOp

type MoveOp struct{ X, Y int }

func (MoveOp) Do

func (m MoveOp) Do(t screen.Texture) bool

type Operation

type Operation interface {
	Do(t screen.Texture) (ready bool)
}

Змінює вхідну текстуру Повертаючи true, якщо текстура готова для відображення

type OperationFunc

type OperationFunc func(t screen.Texture)

Перетворює функцію оновлення текстури в Operation

func (OperationFunc) Do

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

type OperationList

type OperationList []Operation

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

func (OperationList) Do

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

type Receiver

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

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

type TextureState

type TextureState struct {
	BgClr      color.Color
	HasRect    bool
	BgRect     BgrectOp
	HasFigures bool
	Figures    []FigureOp
}

type UpdateOp

type UpdateOp struct{}

Поетапно малює 3 шари Власне малювання відбувається один раз в кінці, аби зберегти ресурси та не малювати в холосту Сигналізує, що текстура готова

func (UpdateOp) Do

func (op UpdateOp) Do(t screen.Texture) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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