Documentation ¶
Index ¶
- type Title
- func (title Title) ActionText() string
- func (title Title) Duration() time.Duration
- func (title Title) FadeInDuration() time.Duration
- func (title Title) FadeOutDuration() time.Duration
- func (title Title) Subtitle() string
- func (title Title) Text() string
- func (title Title) WithActionText(text ...any) Title
- func (title Title) WithDuration(d time.Duration) Title
- func (title Title) WithFadeInDuration(d time.Duration) Title
- func (title Title) WithFadeOutDuration(d time.Duration) Title
- func (title Title) WithSubtitle(text ...any) Title
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Title ¶
type Title struct {
// contains filtered or unexported fields
}
Title represents a title that may be sent to the player. The title will show up as large text in the middle of the screen, with optional subtitle and action text.
func New ¶
New returns a new title using the text passed. The text is formatted according to the formatting rules of fmt.Sprintln, but with no newline at the end. The title has default durations set, which will generally suffice.
func (Title) ActionText ¶
ActionText returns the action text added to the title. This text is roughly the same as sending a tip, but will synchronise with the title. By default, the action text is empty.
func (Title) Duration ¶
Duration returns the duration that the title will be visible for, without fading in or out. By default, this is two seconds.
func (Title) FadeInDuration ¶
FadeInDuration returns the duration that the fade-in of the title takes. By default, this is a quarter of a second.
func (Title) FadeOutDuration ¶
FadeOutDuration returns the duration that the fade-out of the title takes.By default, this is a quarter of a second.
func (Title) Subtitle ¶
Subtitle returns the subtitle of the title, as passed to SetSubtitle. Subtitle returns an empty string if no subtitle was previously set.
func (Title) WithActionText ¶
WithActionText sets the action text of the title. This text is roughly the same as sending a tip/popup, but will synchronise with the title. SetActionText will format the text passed using the formatting rules of fmt.Sprintln, but without newline. The new Title with the action text is returned.
func (Title) WithDuration ¶
WithDuration sets the duration that the title will be visible for without fading in or fading out. The new Title with the duration is returned.
func (Title) WithFadeInDuration ¶
WithFadeInDuration sets the duration that the title takes to fade in on the screen. The new Title with the fade-in duration is returned.
func (Title) WithFadeOutDuration ¶
WithFadeOutDuration sets the duration that the title takes to fade out of the screen. The new Title with the fade-out duration is returned.
func (Title) WithSubtitle ¶
WithSubtitle sets the subtitle of the title. The text passed will be formatted according to the formatting rules of fmt.Sprintln, but without the newline. The subtitle is shown under the title in a somewhat smaller font. The new Title with the subtitle is returned.