drawing

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Tables = []*unicode.RangeTable{
	&greekSlice,
	&latinSlice,
	&numberSlice,
	unicode.Runic,
}

Functions

func Draw

func Draw()

Draw is the public interface of the module. Hey homes, call this to enter the matrix, g.

func DumpCharset

func DumpCharset(path string)

DumpCharset is intended to be used for debugging and will dump the charset into a text file specified with the path.

func GetCharset

func GetCharset() []rune

GetCharset returns the static set of the characters will appear. It returns the set of runes used for drawing the screen.

func SelectRand

func SelectRand() rune

func SelectRandomN

func SelectRandomN(n int) []rune

func Setup

func Setup() tcell.Screen

Setup is called in draw, fahgetabaahtit

Types

type Column

type Column struct {
	Index     int
	Content   []rune
	Raindrops []*Raindrop
}

Column represents a single character wide vertical line of cells

func (*Column) Draw

func (c *Column) Draw(s tcell.Screen)

func (*Column) PopDrop

func (c *Column) PopDrop() []*Raindrop

func (*Column) PushDrop

func (c *Column) PushDrop() []*Raindrop

func (*Column) Update

func (c *Column) Update()

type Cursor

type Cursor struct{ X, Y int }

Cursor is a screen location

func (Cursor) Above

func (c Cursor) Above(n int) Cursor

func (Cursor) Below

func (c Cursor) Below(n int) Cursor

type Layout

type Layout struct {
	W, H   int
	Cols   []*Column
	Sparks []*Spark
}

Layout represents the state of the screen

func NewLayout

func NewLayout(s tcell.Screen) *Layout

func (*Layout) Contains

func (d *Layout) Contains(c Cursor) bool

func (*Layout) Draw

func (d *Layout) Draw(s tcell.Screen)

func (Layout) IsOutOfBoundsBelow

func (d Layout) IsOutOfBoundsBelow(cursor Cursor) bool

func (*Layout) RandomCursor

func (d *Layout) RandomCursor() Cursor

func (*Layout) SetStyleAt

func (d *Layout) SetStyleAt(s tcell.Screen, cursor Cursor, newStyle tcell.Style)

func (*Layout) Sync

func (d *Layout) Sync(s tcell.Screen)

func (Layout) TotalCells

func (d Layout) TotalCells() int

func (*Layout) Update

func (d *Layout) Update()

func (Layout) VContains

func (d Layout) VContains(cursor Cursor) bool

type Raindrop

type Raindrop struct {
	Length   int
	Progress Cursor
}

Raindrop represents the moving bright green vertical area of styling

func (*Raindrop) Draw

func (r *Raindrop) Draw(s tcell.Screen)

func (*Raindrop) ParentColumn

func (r *Raindrop) ParentColumn() *Column

func (Raindrop) TailCursor

func (r Raindrop) TailCursor() Cursor

func (*Raindrop) Update

func (r *Raindrop) Update()

type Spark

type Spark struct {
	Position      Cursor
	Age, Lifespan int
}

func (*Spark) Draw

func (s *Spark) Draw(screen tcell.Screen)

func (*Spark) Update

func (s *Spark) Update()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL