Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Board ¶
type Board struct {
// contains filtered or unexported fields
}
Board represents a single board.
func NewBoard ¶
func NewBoard(x, y int, cfg *BoardConfig) *Board
NewBoard returns a new Board struct. X and Y are the coordinates of the top left corner of the board. If no config is provided, default values are used.
type BoardConfig ¶
type BoardConfig struct { RulerColor Color TextColor Color EmptyColor Color HitColor Color MissColor Color ShipColor Color SunkColor Color EmptyChar byte HitChar byte MissChar byte ShipChar byte SunkChar byte }
BoardConfig holds configuration parameters for Board struct.
func NewBoardConfig ¶
func NewBoardConfig() *BoardConfig
NewBoardConfig returns a new config with default values.
type Drawable ¶
Drawable represents a collection of related objects that can be drawn on the screen.
type GUI ¶
type GUI struct {
// contains filtered or unexported fields
}
func NewGUI ¶
NewGUI returns a new GUI instance. If debug is true, the GUI will print logs to the terminal after exiting.
func (*GUI) Log ¶
Log takes a log string and additional parameters, which can be substituted into the string using standard fmt.Printf rules. If debug mode is on, the formatted log will be printed to the terminal when GUI exits.
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
func NewText ¶
func NewText(x, y int, text string, cfg *TextConfig) *Text
NewText returns a new Text struct. X and Y are the coordinates of the top left corner of the text. If no config is provided, default values are used.
func (*Text) SetBgColor ¶
SetBgColor sets the background color of the Text struct.
func (*Text) SetFgColor ¶
SetFgColor sets the foreground color of the Text struct.
type TextConfig ¶
TextConfig holds configuration parameters for Text struct.
func NewTextConfig ¶
func NewTextConfig() *TextConfig
NewTextConfig returns a new config with default values.