Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type DrawContext ¶
type DrawContext struct { Txt *TextRenderer Screen *ebiten.Image UI *DrawContextUI Game *GameContext }
DrawContext contains various structures that are useful during Draw calls.
type DrawContextUI ¶
type DrawContextUI struct {
Width, Height int
//
HeadlineFace font.Face
BodyCopyFace font.Face
ButtonImage *widget.ButtonImage
ButtonTextColor *widget.ButtonTextColor
ButtonPadding widget.Insets
TextInputColor *widget.TextInputColor
TextInputImage *widget.TextInputImage
TextInputPadding widget.Insets
//
ItemInfoBackgroundImage *eimage.NineSlice
}
DrawContextUI is a structure containing the UI styling and data.
func (*DrawContextUI) Init ¶
func (ui *DrawContextUI) Init(txt *TextRenderer)
Init sets up the necessary data structuers, such as fonts, styling, images, etc.
type GameContext ¶
GameContext provides context specific to the game world.
type RunContext ¶
type RunContext struct { Cfg *Configuration Sm StateMachine Txt *TextRenderer UI *DrawContextUI Game *GameContext }
RunContext provides various structures useful during Update calls.
type State ¶
type State interface { // Leave is called on a State when another State is pushed into the state machine. Leave() error // Return is called on the previous state from the top-level state when Pop is called. Return(interface{}) error // Begin is called on a State when it is pushed into the state machine. Begin(RunContext) error // Update is called once per tick. Update(RunContext) error // Draw is called when drawing occurs. Draw(DrawContext) // End is called on a State when it is popped. End() (interface{}, error) }
State is what a state machine expects.
type StateMachine ¶
StateMachine is what you would expect it to be.
type TextRenderer ¶
TextRenderer is a wrapper around etxt.Renderer with some additional functionality.
func NewTextRenderer ¶
func NewTextRenderer(r *etxt.Renderer) *TextRenderer
func (*TextRenderer) DrawWithOutline ¶
func (t *TextRenderer) DrawWithOutline(target etxt.TargetImage, text string, x, y int)
DrawWithOutline draws a very poor outline. It should potentially be replaced with a "DrawWithShadow" call that guassian(or other) blurs it and stores that blur in an image for future calls.
func (*TextRenderer) GetOutlineColor ¶
func (t *TextRenderer) GetOutlineColor() color.Color
GetOutlineColor returns the current outline color.
func (*TextRenderer) Save ¶
func (t *TextRenderer) Save()
Save saves the text renderer's state. This includes font, color, size, scale, blend mode, align, and outline color.
func (*TextRenderer) SetOutlineColor ¶
func (t *TextRenderer) SetOutlineColor(c color.Color)
SetOutlineColor sets the color to use for outlines durng DrawWithOutline.