package
module
Version:
v0.0.0-...-d640f43
Opens a new window with list of versions in this module.
Published: Aug 16, 2019
License: Apache-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 2
Opens a new window with list of known importers.
Documentation
¶
-
type Canvas
-
type Cell
-
type Layer
-
func (l *Layer) At(x, y int) *Cell
-
func (l *Layer) Clear()
-
func (l *Layer) Each(f func(*Cell))
-
func (l *Layer) InBounds(x, y int) bool
-
func (l *Layer) Normalize(minX, minY, maxX, maxY int) (nMinX, nMinY, nMaxX, nMaxY int)
-
func (l *Layer) SetRune(x, y int, r rune)
-
func (l *Layer) SetStyle(x, y int, style tcell.Style)
-
type Screen
type Canvas struct {
Layers []*Layer
}
A Canvas is a drawable area on top of a screen interface.
NewCanvas returns a new, uninitiated canvas object.
AddLayer adds a new blank layer to a canvas object.
Draw will draw the contents of all layers to the screen.
A Cell is a single point in a layer (a single char space on the screen)
type Layer struct {
Grid [][]Cell
Width, Height, X, Y, MaxX, MaxY int
}
A Layer is a drawable area in a canvas that carries its own origin coords
and max boundaries.
func NewLayer(width, height, x, y int) Layer
NewLayer creates a new layer with the specified size at the specified offset
At returns the cell at the given coords, or nil if no such position exists
@todo write test
Clear will set each of the runes in the layer to zero and the style to the default
Each will pass each cell in the grid to the provided closure
InBounds returns true if cell is inside layer bounds
func (l *Layer) Normalize(minX, minY, maxX, maxY int) (nMinX, nMinY, nMaxX, nMaxY int)
Normalize will take a set of rect coords and normalize them to be legal layer coordinates.
SetRune will set the Cell at the given coordinates with the provided rune.
Screen bridges methods used in a tcell screen to methods used by the tools. This allows for easier faking.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.