text_display

package
v0.240209.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: CC0-1.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaxWidth = 40

Variables

This section is empty.

Functions

func PadSpace

func PadSpace(b []byte, width uint32) []byte

Types

type Devicer

type Devicer interface {
	Clear()
	// Control() Control
	// SetControl(new Control) Control
	CursorYX(y, x uint8) bool
	Write(b []byte)
}

type MockDevicer

type MockDevicer struct {
}

func (*MockDevicer) Clear

func (m *MockDevicer) Clear()

func (*MockDevicer) CursorYX

func (m *MockDevicer) CursorYX(y, x uint8) bool

func (*MockDevicer) Write

func (m *MockDevicer) Write(b []byte)

type State

type State struct {
	L1, L2 []byte
}

func (*State) Clear

func (s *State) Clear()

func (State) Copy

func (s State) Copy() State

func (State) Format

func (s State) Format(width uint32) string

func (State) String

func (s State) String() string

type TextDisplay

type TextDisplay struct {
	// contains filtered or unexported fields
}

func NewMockTextDisplay

func NewMockTextDisplay(opt *TextDisplayConfig) *TextDisplay

func NewTextDisplay

func NewTextDisplay(opt *TextDisplayConfig) (*TextDisplay, error)

func (*TextDisplay) Clear

func (td *TextDisplay) Clear()

func (*TextDisplay) JustCenter

func (td *TextDisplay) JustCenter(b []byte) []byte

sometimes returns slice into shared spaceBytes sometimes returns `b` (len>=width-1) sometimes allocates new buffer

func (*TextDisplay) Message

func (td *TextDisplay) Message(s1, s2 string, wait func())

func (*TextDisplay) PadRight

func (td *TextDisplay) PadRight(b []byte) []byte

returns `b` when len>=width otherwise pads with spaces

func (*TextDisplay) Run

func (td *TextDisplay) Run()

func (*TextDisplay) SetCodepage

func (td *TextDisplay) SetCodepage(cp string) error

func (*TextDisplay) SetDevice

func (td *TextDisplay) SetDevice(dev Devicer)

func (*TextDisplay) SetLines

func (td *TextDisplay) SetLines(line1, line2 string)

func (*TextDisplay) SetLinesBytes

func (td *TextDisplay) SetLinesBytes(b1, b2 []byte)

nil: don't change len=0: set empty

func (*TextDisplay) SetScrollDelay

func (td *TextDisplay) SetScrollDelay(d time.Duration)

func (*TextDisplay) SetUpdateChan

func (td *TextDisplay) SetUpdateChan(ch chan<- State)

func (*TextDisplay) State

func (td *TextDisplay) State() State

func (*TextDisplay) Tick

func (td *TextDisplay) Tick()

func (*TextDisplay) Translate

func (td *TextDisplay) Translate(s string) []byte

type TextDisplayConfig

type TextDisplayConfig struct {
	Codepage    string
	ScrollDelay time.Duration
	Width       uint32
}

Jump to

Keyboard shortcuts

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