chessboard

package module
v0.0.0-...-ac5b73c Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SquareToPoint

func SquareToPoint(square chess.Square, size float32) union.Point

Types

type AnnoType

type AnnoType int8
const (
	NoAnno AnnoType = iota
	RectAnno
	CircleAnno
	CrossAnno
	ArrowAnno
)

type Annotation

type Annotation struct {
	Type  AnnoType
	Start chess.Square
	End   chess.Square // only for arrows
	Color color.NRGBA
	Width union.Size
	// contains filtered or unexported fields
}

func (*Annotation) Copy

func (a *Annotation) Copy() Annotation

func (*Annotation) Draw

func (a *Annotation) Draw(gtx layout.Context, squareOrigins []union.Point, squareSize union.Size, redraw bool)

func (*Annotation) Equal

func (a *Annotation) Equal(b *Annotation) bool

func (*Annotation) Scale

func (a *Annotation) Scale(factor float32)

type Color

type Color struct {
	Hint     color.NRGBA
	LastMove color.NRGBA
	Primary  color.NRGBA
	Info     color.NRGBA
	Warning  color.NRGBA
	Danger   color.NRGBA
}

type Config

type Config struct {
	ShowHints       bool
	ShowLastMove    bool
	Color           Color
	AnimationSpeed  time.Duration
	Coordinates     Coordinates
	BoardImage      image.Image
	BoardImageSize  union.Size
	PieceImages     []image.Image
	PieceImageSizes []union.Size
}

func NewConfig

func NewConfig(boardFilename string, piecesFolderName string) (c Config, err error)

type Coordinates

type Coordinates int8
const (
	NoCoordinates Coordinates = iota
	InsideCoordinates
	OutsideCoordinates
	EachSquare
)

type Square

type Square struct {
	Letter int
	Number int
	Origin image.Point
	Center image.Point
}

func NewSquare

func NewSquare(position f32.Point, size float32) (s Square)

func (Square) Equal

func (a Square) Equal(b Square) bool

func (Square) String

func (s Square) String() string

func (Square) ToChess

func (s Square) ToChess() chess.Square

type Widget

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

func NewWidget

func NewWidget(config Config) *Widget

func (*Widget) Layout

func (w *Widget) Layout(gtx layout.Context) layout.Dimensions

func (*Widget) SetGame

func (w *Widget) SetGame(game *chess.Game)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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