Documentation ¶
Rendered for js/wasm
Overview ¶
Package game has the ui game logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canvas ¶ added in v1.2.0
type Canvas interface { StartSwap() Redraw() SetGameStatus(s game.Status) TileLength() int SetTileLength(tileLength int) ParentDivOffsetWidth() int DesiredWidth() int UpdateSize(width int) NumRows() int NumCols() int }
Canvas is the element the game is drawn on
type CanvasCreator ¶ added in v1.2.0
CanvasCreator creates canvases to draw other player's final boards.
type DOM ¶ added in v1.2.0
type DOM interface { QuerySelector(query string) js.Value QuerySelectorAll(document js.Value, query string) []js.Value Checked(query string) bool SetChecked(query string, checked bool) Value(query string) string SetValue(query, value string) SetButtonDisabled(query string, disabled bool) CloneElement(query string) js.Value Confirm(message string) bool Color(element js.Value) string RegisterFuncs(ctx context.Context, wg *sync.WaitGroup, parentName string, jsFuncs map[string]js.Func) NewJsFunc(fn func()) js.Func NewJsEventFunc(fn func(event js.Value)) js.Func ReleaseJsFuncsOnDone(ctx context.Context, wg *sync.WaitGroup, jsFuncs map[string]js.Func) }
DOM interacts with the page.
type Game ¶
type Game struct { Socket Socket // contains filtered or unexported fields }
Game handles managing the state of the board and drawing it on the canvas.
func New ¶ added in v1.2.0
New creates a new game controller with references to the board and canvas.
func (*Game) UpdateInfo ¶
UpdateInfo updates the game for the specified message.
Directories ¶
Path | Synopsis |
---|---|
Package canvas contains the logic to draw the game.
|
Package canvas contains the logic to draw the game. |
Package lobby contains code to view available games and to close the websocket.
|
Package lobby contains code to view available games and to close the websocket. |
Package socket contains the logic to communicate with the server for the game via websocket communication
|
Package socket contains the logic to communicate with the server for the game via websocket communication |
Click to show internal directories.
Click to hide internal directories.