painter

package
v0.0.0-...-4e6cd97 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TFigureColor = color.RGBA{255, 102, 102, 255}
View Source
var Table = map[string]Operation{
	"white":  FillCreateFn(NewWhiteFill),
	"green":  FillCreateFn(NewGreenFill),
	"figure": CreateTFigureFn(NewTFigure),
	"update": UpdatePoint{},
	"brect":  CreateBRect(NewBRect),
	"move":   CreateMove(NewMove),
	"reset":  Reset{},
}

Functions

func GetTable

func GetTable() map[string]Operation

Types

type BRect

type BRect struct {
	Bounds Rectangle
	// contains filtered or unexported fields
}

func NewBRect

func NewBRect(x1, y1, x2, y2 float64) BRect

func (*BRect) Draw

func (brect *BRect) Draw(t screen.Texture)

type ClickHandler

type ClickHandler struct {
	GetTFigures func() []*TFigure
	// contains filtered or unexported fields
}

func (*ClickHandler) GetTFigureUnderPoint

func (cl *ClickHandler) GetTFigureUnderPoint(p image.Point) (*TFigure, bool)

func (*ClickHandler) Update

func (cl *ClickHandler) Update(e mouse.Event) bool

type CreateBRect

type CreateBRect func(x1, y1, x2, y2 float64) BRect

type CreateMove

type CreateMove func(x, y float64) Move

type CreateTFigureFn

type CreateTFigureFn func(x, y float64) TFigure

type DrawableElement

type DrawableElement interface {
	Draw(t screen.Texture)
}

type Fill

type Fill struct {
	Color color.RGBA
}

func NewGreenFill

func NewGreenFill() Fill

func NewWhiteFill

func NewWhiteFill() Fill

func (*Fill) Draw

func (f *Fill) Draw(t screen.Texture)

type FillCreateFn

type FillCreateFn func() Fill

type Generator

type Generator struct {
	Scr screen.Screen
	// contains filtered or unexported fields
}

func (*Generator) Generate

func (gn *Generator) Generate(size image.Point) (screen.Texture, error)

func (*Generator) GetTFigures

func (gn *Generator) GetTFigures() (tfs []*TFigure)

func (*Generator) SetScreen

func (gn *Generator) SetScreen(scr screen.Screen)

func (*Generator) Update

func (gn *Generator) Update(op Operation)

type Loop

type Loop struct {
	Receiver Receiver

	Gen TextureGenerator
	// contains filtered or unexported fields
}

func (*Loop) AddDefaultElements

func (l *Loop) AddDefaultElements()

func (*Loop) PostOperation

func (l *Loop) PostOperation(op Operation)

func (*Loop) PostOperations

func (l *Loop) PostOperations(ops []Operation)

func (*Loop) Start

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

func (*Loop) Terminate

func (l *Loop) Terminate()

type Move

type Move struct {
	Dest Point

	Range []*TFigure
	// contains filtered or unexported fields
}

func NewMove

func NewMove(x, y float64) Move

func (*Move) Move

func (mv *Move) Move(t screen.Texture)

func (*Move) SetRange

func (mv *Move) SetRange(tfs []*TFigure)

type Operation

type Operation interface{}

type Point

type Point struct {
	X float64
	Y float64
}

type Receiver

type Receiver interface {
	Update()
}

type Rectangle

type Rectangle struct {
	Min Point
	Max Point
}

type Reset

type Reset struct{}

type Store

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

func (*Store) Lock

func (store *Store) Lock()

func (*Store) Unlock

func (store *Store) Unlock()

type TFigure

type TFigure struct {
	Color  color.RGBA
	Center Point

	Size Point
	// contains filtered or unexported fields
}

func NewTFigure

func NewTFigure(x, y float64) TFigure

func (*TFigure) Contains

func (tf *TFigure) Contains(p image.Point) bool

func (*TFigure) Draw

func (tf *TFigure) Draw(t screen.Texture)

func (*TFigure) Move

func (tf *TFigure) Move(v image.Point)

type TextureGenerator

type TextureGenerator interface {
	SetScreen(scr screen.Screen)
	Update(op Operation)
	Generate(size image.Point) (screen.Texture, error)
}

type UpdatePoint

type UpdatePoint struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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