title

package
v0.9.12 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 3 Imported by: 6

Documentation

Index

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

func New(text ...any) Title

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

func (title Title) ActionText() string

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

func (title Title) Duration() time.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

func (title Title) FadeInDuration() time.Duration

FadeInDuration returns the duration that the fade-in of the title takes. By default, this is a quarter of a second.

func (Title) FadeOutDuration

func (title Title) FadeOutDuration() time.Duration

FadeOutDuration returns the duration that the fade-out of the title takes.By default, this is a quarter of a second.

func (Title) Subtitle

func (title Title) Subtitle() string

Subtitle returns the subtitle of the title, as passed to SetSubtitle. Subtitle returns an empty string if no subtitle was previously set.

func (Title) Text

func (title Title) Text() string

Text returns the text of the title, as passed to New when created.

func (Title) WithActionText

func (title Title) WithActionText(text ...any) Title

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

func (title Title) WithDuration(d time.Duration) Title

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

func (title Title) WithFadeInDuration(d time.Duration) Title

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

func (title Title) WithFadeOutDuration(d time.Duration) Title

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

func (title Title) WithSubtitle(text ...any) Title

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.

Jump to

Keyboard shortcuts

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