components

package
v0.2.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GameKeyMap

type GameKeyMap struct {
	ForceQuit        key.Binding
	Exit             key.Binding
	Help             key.Binding
	Left             key.Binding
	Right            key.Binding
	Clockwise        key.Binding
	CounterClockwise key.Binding
	SoftDrop         key.Binding
	HardDrop         key.Binding
	Hold             key.Binding
}

func ConstructGameKeyMap

func ConstructGameKeyMap(keys *config.Keys) *GameKeyMap

func (*GameKeyMap) FullHelp

func (k *GameKeyMap) FullHelp() [][]key.Binding

func (*GameKeyMap) ShortHelp

func (k *GameKeyMap) ShortHelp() []key.Binding

type GameStyles

type GameStyles struct {
	Playfield           lipgloss.Style
	EmptyCell           lipgloss.Style
	TetriminoCellStyles map[byte]lipgloss.Style
	GhostCell           lipgloss.Style
	Hold                holdStyles
	Information         lipgloss.Style
	RowIndicator        lipgloss.Style
	Bag                 lipgloss.Style
	CellChar            cellCharacters
}

func CreateGameStyles

func CreateGameStyles(theme *config.Theme) *GameStyles

type HPickerModel

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

HPickerModel is the model for the horizontal picker component.

func NewHPickerModel

func NewHPickerModel(options []KeyValuePair, opts ...Option) *HPickerModel

func (*HPickerModel) GetSelection

func (m *HPickerModel) GetSelection() KeyValuePair

func (*HPickerModel) Init

func (m *HPickerModel) Init() tea.Cmd

func (*HPickerModel) Next

func (m *HPickerModel) Next()

Next is a helper function for navigating one option forward. It will not go beyond the last option (i.e. len(options) - 1).

func (*HPickerModel) Prev

func (m *HPickerModel) Prev()

Prev is a helper function for navigating one option backward. It will not go page beyond the first option (i.e. option 0).

func (*HPickerModel) Update

func (m *HPickerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update is the Tea update function which binds keystrokes to pagination.

func (*HPickerModel) View

func (m *HPickerModel) View() string

View renders the cursor to a string.

type KeyValuePair

type KeyValuePair struct {
	Key   string
	Value any
}

type Option

type Option func(*HPickerModel)

func WithRange

func WithRange(minValue, maxValue int) Option

type TextInputModel

type TextInputModel struct {
	Child textinput.Model
}

func NewTextInputModel

func NewTextInputModel(placeholder string, width int, charLimit int) TextInputModel

func (TextInputModel) Init

func (m TextInputModel) Init() tea.Cmd

func (TextInputModel) Update

func (m TextInputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (TextInputModel) View

func (m TextInputModel) View() string

Jump to

Keyboard shortcuts

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