Documentation
¶
Overview ¶
WARN:NOTES in this files are important! otehrwise it'll re-render exponentially on type!
Index ¶
- Constants
- Variables
- func ApplySettings()
- func CloseDebugLog()
- func DebugLog(format string, args ...interface{})
- func GetColor(colorName string) lipgloss.Color
- func GetConfigDir() (string, error)
- func GetGradientIndex(tickTime time.Time) int
- func GetRandomText() string
- func GetRefreshInterval() time.Duration
- func GetSampleText() string
- func GetSettingsFilePath() (string, error)
- func GetThemePath(themeName string) string
- func GlobalTickCmd(interval time.Duration) tea.Cmd
- func HandleGlobalTick(lastTick time.Time, msg GlobalTickMsg) (time.Time, bool, tea.Cmd)
- func InitDebugLog()
- func InitGlobalTick() tea.Cmd
- func InitSettings()
- func InitTheme()
- func ListAvailableThemes() []string
- func LoadSettings() error
- func LoadTheme(themeNameOrPath string) error
- func ReloadTheme(filePath string) error
- func RenderGradientOverlay(text string, baseStyle lipgloss.Style, tickTime time.Time) string
- func RenderGradientText(text string, tickTime time.Time) string
- func RunStartScreen()
- func RunTypingGame()
- func SaveSettings() error
- func ShowSettings() error
- func ShowWelcomeScreen() bool
- func StartLoading(cmd *cobra.Command, args []string)
- func StartLoadingWithOptions(cursorTypeStr string)
- func StartTypingGame(width, height int, text string) tea.Model
- func UpdateSettings(settings UserSettings) error
- func UpdateStyles()
- type BibleSource
- type Cursor
- type CursorType
- type EndGameModel
- type GlobalTickMsg
- type LoadingModel
- type SettingsItem
- type SettingsModel
- type Spinner
- type StartGameMsg
- type StartScreenModel
- type Text
- func (t *Text) Backspace()
- func (t *Text) CurrentWord() *Word
- func (t *Text) GetCursorPos() int
- func (t *Text) GetText() string
- func (t *Text) IsComplete() bool
- func (t *Text) Render() string
- func (t *Text) SetCursorType(cursorType CursorType)
- func (t *Text) Stats() (total, correct, errors int)
- func (t *Text) Type(r rune)
- func (t *Text) Update()
- type TextSource
- type ThemeColors
- type TypingModel
- type UserSettings
- type WelcomeModel
- type Word
- func (w *Word) Backspace() bool
- func (w *Word) HasStarted() bool
- func (w *Word) IsComplete() bool
- func (w *Word) IsSpace() bool
- func (w *Word) Render(showCursor bool) string
- func (w *Word) SetActive(active bool)
- func (w *Word) SetCursorType(cursorType CursorType)
- func (w *Word) Skip()
- func (w *Word) Type(r rune)
- type WordState
- type ZenQuotesSource
Constants ¶
View Source
const ( GameModeNormal = "normal" GameModeSimple = "simple" TextLengthShort = "short" // 1 TextLengthMedium = "medium" // 2 TextLengthLong = "long" // 3 TextLengthVeryLong = "very long" // 5 )
View Source
const ( MenuMain int = iota MenuSettings )
View Source
const ( Padding = 2 MaxWidth = 80 )
View Source
const ( SampleTextNormal = "" /* 261-byte string literal not displayed */ SampleTextNormalWithNumbers = "The quick brown fox jumps over the 5 lazy dogs. In 2023, " SampleTextSimple = "" /* 263-byte string literal not displayed */ SampleTextSimpleWithNumbers = "" /* 307-byte string literal not displayed */ )
View Source
const ( ThemeDefault = "default" ThemeDark = "dark" ThemeMonochrome = "monochrome" )
Variables ¶
View Source
var BlockCursorStyle lipgloss.Style
View Source
var CenterStyle lipgloss.Style
View Source
var (
DebugEnabled = false
)
View Source
var DefaultSettings = UserSettings{ ThemeName: "default", CursorType: "block", GameMode: GameModeNormal, UseNumbers: true, TextLength: TextLengthShort, HasSeenWelcome: false, RefreshRate: 10, }
View Source
var DefaultTheme = ThemeColors{
HelpText: "#626262",
Timer: "#FFDB58",
Border: "#7F9ABE",
TextDim: "#555555",
TextPreview: "#7F9ABE",
TextCorrect: "#00FF00",
TextError: "#FF0000",
TextPartialError: "#FF8C00",
CursorFg: "#FFFFFF",
CursorBg: "#00AAFF",
CursorUnderline: "#00AAFF",
Padding: "#888888",
}
View Source
var DimStyle lipgloss.Style
View Source
var EndGameAccuracyStyle lipgloss.Style
View Source
var EndGameCorrectStyle lipgloss.Style
View Source
var EndGameErrorsStyle lipgloss.Style
View Source
var EndGameOptionStyle lipgloss.Style
View Source
var EndGameSelectedOptionStyle lipgloss.Style
View Source
var EndGameStatsBoxStyle lipgloss.Style
View Source
var EndGameTitleStyle lipgloss.Style
View Source
var EndGameWordsStyle lipgloss.Style
View Source
var EndGameWpmStyle lipgloss.Style
View Source
var ErrorStyle lipgloss.Style
View Source
var GradientColors = []string{
"#00ADD8",
"#15B5DB",
"#2ABEDE",
"#3FC6E1",
"#54CFE4",
"#69D7E7",
"#7EE0EA",
"#93E8ED",
"#A8F1F0",
"#BDF9F3",
"#D2FFF6",
"#E7FFF9",
"#FCFFFC",
"#E7FFF9",
"#D2FFF6",
"#BDF9F3",
"#A8F1F0",
"#93E8ED",
"#7EE0EA",
"#69D7E7",
"#54CFE4",
"#3FC6E1",
"#2ABEDE",
"#15B5DB",
}
View Source
var HelpStyle func(...string) string
View Source
var HintStyle func(...string) string
View Source
var InputStyle lipgloss.Style
View Source
var PadStyle lipgloss.Style
View Source
var PartialErrorStyle lipgloss.Style
View Source
var PreviewStyle lipgloss.Style
View Source
var SettingsDetailsStyle lipgloss.Style
View Source
var SettingsHelpStyle lipgloss.Style
View Source
var SettingsListStyle lipgloss.Style
View Source
var SettingsStyle func(...string) string
View Source
var SettingsTitleStyle lipgloss.Style
View Source
var TextContainerStyle lipgloss.Style
View Source
var TextToTypeStyle lipgloss.Style
View Source
var TimerStyle lipgloss.Style
View Source
var UnderlineCursorStyle lipgloss.Style
Functions ¶
func ApplySettings ¶
func ApplySettings()
func CloseDebugLog ¶
func CloseDebugLog()
func GetConfigDir ¶
func GetGradientIndex ¶
func GetRandomText ¶
func GetRandomText() string
func GetRefreshInterval ¶
func GetSampleText ¶
func GetSampleText() string
func GetSettingsFilePath ¶
func GetThemePath ¶
func HandleGlobalTick ¶
func InitDebugLog ¶
func InitDebugLog()
func InitGlobalTick ¶
func InitSettings ¶
func InitSettings()
func ListAvailableThemes ¶
func ListAvailableThemes() []string
func LoadSettings ¶
func LoadSettings() error
func ReloadTheme ¶
func RenderGradientOverlay ¶
func RunStartScreen ¶
func RunStartScreen()
func RunTypingGame ¶
func RunTypingGame()
func SaveSettings ¶
func SaveSettings() error
func ShowSettings ¶ added in v1.0.3
func ShowSettings() error
func ShowWelcomeScreen ¶
func ShowWelcomeScreen() bool
func StartLoading ¶
func StartLoadingWithOptions ¶
func StartLoadingWithOptions(cursorTypeStr string)
func UpdateSettings ¶
func UpdateSettings(settings UserSettings) error
func UpdateStyles ¶
func UpdateStyles()
Types ¶
type BibleSource ¶
type BibleSource struct {
URL string
}
func NewBibleSource ¶
func NewBibleSource() *BibleSource
func (*BibleSource) FetchText ¶
func (s *BibleSource) FetchText() (string, error)
func (*BibleSource) FormatText ¶
func (s *BibleSource) FormatText(text string) string
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
func NewCursor ¶
func NewCursor(style CursorType) *Cursor
type CursorType ¶
type CursorType int
const ( BlockCursor CursorType = iota UnderlineCursor )
var DefaultCursorType CursorType = BlockCursor
type EndGameModel ¶
type EndGameModel struct {
// contains filtered or unexported fields
}
func NewEndGameModel ¶
func NewEndGameModel(wpm, accuracy float64, words, correct, errors int, text string) *EndGameModel
func (*EndGameModel) Init ¶
func (m *EndGameModel) Init() tea.Cmd
func (*EndGameModel) View ¶
func (m *EndGameModel) View() string
type GlobalTickMsg ¶
type LoadingModel ¶
type LoadingModel struct {
// contains filtered or unexported fields
}
func NewLoadingModel ¶
func NewLoadingModel() *LoadingModel
func (*LoadingModel) Init ¶
func (m *LoadingModel) Init() tea.Cmd
func (*LoadingModel) View ¶
func (m *LoadingModel) View() string
type SettingsItem ¶ added in v1.0.3
type SettingsItem struct {
// contains filtered or unexported fields
}
func (SettingsItem) Description ¶ added in v1.0.3
func (i SettingsItem) Description() string
func (SettingsItem) FilterValue ¶ added in v1.0.3
func (i SettingsItem) FilterValue() string
func (SettingsItem) Title ¶ added in v1.0.3
func (i SettingsItem) Title() string
type SettingsModel ¶ added in v1.0.3
type SettingsModel struct {
// contains filtered or unexported fields
}
func (SettingsModel) Init ¶ added in v1.0.3
func (m SettingsModel) Init() tea.Cmd
func (SettingsModel) View ¶ added in v1.0.3
func (m SettingsModel) View() string
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
func NewSpinner ¶
func NewSpinner() *Spinner
type StartGameMsg ¶
type StartGameMsg struct {
// contains filtered or unexported fields
}
type StartScreenModel ¶
type StartScreenModel struct {
// contains filtered or unexported fields
}
func NewStartScreenModel ¶
func NewStartScreenModel() *StartScreenModel
func (*StartScreenModel) Init ¶
func (m *StartScreenModel) Init() tea.Cmd
func (*StartScreenModel) View ¶
func (m *StartScreenModel) View() string
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
func (*Text) CurrentWord ¶
func (*Text) GetCursorPos ¶
func (*Text) IsComplete ¶
func (*Text) SetCursorType ¶
func (t *Text) SetCursorType(cursorType CursorType)
type TextSource ¶
type ThemeColors ¶
type ThemeColors struct { HelpText string `yaml:"help_text"` Timer string `yaml:"timer"` Border string `yaml:"border"` TextDim string `yaml:"text_dim"` TextPreview string `yaml:"text_preview"` TextCorrect string `yaml:"text_correct"` TextError string `yaml:"text_error"` TextPartialError string `yaml:"text_partial_error"` CursorFg string `yaml:"cursor_fg"` CursorBg string `yaml:"cursor_bg"` CursorUnderline string `yaml:"cursor_underline"` Padding string `yaml:"padding"` }
var CurrentTheme ThemeColors
type TypingModel ¶
type TypingModel struct {
// contains filtered or unexported fields
}
func NewTypingModel ¶
func NewTypingModel(width, height int, text string) *TypingModel
func (*TypingModel) Init ¶
func (m *TypingModel) Init() tea.Cmd
func (*TypingModel) View ¶
func (m *TypingModel) View() string
type UserSettings ¶
type UserSettings struct { ThemeName string `json:"theme"` CursorType string `json:"cursor_type"` GameMode string `json:"game_mode"` UseNumbers bool `json:"use_numbers"` TextLength string `json:"text_length"` HasSeenWelcome bool `json:"has_seen_welcome"` RefreshRate int `json:"refresh_rate"` // NOTE:in frames per second not tick }
var CurrentSettings UserSettings
type WelcomeModel ¶
type WelcomeModel struct {
// contains filtered or unexported fields
}
func NewWelcomeModel ¶
func NewWelcomeModel() *WelcomeModel
func (*WelcomeModel) Init ¶
func (m *WelcomeModel) Init() tea.Cmd
func (*WelcomeModel) View ¶
func (m *WelcomeModel) View() string
type Word ¶
type Word struct {
// contains filtered or unexported fields
}
func (*Word) HasStarted ¶
func (*Word) IsComplete ¶
func (*Word) SetCursorType ¶
func (w *Word) SetCursorType(cursorType CursorType)
type ZenQuotesSource ¶
type ZenQuotesSource struct {
URL string
}
func NewZenQuotesSource ¶
func NewZenQuotesSource() *ZenQuotesSource
func (*ZenQuotesSource) FetchText ¶
func (s *ZenQuotesSource) FetchText() (string, error)
func (*ZenQuotesSource) FormatText ¶
func (s *ZenQuotesSource) FormatText(text string) string
Click to show internal directories.
Click to hide internal directories.