ifs

package
v0.0.0-...-d5d5497 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Name         string
	LastUsername string
	LastPassword string
}

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

type GameContext struct {
	PreventMapInput       bool
	Zoom                  float64
	CellWidth, CellHeight int
}

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

type StateMachine interface {
	Top() State
	Pop() (State, error)
	Push(State) error
}

StateMachine is what you would expect it to be.

type TextRenderer

type TextRenderer struct {
	etxt.Renderer
	// contains filtered or unexported fields
}

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) Restore

func (t *TextRenderer) Restore()

Restore restores any saved state.

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.

Jump to

Keyboard shortcuts

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