imgui

package
v0.0.0-...-9360465 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// Escape character
	ESC = '\x1b'
	// Control Sequence Introducer
	CSI = string(ESC) + "["
)
View Source
const (
	BLACK                  = "#0c0c0c"
	RED                    = "#cc0000"
	GREEN                  = "#4e9a06"
	YELLOW                 = "#c4a000"
	BLUE                   = "#3465a4"
	PURPLE                 = "#75507b"
	CYAN                   = "#06989a"
	WHITE                  = "#d3d7cf"
	GRAY                   = "#81858d"
	BRIGHT_BLACK           = "#555753"
	BRIGHT_RED             = "#ef2929"
	BRIGHT_GREEN           = "#8ae234"
	BRIGHT_YELLOW          = "#fce94f"
	BRIGHT_BLUE            = "#729fcf"
	BRIGHT_PURPLE          = "#ad7fa8"
	BRIGHT_CYAN            = "#34e2e2"
	BRIGHT_WHITE           = "#eeeeec"
	BACKGROUND             = "#0c0c0c"
	BACKGROUND_ODD         = "#0d0d0d"
	BACKGROUND_HIGHLIGHTED = "#2a2a2a"
	FOREGROUND             = "#eeeeec"
	CURSOR                 = "#bbbbbb"
	SELECTION_BACKGROUND   = "#b5d5ff"
)
View Source
const (
	ResetSeq = "0"
)

Variables

View Source
var ANSI_COLORS = []string{} /* 256 elements not displayed */
View Source
var ANSI_STYLES = []Style{}/* 256 elements not displayed */
View Source
var STYLES = []Style{
	NewStyle(WHITE, BACKGROUND_HIGHLIGHTED, true),
	NewStyle(WHITE, "#1a1a1a", true),
	NewStyle(WHITE, GREEN, true),
	NewAnsiStyle(220, 0, true),
	NewStyle(WHITE, BACKGROUND_HIGHLIGHTED, true),

	NewStyle("#a21a1a", "", true),
	NewStyle("#d56f1a", "", true),
	NewStyle("#1a7091", "", true),
	NewStyle("#287114", "", true),
	NewStyle("#389a1d", "", true),

	NewAnsiStyle(238, 0, true),

	NewStyle(WHITE, RED, true),
	NewStyle(WHITE, BLUE, true),
}

Functions

func Run

func Run(app App)

Types

type App

type App interface {
	Render(gui *GUI)
}

type Buffer

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

func NewBuffer

func NewBuffer(w, h int) *Buffer

func (*Buffer) At

func (b *Buffer) At(x, y int) (rune, TextStyle)

func (*Buffer) Clear

func (b *Buffer) Clear()

func (*Buffer) CurrentPos

func (b *Buffer) CurrentPos() Vec

func (*Buffer) Debug

func (b *Buffer) Debug()

func (*Buffer) EndCell

func (b *Buffer) EndCell()

func (*Buffer) EndGroup

func (b *Buffer) EndGroup()

func (*Buffer) EndRow

func (b *Buffer) EndRow()

func (*Buffer) HasFocus

func (b *Buffer) HasFocus(x, y int) bool

func (*Buffer) IsInside

func (b *Buffer) IsInside(x, y, w, h int) bool

func (*Buffer) PopID

func (b *Buffer) PopID()

func (*Buffer) PushID

func (b *Buffer) PushID(s string)

func (*Buffer) Set

func (b *Buffer) Set(x, y int, c rune, style TextStyle)

func (*Buffer) SetFocus

func (b *Buffer) SetFocus()

func (*Buffer) StartCell

func (b *Buffer) StartCell()

func (*Buffer) StartCellWithHeader

func (b *Buffer) StartCellWithHeader(title string)

func (*Buffer) StartGroup

func (b *Buffer) StartGroup()

func (*Buffer) StartRow

func (b *Buffer) StartRow()

func (*Buffer) String

func (b *Buffer) String() string

func (*Buffer) Write

func (b *Buffer) Write(txt string, style TextStyle, inline bool)

func (*Buffer) WriteEx

func (b *Buffer) WriteEx(x, y int, txt string, style TextStyle)

type ButtonStyle

type ButtonStyle int
const (
	OK_BUTTON      ButtonStyle = 3
	CANCEL_BUTTON  ButtonStyle = 12
	DEFAULT_BUTTON ButtonStyle = 13
)

