package letterbox
import "git.teletypegames.org/engines/inkwell/inkbase/letterbox"
Package letterbox is an inkbase widget: Letterbox, the pair of bars that crop the picture top and bottom while a cutscene plays. It sits on the scene layer, over the picture and under the HUD, so a game that also hides its HUD for a cutscene gets the whole convention out of two registrations sharing one condition. Bar is each bar's height (18 when zero) and Color its colour (black when nil).
The widget reaches its game through Host, which only reports the screen size. inkwell's *Game is a Host and the root package re-exports Letterbox.
Index
Types
type Host
type Host interface { // ScreenSize is the logical screen's width and height in pixels. ScreenSize() (width, height int) }
Host is what a Letterbox needs from the game it is drawn for, the UICtx's Game. On a Game that does not implement it the bars are not drawn.
type Letterbox
type Letterbox struct { // Name is the key the widget is registered under. Name string // When gates the widget; nil shows it always. When inkbase.Condition // Bar is each bar's height in pixels; 0 means 18. Bar float64 // Color, if nil, is black. Color color.Color }
Letterbox is the pair of bars that crop the picture top and bottom while a cutscene plays. It draws over the scene and under the HUD, so a game that also hides its HUD for a cutscene gets the whole convention out of two registrations with the same condition.
func (*Letterbox) Draw
func (l *Letterbox) Draw(dst *ebiten.Image, ctx *widget.UICtx)
Draw paints one bar of height Bar across the top of the screen and one across the bottom.
func (*Letterbox) GetName
func (l *Letterbox) GetName() string
GetName returns the name the letterbox is registered under.
func (*Letterbox) Layer
func (l *Letterbox) Layer() widget.Layer
Layer puts the bars on widget.LayerScene, over the picture and under the HUD.
func (*Letterbox) Tick
func (l *Letterbox) Tick(ctx *widget.UICtx)
Tick does nothing; the bars only display.
func (*Letterbox) VisibleWhen
func (l *Letterbox) VisibleWhen() inkbase.Condition
VisibleWhen returns the condition that brings the bars in, typically "a cutscene is playing"; nil means always.