Documentation
¶
Index ¶
- Constants
- type Selection
- type UI
- func (ui *UI) AddDelay(time uint64, f func())
- func (ui *UI) AddElement(element *UIElement)
- func (ui *UI) AddElements(elements []*UIElement)
- func (ui *UI) AddGroup(group *UIElementGroup)
- func (ui *UI) Disable()
- func (ui *UI) Enable()
- func (ui *UI) FocusElement(element *UIElement, text string)
- func (ui *UI) GetHighestLayer() []*UIElement
- func (ui *UI) GetHighestLayerValue() UILayer
- func (ui *UI) IsDisabled() bool
- func (ui *UI) IterateElementsByLayer(f func(*UIElement))
- func (ui *UI) MakeFadeIn(time uint64) util.AlphaFadeFunc
- func (ui *UI) MakeFadeOut(time uint64) util.AlphaFadeFunc
- func (ui *UI) PlayStandardSound()
- func (ui *UI) RemoveElement(toRemove *UIElement)
- func (ui *UI) RemoveElements(toRemove []*UIElement)
- func (ui *UI) RemoveGroup(group *UIElementGroup)
- func (ui *UI) SetElementsFromArray(elements []*UIElement)
- func (ui *UI) StandardUpdate()
- func (ui *UI) UnfocusElement()
- type UIClickElementFunc
- type UIContainer
- type UIDelay
- type UIDrawFunc
- type UIElement
- func MakeConfirmDialog(container UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, ...) []*UIElement
- func MakeConfirmDialogWithLayer(container UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, ...) []*UIElement
- func MakeConfirmDialogWithLayerFull(container UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, ...) []*UIElement
- func MakeErrorElement(ui UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, ...) *UIElement
- func MakeHelpElement(container UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, ...) *UIElement
- func MakeHelpElementWithLayer(container UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, ...) *UIElement
- func MakeLairConfirmDialog(ui UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, ...) []*UIElement
- func MakeLairConfirmDialogWithLayer(ui UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, ...) []*UIElement
- func MakeLairShowDialogWithLayer(ui UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, ...) []*UIElement
- func MakeSelectionUI(ui UIContainer, lbxCache *lbx.LbxCache, imageCache *util.ImageCache, ...) []*UIElement
- type UIElementGroup
- func (group *UIElementGroup) AddDelay(time uint64, f func())
- func (group *UIElementGroup) AddElement(element *UIElement)
- func (group *UIElementGroup) AddElements(elements []*UIElement)
- func (group *UIElementGroup) MakeFadeIn(time uint64) util.AlphaFadeFunc
- func (group *UIElementGroup) MakeFadeOut(time uint64) util.AlphaFadeFunc
- func (group *UIElementGroup) RemoveElement(element *UIElement)
- func (group *UIElementGroup) RemoveElements(elements []*UIElement)
- type UIGainFocusFunc
- type UIInsideElementFunc
- type UIKeyFunc
- type UILayer
- type UILoseFocusFunc
- type UINotInsideElementFunc
- type UIScrollFunc
- type UITextEntry
Constants ¶
View Source
const DoubleClickThreshold = 20
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UI ¶
type UI struct { // track the layer number of the elements Elements map[UILayer][]*UIElement Groups []*UIElementGroup Draw func(*UI, *ebiten.Image) HandleKeys UIKeyFunc Counter uint64 // fires when the left mouse button is clicked, even if no element is clicked LeftClick func() LeftClickedElements []*UIElement Delays []UIDelay // disabled so that the zero value is enabled Disabled bool // lazily initialized in the sync.Once StandardSoundMaker audio.MakePlayerFunc StandardSoundSetup sync.Once Cache *lbx.LbxCache // contains filtered or unexported fields }
func (*UI) AddElement ¶
func (*UI) AddElements ¶
func (*UI) AddGroup ¶
func (ui *UI) AddGroup(group *UIElementGroup)
func (*UI) FocusElement ¶
func (*UI) GetHighestLayer ¶
func (*UI) GetHighestLayerValue ¶
func (*UI) IsDisabled ¶
func (*UI) IterateElementsByLayer ¶
func (*UI) MakeFadeIn ¶
func (ui *UI) MakeFadeIn(time uint64) util.AlphaFadeFunc
func (*UI) MakeFadeOut ¶
func (ui *UI) MakeFadeOut(time uint64) util.AlphaFadeFunc
func (*UI) PlayStandardSound ¶
func (ui *UI) PlayStandardSound()
func (*UI) RemoveElement ¶
func (*UI) RemoveElements ¶
func (*UI) RemoveGroup ¶
func (ui *UI) RemoveGroup(group *UIElementGroup)
func (*UI) SetElementsFromArray ¶
func (*UI) StandardUpdate ¶
func (ui *UI) StandardUpdate()
func (*UI) UnfocusElement ¶
func (ui *UI) UnfocusElement()
type UIClickElementFunc ¶
type UIClickElementFunc func(element *UIElement)
type UIContainer ¶
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 // fires when the mouse wheel/pad is scrolled Scroll UIScrollFunc Draw UIDrawFunc Layer UILayer // for specifying which element is drawn first Order int // if true, the standard ui sound will play when this element is left clicked PlaySoundLeftClick bool }
func MakeConfirmDialog ¶
func MakeConfirmDialog(container UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, message string, center bool, confirm func(), cancel func()) []*UIElement
func MakeConfirmDialogWithLayer ¶
func MakeConfirmDialogWithLayer(container UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, layer UILayer, message string, center bool, confirm func(), cancel func()) []*UIElement
func MakeConfirmDialogWithLayerFull ¶
func MakeConfirmDialogWithLayerFull(container UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, layer UILayer, message string, center bool, confirm func(), cancel func(), yesButtons []*ebiten.Image, noButtons []*ebiten.Image) []*UIElement
func MakeErrorElement ¶
func MakeErrorElement(ui UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, message string, clicked func()) *UIElement
func MakeHelpElement ¶
func MakeHelpElement(container UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, help help.HelpEntry, helpEntries ...help.HelpEntry) *UIElement
func MakeLairConfirmDialog ¶
func MakeLairConfirmDialog(ui UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, lairPicture *util.Animation, message string, confirm func(), cancel func()) []*UIElement
func MakeLairConfirmDialogWithLayer ¶
func MakeLairConfirmDialogWithLayer(ui UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, lairPicture *util.Animation, layer UILayer, message string, confirm func(), cancel func()) []*UIElement
func MakeLairShowDialogWithLayer ¶
func MakeLairShowDialogWithLayer(ui UIContainer, cache *lbx.LbxCache, imageCache *util.ImageCache, lairPicture *util.Animation, layer UILayer, message string, dismiss func()) []*UIElement
func MakeSelectionUI ¶
func MakeSelectionUI(ui UIContainer, lbxCache *lbx.LbxCache, imageCache *util.ImageCache, cornerX int, cornerY int, selectionTitle string, choices []Selection) []*UIElement
type UIElementGroup ¶
type UIElementGroup struct { Elements map[UILayer][]*UIElement Counter uint64 Delays []UIDelay // contains filtered or unexported fields }
a collection of ui elements that can be removed all at once
func MakeGroup ¶
func MakeGroup() *UIElementGroup
func (*UIElementGroup) AddDelay ¶
func (group *UIElementGroup) AddDelay(time uint64, f func())
func (*UIElementGroup) AddElement ¶
func (group *UIElementGroup) AddElement(element *UIElement)
func (*UIElementGroup) AddElements ¶
func (group *UIElementGroup) AddElements(elements []*UIElement)
func (*UIElementGroup) MakeFadeIn ¶
func (group *UIElementGroup) MakeFadeIn(time uint64) util.AlphaFadeFunc
func (*UIElementGroup) MakeFadeOut ¶
func (group *UIElementGroup) MakeFadeOut(time uint64) util.AlphaFadeFunc
func (*UIElementGroup) RemoveElement ¶
func (group *UIElementGroup) RemoveElement(element *UIElement)
func (*UIElementGroup) RemoveElements ¶
func (group *UIElementGroup) RemoveElements(elements []*UIElement)
type UIGainFocusFunc ¶
type UIGainFocusFunc func(*UIElement)
type UIInsideElementFunc ¶
type UILoseFocusFunc ¶
type UILoseFocusFunc func(*UIElement)
type UINotInsideElementFunc ¶
type UINotInsideElementFunc func(element *UIElement)
type UIScrollFunc ¶
type UITextEntry ¶
Click to show internal directories.
Click to hide internal directories.