type Color

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

func Hex

func Hex(scol string) Color

type DrawCommand

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

type GUI

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

func NewGUI

func NewGUI(w, h int) *GUI

func (*GUI) Begin

func (g *GUI) Begin()

func (*GUI) BeginMenu

func (g *GUI) BeginMenu(label string) bool

func (*GUI) BeginMenuBar

func (g *GUI) BeginMenuBar()

func (*GUI) Button

func (g *GUI) Button(text string) bool

func (*GUI) ButtonEx

func (g *GUI) ButtonEx(text string, bs ButtonStyle) bool

func (*GUI) Checkbox

func (g *GUI) Checkbox(label string, active bool) bool

func (*GUI) Debug

func (g *GUI) Debug()

func (*GUI) DropDown

func (g *GUI) DropDown(label string, lines []string, selected int, active bool) (int, bool)

func (*GUI) End

func (g *GUI) End() string

func (*GUI) EndCell

func (g *GUI) EndCell()

func (*GUI) EndGroup

func (g *GUI) EndGroup()

func (*GUI) EndMenu

func (g *GUI) EndMenu()

func (*GUI) EndMenuBar

func (g *GUI) EndMenuBar()

func (*GUI) EndRow

func (g *GUI) EndRow()

func (*GUI) Input

func (g *GUI) Input(label, text string, active bool, size int) (string, bool)

func (*GUI) IntSlider

func (g *GUI) IntSlider(label string, min, max, value, steps int) int

func (*GUI) MenuItem

func (g *GUI) MenuItem(label string) bool

func (*GUI) Radio

func (g *GUI) Radio(label string, entries []string, selected int) int

func (*GUI) Selection

func (g *GUI) Selection(label string, lines []string, selected int) int

Selection writes the label with an down and up arrow and the selected text Returns the index of the selected item

func (*GUI) SendKey

func (g *GUI) SendKey(s string)

func (*GUI) SetMouseEvent

func (g *GUI) SetMouseEvent(e tea.MouseEvent)

func (*GUI) SetMousePos

func (g *GUI) SetMousePos(e tea.MouseEvent)

func (*GUI) StartCell

func (g *GUI) StartCell()

func (*GUI) StartCellWithHeader

func (g *GUI) StartCellWithHeader(title string)

func (*GUI) StartGroup

func (g *GUI) StartGroup()

func (*GUI) StartRow

func (g *GUI) StartRow()

func (*GUI) StyledText

func (g *GUI) StyledText(text string, st TextStyle)

func (*GUI) Table

func (g *GUI) Table(rt *table.Table)

func (*GUI) Text

func (g *GUI) Text(text string)
type Menu struct {
	// contains filtered or unexported fields
}

type Stack

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

func (*Stack) IsEmpty

func (st *Stack) IsEmpty() bool

func (*Stack) Pop

func (st *Stack) Pop()

func (*Stack) Push

func (st *Stack) Push(s string)

func (*Stack) Top

func (st *Stack) Top() string

type Style

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

func NewAnsiStyle

func NewAnsiStyle(f, b int, bld bool) Style

func NewStyle

func NewStyle(f, b string, bld bool) Style

func (Style) Background

func (s Style) Background(b string) Style

func (Style) Convert

func (s Style) Convert(t string) string

func (Style) Debug

func (s Style) Debug() string

type TextStyle

type TextStyle int
const (
	NO_STYLE             TextStyle = 0
	INPUT_ACTIVE_STYLE   TextStyle = 1
	INPUT_STYLE          TextStyle = 2
	OK_BUTTON_STYLE      TextStyle = 3
	HEADER_STYLE         TextStyle = 4
	ARROW_STYLE          TextStyle = 5
	TABLE_RED            TextStyle = 6
	TABLE_ORANGE         TextStyle = 7
	TABLE_BLUE           TextStyle = 8
	TABLE_GREEN          TextStyle = 9
	TABLE_LIGHT_GREEN    TextStyle = 10
	BORDER               TextStyle = 11
	CANCEL_BUTTON_STYLE  TextStyle = 12
	DEFAULT_BUTTON_STYLE TextStyle = 13
)

type Vec

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

func (Vec) Matches

func (v Vec) Matches(x, y int) bool

Jump to

Keyboard shortcuts

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