package endcard
import "git.teletypegames.org/engines/inkwell/inkbase/endcard"
Package endcard is an inkbase widget: EndCard, a full-screen overlay with the host's end text centred on it, shown whenever that text is not empty. While it is up it swallows every click, so nothing underneath reacts.
The widget reaches its game through Host: the screen, the input, the end text and the Colors. inkwell's *Game is a Host — its end text is what ShowEnd put up, its colours the theme's end card tokens — and the root package re-exports EndCard; a game built on inkbase alone implements Host itself.
Index
Types
type Colors
type Colors struct { BG color.Color Text color.Color }
Colors is the palette an EndCard draws with: BG fills the screen, Text is the message.
type EndCard
type EndCard struct { // Name is the key the widget is registered under. Name string // When gates the widget; nil shows it always. When inkbase.Condition }
EndCard is a fullscreen overlay with the host's end text centred on it, up whenever that text is not empty — in inkwell, once the ShowEnd action fires. While it is up it consumes every click so nothing underneath reacts.
func (*EndCard) Draw
func (e *EndCard) Draw(dst *ebiten.Image, ctx *widget.UICtx)
Draw fills the screen and prints the end text centred on it, while the end card is up.
func (*EndCard) GetName
func (e *EndCard) GetName() string
GetName returns the name the card is registered under.
func (*EndCard) Layer
func (e *EndCard) Layer() widget.Layer
Layer puts the card on widget.LayerCurtain, over the whole game.
func (*EndCard) Tick
func (e *EndCard) Tick(ctx *widget.UICtx)
Tick consumes every left and right click while the end card is up.
func (*EndCard) VisibleWhen
func (e *EndCard) VisibleWhen() inkbase.Condition
VisibleWhen returns the condition that switches the card on; nil means always.
type Host
type Host interface { widget.Screen // WidgetInput is the frame's consume-on-use input; the card swallows // its clicks. WidgetInput() *input.Input // EndCardText is the end text; "" means the card is down. EndCardText() string // EndCardColors is the palette the card draws with. EndCardColors() Colors }
Host is what an EndCard needs from the game it is ticked and drawn for, the UICtx's Game. On a Game that does not implement it the card does nothing.