render

package
v0.0.0-...-7ba8725 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Char

type Char struct {
	Rune rune
	Style
}

A Char is a rune with a visual style associated with it

type Color

type Color struct {
	ColorMode
	Code int32
}

Color stores sufficient data to reproduce an ANSI-encodable color

func (Color) ToANSI

func (c Color) ToANSI(bg bool) string

ToANSI emits an ANSI SGR escape code for a given color

type ColorMode

type ColorMode int

ColorMode is the type of color associated with a cursor

const (
	// ColorNone is the default unset color state
	ColorNone ColorMode = iota
	// ColorBit3Normal is for the 8 default non-bright colors
	ColorBit3Normal
	// ColorBit3Bright is for the 8 default bright colors
	ColorBit3Bright
	// ColorBit8 is specified at https://en.wikipedia.org/w/index.php?title=ANSI_escape_code&oldid=873901864#8-bit
	ColorBit8
	// ColorBit24 is specified at https://en.wikipedia.org/w/index.php?title=ANSI_escape_code&oldid=873901864#24-bit
	ColorBit24
)

type Cursor

type Cursor struct {
	X, Y int
	Style
}

Cursor is Style along with position. Coordinates are relative to top left

type PositionedChar

type PositionedChar struct {
	Rune rune
	Cursor
}

A PositionedChar is a Char with a specific location on the screen

type Renderer

type Renderer struct {
	Pause  chan bool
	Resume chan bool

	DemoText string
	// contains filtered or unexported fields
}

Renderer is our simplified implemention of ncurses

func NewRenderer

func NewRenderer() *Renderer

NewRenderer returns an initialized Renderer

func (*Renderer) Debug

func (r *Renderer) Debug(s string)

Debug prints the given text to the status bar

func (*Renderer) DemoKeypress

func (r *Renderer) DemoKeypress(str string)

DemoKeypress is used for demos of 3mux

func (*Renderer) GetRune

func (r *Renderer) GetRune(x, y int) rune

GetRune returns the rune of the currentScreen at the given coordinates

func (*Renderer) HandleCh

func (r *Renderer) HandleCh(ch PositionedChar)

HandleCh places a PositionedChar in the pending screen buffer

func (*Renderer) HardRefresh

func (r *Renderer) HardRefresh()

HardRefresh force clears all cached chars

func (*Renderer) ListenToQueue

func (r *Renderer) ListenToQueue()

ListenToQueue is a blocking function that processes data sent to the RenderQueue

func (*Renderer) Resize

func (r *Renderer) Resize(w, h int)

Resize changes the size of the framebuffers to match the host terminal size

func (*Renderer) SetCursor

func (r *Renderer) SetCursor(x, y int)

SetCursor sets the position of the physical cursor

type Style

type Style struct {
	Bold, Faint, Italic, Underline, Conceal, CrossedOut bool

	Fg Color // foreground color
	Bg Color // background color
}

Style is the state of the terminal's drawing modes when printing a given character

func (*Style) Reset

func (s *Style) Reset()

Reset sets all rendering attributes of a cursor to their default values

Jump to

Keyboard shortcuts

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