ui

package
v0.0.0-...-c870227 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DoubleClickThreshold = 20

Variables

This section is empty.

Functions

This section is empty.

Types

type Selection

type Selection struct {
	Name   string
	Action func()
	Hotkey string
}

type UI

type UI struct {
	// track the layer number of the elements
	Elements map[UILayer][]*UIElement

	Draw       func(*UI, *ebiten.Image)
	HandleKeys UIKeyFunc
	Counter    uint64

	LeftClickedElements []*UIElement

	Delays []UIDelay

	// disabled so that the zero value is enabled
	Disabled bool
	// contains filtered or unexported fields
}

func (*UI) AddDelay

func (ui *UI) AddDelay(time uint64, f func())

func (*UI) AddElement

func (ui *UI) AddElement(element *UIElement)

func (*UI) AddElements

func (ui *UI) AddElements(elements []*UIElement)

func (*UI) Disable

func (ui *UI) Disable()

func (*UI) Enable

func (ui *UI) Enable()

func (*UI) GetHighestLayer

func (ui *UI) GetHighestLayer() []*UIElement

func (*UI) GetHighestLayerValue

func (ui *UI) GetHighestLayerValue() UILayer

func (*UI) IsDisabled

func (ui *UI) IsDisabled() bool

func (*UI) IterateElementsByLayer

func (ui *UI) IterateElementsByLayer(f func(*UIElement))

func (*UI) MakeFadeIn

func (ui *UI) MakeFadeIn(time uint64) util.AlphaFadeFunc

func (*UI) MakeFadeOut

func (ui *UI) MakeFadeOut(time uint64) util.AlphaFadeFunc

func (*UI) RemoveElement

func (ui *UI) RemoveElement(toRemove *UIElement)

func (*UI) RemoveElements

func (ui *UI) RemoveElements(toRemove []*UIElement)

func (*UI) SetElementsFromArray

func (ui *UI) SetElementsFromArray(elements []*UIElement)

func (*UI) StandardUpdate

func (ui *UI) StandardUpdate()

type UIClickElementFunc

type UIClickElementFunc func(element *UIElement)

type UIDelay

type UIDelay struct {
	Time uint64
	Func func()
}

type UIDrawFunc

type UIDrawFunc func(element *UIElement, window *ebiten.Image)

type UIElement

type UIElement struct {
	Rect image.Rectangle
	// fires if the mouse is not inside this element
	NotInside UINotInsideElementFunc
	// fires if the mouse is inside this element
	Inside UIInsideElementFunc
	// fires if a left click occurred but no other element was clicked on
	NotLeftClicked UIClickElementFunc
	// fires when a left click occurs on this element
	LeftClick UIClickElementFunc
	// fires when the left click button is released on this element
	LeftClickRelease UIClickElementFunc
	// fires when this element is double clicked
	DoubleLeftClick UIClickElementFunc
	// fires when this element is right clicked
	RightClick UIClickElementFunc

	// fires when this element is left clicked
	GainFocus UIGainFocusFunc
	// fires when some other element is left clicked
	LoseFocus UILoseFocusFunc
	// fires when the user types some keys and this element is focused
	TextEntry UITextEntry
	// fires when a key is pressed and this element is focused
	HandleKeys UIKeyFunc

	Draw  UIDrawFunc
	Layer UILayer
}

func MakeConfirmDialog

func MakeConfirmDialog(ui *UI, cache *lbx.LbxCache, imageCache *util.ImageCache, message string, confirm func(), cancel func()) []*UIElement

func MakeConfirmDialogWithLayer

func MakeConfirmDialogWithLayer(ui *UI, cache *lbx.LbxCache, imageCache *util.ImageCache, layer UILayer, message string, confirm func(), cancel func()) []*UIElement

func MakeErrorElement

func MakeErrorElement(ui *UI, cache *lbx.LbxCache, imageCache *util.ImageCache, message string, clicked func()) *UIElement

func MakeHelpElement

func MakeHelpElement(ui *UI, cache *lbx.LbxCache, imageCache *util.ImageCache, help lbx.HelpEntry, helpEntries ...lbx.HelpEntry) *UIElement

func MakeHelpElementWithLayer

func MakeHelpElementWithLayer(ui *UI, cache *lbx.LbxCache, imageCache *util.ImageCache, layer UILayer, help lbx.HelpEntry, helpEntries ...lbx.HelpEntry) *UIElement

func MakeLairConfirmDialog

func MakeLairConfirmDialog(ui *UI, cache *lbx.LbxCache, imageCache *util.ImageCache, lairPicture *util.Animation, message string, confirm func(), cancel func()) []*UIElement

func MakeLairConfirmDialogWithLayer

func MakeLairConfirmDialogWithLayer(ui *UI, cache *lbx.LbxCache, imageCache *util.ImageCache, lairPicture *util.Animation, layer UILayer, message string, confirm func(), cancel func()) []*UIElement

func MakeSelectionUI

func MakeSelectionUI(ui *UI, lbxCache *lbx.LbxCache, imageCache *util.ImageCache, cornerX int, cornerY int, selectionTitle string, choices []Selection) []*UIElement

type UIGainFocusFunc

type UIGainFocusFunc func(*UIElement)

type UIInsideElementFunc

type UIInsideElementFunc func(element *UIElement, x int, y int)

type UIKeyFunc

type UIKeyFunc func(key []ebiten.Key)

type UILayer

type UILayer int

type UILoseFocusFunc

type UILoseFocusFunc func(*UIElement)

type UINotInsideElementFunc

type UINotInsideElementFunc func(element *UIElement)

type UITextEntry

type UITextEntry func(*UIElement, []rune)

Jump to

Keyboard shortcuts

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