Documentation
¶
Index ¶
- Constants
- type AdventureView
- func (av *AdventureView) RenderScreen() string
- func (av *AdventureView) SetInfo(info string)
- func (av *AdventureView) SetLevel(level int)
- func (av *AdventureView) SetMode(mode string)
- func (av *AdventureView) SetPlayer(player string)
- func (av *AdventureView) SetStats(keystrokes int, time int)
- func (av *AdventureView) UpdateGridDimensions() (int, int)
- type BaseView
- type ButtonConfig
- type ButtonHandler
- type Content
- type ContentView
- type GameMap
- type Menu
- type MenuView
- type SelectionView
- type TableView
- func (tv *TableView) Init() tea.Cmd
- func (tv *TableView) SetColumns(columns []table.Column)
- func (tv *TableView) SetOnSelect(onSelect func(index int) tea.Cmd)
- func (tv *TableView) SetRows(rows []table.Row)
- func (tv *TableView) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (tv *TableView) View() string
- type View
Constants ¶
const ( MinLevelWidth = 10 MinPlayerWidth = 10 + models.PlayerNameMaxLength MinModeWidth = 16 MinStatsWidth = 30 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdventureView ¶
type AdventureView struct {
Size tea.WindowSizeMsg
Level components.TextDisplay
Player components.TextDisplay
Mode components.TextDisplay
Stats components.TextDisplay
Info components.TextDisplay
GameMap GameMap
Help []key.Binding
}
AdventureView represents the adventure mode view
func InitializeAdventureView ¶
func InitializeAdventureView() AdventureView
InitializeAdventureView creates a new instance of AdventureView
func (*AdventureView) RenderScreen ¶
func (av *AdventureView) RenderScreen() string
RenderScreen renders the adventure mode screen
func (*AdventureView) SetInfo ¶
func (av *AdventureView) SetInfo(info string)
SetInfo sets the info text
func (*AdventureView) SetLevel ¶
func (av *AdventureView) SetLevel(level int)
SetLevel sets the level text
func (*AdventureView) SetMode ¶
func (av *AdventureView) SetMode(mode string)
SetMode sets the mode text
func (*AdventureView) SetPlayer ¶
func (av *AdventureView) SetPlayer(player string)
SetPlayer sets the player text
func (*AdventureView) SetStats ¶
func (av *AdventureView) SetStats(keystrokes int, time int)
SetStats sets the stats text with keystrokes and time
func (*AdventureView) UpdateGridDimensions ¶
func (av *AdventureView) UpdateGridDimensions() (int, int)
UpdateGridDimensions updates the grid dimensions
type BaseView ¶
type BaseView struct {
// contains filtered or unexported fields
}
BaseView represents the base structure for a views component it contains the window size message, controls, help model, and header
func NewBaseView ¶
NewBaseView creates a new instance of BaseView with the specified title
func (*BaseView) Controls ¶
func (bv *BaseView) Controls() components.Controls
Controls returns the Controls associated with the BaseView
type ButtonConfig ¶
type ButtonConfig struct {
// Label represents the text displayed on the button.
Label string
// Inactive determines if the button is rendered.
Inactive bool
}
ButtonConfig represents the configuration for a button component
type ButtonHandler ¶
type ButtonHandler interface {
// HandleSelection handles the selection of a button
HandleSelection() tea.Cmd
}
ButtonHandler defines an interface for handling button selections
type Content ¶
Content represents an interface that extends the View interface it provides a method to set the content of the implementing type
type ContentView ¶
type ContentView struct {
*BaseView
// contains filtered or unexported fields
}
ContentView represents a views component that embeds the BaseView struct and includes a content field to manage the content
func NewContentView ¶
func NewContentView(title string) *ContentView
NewContentView returns a new ContentView instance
func (*ContentView) RenderSections ¶
func (cv *ContentView) RenderSections(sections []models.Section) string
RenderSections takes a slice of Section structs and returns a formatted string representation
func (*ContentView) SetContent ¶
func (cv *ContentView) SetContent(content string)
SetContent sets the content of the ContentView
func (*ContentView) View ¶
func (cv *ContentView) View() string
View renders the ContentView with a fixed title and a scrollable content area
type Menu ¶
type Menu interface {
View
ButtonHandler
}
Menu represents an interface that extends the View interface it provides a method to handle button selection
type MenuView ¶
type MenuView struct {
*BaseView
// contains filtered or unexported fields
}
MenuView represents a views component that embeds the BaseView struct and includes a Buttons field to manage the buttons
func NewBaseMenu ¶
func NewBaseMenu(subtitle string, buttonConfigs []ButtonConfig) *MenuView
NewBaseMenu returns a new MenuView instance with the provided subtitle and button configurations
func (*MenuView) CurrentButton ¶
func (mv *MenuView) CurrentButton() *components.Button
CurrentButton returns the currently selected button
func (*MenuView) UpdateButtonState ¶
UpdateButtonState updates the state of a button
type SelectionView ¶
type SelectionView struct {
InsertControls cl.InsertControls
Help help.Model
TextInput *textinput.Model
List *cl.List
// contains filtered or unexported fields
}
SelectionView is a view that displays a list of items and allows the user to select one of them. It also allows the user to insert a new item.
func NewSelectionView ¶
func NewSelectionView( subtitle string, list *cl.List, textInput *textinput.Model, onSelect func(item cl.Item) tea.Cmd, onInsert func() tea.Cmd, ) *SelectionView
NewSelectionView creates a new SelectionView
func (*SelectionView) Init ¶
func (sv *SelectionView) Init() tea.Cmd
func (*SelectionView) SelectionControls ¶
func (sv *SelectionView) SelectionControls() cl.SelectionControls
SelectionControls returns the selection controls
func (*SelectionView) View ¶
func (sv *SelectionView) View() string
type TableView ¶
type TableView struct {
// contains filtered or unexported fields
}
TableView represents a view that displays a table using the bubbles table component
func NewTableView ¶
NewTableView creates a new TableView
func (*TableView) SetColumns ¶
SetColumns sets the columns of the TableView
func (*TableView) SetOnSelect ¶
SetOnSelect sets the onSelect function