chessboard

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

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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
	Piece          Piece
}

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 CoordinatesStyle

type CoordinatesStyle struct {
	Type     Coordinates
	Theme    *material.Theme
	FontSize float32
	Flipped  bool
	Board    layout.Widget
}

func (CoordinatesStyle) Layout

type Piece

type Piece struct {
	Images []image.Image
	Sizes  []union.Size
}

type Promotion

type Promotion struct {
	Position         union.Point
	SquareSize       union.Size
	Color            chess.Color
	Background       color.NRGBA
	Piece            Piece
	HoveredCandidate chess.Piece
	Flipped          bool
}

func (Promotion) Layout

func (p Promotion) Layout(gtx layout.Context) layout.Dimensions

type Widget

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

func NewWidget

func NewWidget(th *material.Theme, config Config) *Widget

func (*Widget) Flip

func (w *Widget) Flip(gtx layout.Context)

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
⌂ 换网址