Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BarHeight ¶ added in v0.5.0
BarHeight is the info bar's height for a given square size, floored so the two lines of text always fit.
func DrawFrame ¶ added in v0.5.0
DrawFrame composes a whole frame onto c: the board, the highlights, the pieces, the info bar and — once the game ends — the result banner. Drawing through the software canvas rather than the display means the same code paints a live window and a headless recording, pixel for pixel.
Types ¶
type BoardView ¶ added in v0.5.0
type BoardView struct {
Snapshot [64]chess.Piece
Flipped bool
Selected chess.Square
// Legal is the current legal move list, used to light up the squares the
// selected piece can reach.
Legal []chess.Move
WhiteName, BlackName string
Moves int
Over bool
Paused bool
AwaitingHuman bool
Result chess.Result
DrawReason chess.DrawReason
}
BoardView is everything a frame draws: the position, what the player has selected, and how the game stands.
type Config ¶
type Config struct {
Game *game.Game
NewGame func() *game.Game
Logger *applog.Logger
SquareSize int
LightSquare color.RGBA
DarkSquare color.RGBA
MoveDelay time.Duration
ThinkTimeout time.Duration
// Rec names the recording [Render] writes; RecordDelay is gambit's own
// per-move frame delay for the paced clip. Both are set by tools/demogen.
Rec record.Options
RecordDelay int
}
func DefaultConfig ¶
func DefaultConfig() Config
Click to show internal directories.
Click to hide internal directories.