Documentation ¶
Index ¶
- Constants
- func LevelFromDifficulty(difficulty string) (int, error)
- type ControlScheme
- type ControlSchemes
- type Game
- type Option
- func WithBackground(c canvas.Color) Option
- func WithColor(c canvas.Color) Option
- func WithControlScheme(scheme ControlScheme) Option
- func WithDebugMode() Option
- func WithDimensions(d dimensions) Option
- func WithHiddenRows(rows int) Option
- func WithInitialLevel(level int) Option
- func WithoutGhost() Option
- func WithoutSide() Option
Constants ¶
const ( HomeRowName = "home-row" ArrowKeysName = "arrow-keys" StandardName = "standard" )
the available schemes
const ( BeginnerDifficulty = "beginner" NoviceDifficulty = "novice" ProDifficulty = "pro" ExpertDifficulty = "expert" )
the available starting difficulties
Variables ¶
This section is empty.
Functions ¶
func LevelFromDifficulty ¶
LevelFromDifficulty retrieves the starting level associated with a specified difficulty
Types ¶
type ControlScheme ¶
type ControlScheme interface { Description() string String() string // contains filtered or unexported methods }
ControlScheme represents a mapping of keys to user input
func ArrowKeys ¶
func ArrowKeys() ControlScheme
ArrowKeys represents the control scheme which utilizes the arrow keys
func AvailableSchemes ¶
func AvailableSchemes() []ControlScheme
AvailableSchemes represents the set of available control schemes
func HomeRow ¶
func HomeRow() ControlScheme
HomeRow represents the control scheme which focuses on the home row
func SchemeFromName ¶
func SchemeFromName(name string) (ControlScheme, error)
SchemeFromName retrieves the scheme associated with the specified name
func Standard ¶
func Standard() ControlScheme
Standard represents a control scheme similar to the standard tetrix keyboard controls
type ControlSchemes ¶
type ControlSchemes []ControlScheme
ControlSchemes is a union of one or more mappings of keys to user input
func (ControlSchemes) Description ¶
func (c ControlSchemes) Description() string
Description is the combined descriptions of multiple schemes
func (ControlSchemes) String ¶
func (c ControlSchemes) String() string
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
Game is responsible for handling the game state
func (*Game) DisplayPotentialColors ¶
DisplayPotentialColors prints a demo board with the potential pieces and colors This is used to assist the user in selecting options e.g. WithoutGhost() should be applied if ghost pieces render oddly in the canvas
type Option ¶
type Option interface {
Apply(g *Game)
}
Option represents a game option
func WithBackground ¶
WithBackground returns an option specifies the background for the canvas and board
func WithControlScheme ¶
func WithControlScheme(scheme ControlScheme) Option
WithControlScheme returns an Option which specifies the control scheme
func WithDebugMode ¶
func WithDebugMode() Option
WithDebugMode returns an option that specifies that the game and canvas should use debug behaviour
func WithDimensions ¶
func WithDimensions(d dimensions) Option
WithDimensions returns an option that specifies the dimensions of the board and canvas
func WithHiddenRows ¶
WithHiddenRows returns an option that specifies how many rows of the board shouldn't be rendered
func WithInitialLevel ¶
WithInitialLevel returns an option that specifies the initial level
func WithoutGhost ¶
func WithoutGhost() Option
WithoutGhost returns an option that disables the ghost piece
func WithoutSide ¶
func WithoutSide() Option
WithoutSide returns an option that disables the side bar