Documentation
¶
Overview ¶
Package js provides a Driver for making browser apps using wasm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
TileManager TileManager // for retrieving tiles (required)
Width int // initial screen width in cells (default: 80)
Height int // initial screen height in cells (default: 24)
AppCanvasId string // application's canvas id (default: appcanvas)
AppDivId string // application's div containing the canvas id (default: appdiv)
}
Config contains configurations options for the driver.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements gruid.Driver using the syscall/js interface for the browser using javascript and wasm.
func (*Driver) ClearCache ¶
func (dr *Driver) ClearCache()
ClearCache clears the tiles internal cache.
func (*Driver) PollMsgs ¶
PollMsgs implements gruid.Driver.PollMsgs. To avoid conflicts with browser or OS shortcuts, keydown events with modifier keys may not be reported. If the script screenfull is available, it binds F11 for a portable canvas fullscreen.
func (*Driver) SetTileManager ¶
func (dr *Driver) SetTileManager(tm TileManager)
SetTileManager allows to change the used tile manager.
type TileManager ¶
type TileManager interface {
// GetImage returns the image to be used for a given cell style.
GetImage(gruid.Cell) image.Image
// TileSize returns the (width, height) in pixels of the tiles. Both
// should be positive and non-zero.
TileSize() gruid.Point
}
TileManager manages tiles fetching.
Click to show internal directories.
Click to hide internal directories.