package textcard
import "git.teletypegames.org/engines/inkwell/inkbase/textcard"
Package textcard is an inkbase widget: TextCard, a block of lines centred on the screen — a title card, a credits page that does not roll, an apology. It is the plainest thing a Stage that is not the world can be made of, and needs no tree, no rows and no navigation. An empty Text in Lines is a blank line, and Backdrop fills the screen behind the block.
The widget reaches its game through Host: the screen and the Colors. inkwell's *Game is a Host, with the theme's end card tokens, and the root package re-exports TextCard.
Index
Types
type Colors
type Colors struct { BG color.Color Text color.Color }
Colors is the palette a TextCard draws with: BG for the backdrop, Text for the lines.
type Host
type Host interface { widget.Screen // TextCardColors is the palette the card draws with. TextCardColors() Colors }
Host is what a TextCard needs from the game it is drawn for, the UICtx's Game. On a Game that does not implement it the card draws nothing.
type TextCard
type TextCard struct { // Name is the key the widget is registered under. Name string // When gates the widget; nil shows it always. When inkbase.Condition // Lines are printed one under another, each resolved into the player's // language. An empty Text is a blank line, which is how a block is // spaced. Lines []inkbase.Text // Align is how each line sits against the others; the block itself is // always centred on the screen. Align inkbase.Align // LineHeight is a line's height in pixels; 0 gives the glyph height + 2. LineHeight int // Backdrop fills the screen behind the block with [Colors].BG. False // leaves whatever the Stage put there. Backdrop bool }
TextCard is a block of lines centred on the screen — a credits roll that does not roll, a title card, an apology. It is the plainest thing a Stage that is not the world can be made of, and it needs no tree, no rows and no navigation to be one.
func (*TextCard) Draw
func (c *TextCard) Draw(dst *ebiten.Image, ctx *widget.UICtx)
Draw paints the Backdrop when asked, then the Lines as a block centred on the screen, each placed by Align within the width of the widest.
func (*TextCard) GetName
func (c *TextCard) GetName() string
GetName returns the name the card is registered under.
func (*TextCard) Layer
func (c *TextCard) Layer() widget.Layer
Layer puts the card on widget.LayerHUD.
func (*TextCard) Tick
func (c *TextCard) Tick(ctx *widget.UICtx)
Tick does nothing; the card only displays.
func (*TextCard) VisibleWhen
func (c *TextCard) VisibleWhen() inkbase.Condition
VisibleWhen returns the condition that switches the card on; nil means always.