Documentation
¶
Index ¶
- Constants
- func RenderBoard(engine *game.Engine, styles Styles, showGhost, showGrid bool, ...) string
- func RenderHoldPanel(holdPiece *game.PieceType, holdUsed bool, styles Styles, ...) string
- func RenderNextPanel(pieces []game.PieceType, styles Styles, rainbow *theme.RainbowState) string
- func RenderPiecePreview(pt game.PieceType, t theme.Theme, rainbow *theme.RainbowState) string
- func RenderStatsPanel(scorer *game.Scorer, styles Styles) string
- type App
- type GameModel
- type GameOverModel
- type HighScoresModel
- type KeyBindsModel
- type LockTickMsg
- type MenuModel
- type PauseModel
- type RainbowTickMsg
- type Screen
- type SettingsModel
- type Styles
- type TickMsg
Constants ¶
const ( MinWidth = 60 MinHeight = 28 )
Variables ¶
This section is empty.
Functions ¶
func RenderBoard ¶
func RenderBoard(engine *game.Engine, styles Styles, showGhost, showGrid bool, rainbow *theme.RainbowState) string
RenderBoard renders the visible portion of the board with the active and ghost pieces.
func RenderHoldPanel ¶
func RenderHoldPanel(holdPiece *game.PieceType, holdUsed bool, styles Styles, rainbow *theme.RainbowState) string
RenderHoldPanel renders the hold piece panel.
func RenderNextPanel ¶
RenderNextPanel renders the next pieces preview panel.
func RenderPiecePreview ¶
RenderPiecePreview renders a small preview of a piece type.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the root Bubble Tea model.
func NewApp ¶
func NewApp(cfg *config.Config, keys *config.KeyBindings, hs *config.HighScores) App
NewApp creates the root application model.
type GameModel ¶
type GameModel struct {
// contains filtered or unexported fields
}
GameModel handles the gameplay screen.
func NewGameModel ¶
func NewGameModel(cfg *config.Config, keys *config.KeyBindings, rainbow *theme.RainbowState) GameModel
NewGameModel creates a new gameplay model.
type GameOverModel ¶
type GameOverModel struct {
// contains filtered or unexported fields
}
GameOverModel represents the game over screen.
func NewGameOverModel ¶
func NewGameOverModel(engine *game.Engine, hs *config.HighScores) GameOverModel
NewGameOverModel creates a game over model and saves the score.
func (GameOverModel) View ¶
func (m GameOverModel) View(s Styles) string
View renders the game over screen.
type HighScoresModel ¶
type HighScoresModel struct {
// contains filtered or unexported fields
}
HighScoresModel displays the high scores table.
func NewHighScoresModel ¶
func NewHighScoresModel(hs *config.HighScores, s Styles) HighScoresModel
NewHighScoresModel creates a new high scores model.
func (HighScoresModel) View ¶
func (m HighScoresModel) View(s Styles) string
View renders the high scores table.
type KeyBindsModel ¶
type KeyBindsModel struct {
// contains filtered or unexported fields
}
KeyBindsModel handles the key binding configuration screen.
func NewKeyBindsModel ¶
func NewKeyBindsModel(keys *config.KeyBindings, s Styles) KeyBindsModel
NewKeyBindsModel creates a new key bindings model.
func (KeyBindsModel) HandleKey ¶
func (m KeyBindsModel) HandleKey(msg tea.KeyMsg, keys *config.KeyBindings) KeyBindsModel
HandleKey processes a key press while listening for a new binding.
func (KeyBindsModel) Update ¶
func (m KeyBindsModel) Update(msg tea.KeyMsg, keys *config.KeyBindings) KeyBindsModel
Update handles navigation input.
func (KeyBindsModel) View ¶
func (m KeyBindsModel) View(s Styles) string
View renders the key bindings screen.
type LockTickMsg ¶
LockTickMsg checks lock delay expiration.
type MenuModel ¶
type MenuModel struct {
// contains filtered or unexported fields
}
MenuModel represents the main menu.
type RainbowTickMsg ¶
RainbowTickMsg advances the rainbow theme animation.
type SettingsModel ¶
type SettingsModel struct {
// contains filtered or unexported fields
}
SettingsModel handles the settings screen.
func NewSettingsModel ¶
func NewSettingsModel(cfg *config.Config, s Styles) SettingsModel
NewSettingsModel creates a new settings model.
func (SettingsModel) Update ¶
func (m SettingsModel) Update(msg tea.KeyMsg, cfg *config.Config) SettingsModel
Update handles settings input.
func (SettingsModel) View ¶
func (m SettingsModel) View(s Styles) string
View renders the settings screen.
type Styles ¶
type Styles struct {
Theme theme.Theme
// Base styles.
Background lipgloss.Style
Title lipgloss.Style
Subtitle lipgloss.Style
Text lipgloss.Style
Dim lipgloss.Style
Highlight lipgloss.Style
Selected lipgloss.Style
// Board styles.
BoardBorder lipgloss.Style
Cell lipgloss.Style
EmptyCell lipgloss.Style
GridCell lipgloss.Style
GhostCell lipgloss.Style
// Panel styles.
Panel lipgloss.Style
PanelTitle lipgloss.Style
// Menu styles.
MenuItem lipgloss.Style
MenuItemSelected lipgloss.Style
}
Styles holds all Lipgloss styles derived from the active theme.