Documentation
¶
Index ¶
- Constants
- func GetFS() fs.FS
- func GetFontSize() float64
- func GetFontSource() *text.GoTextFaceSource
- func SetBlockOption(option func(*Block))
- func SetEventHandler(ec EventHandler)
- func SetFS(fsys fs.FS)
- func SetFocusedItem(item Item)
- func SetFontSize(size float64)
- func SetFontSource(source *text.GoTextFaceSource)
- func SetGridOption(option func(*Grid))
- type AlignMode
- type Block
- func (ii Block) AddDeco(deco Decoration)
- func (ii Block) Align() (AlignMode, AlignMode)
- func (ii Block) Alpha() float64
- func (b *Block) BlockBase() *Block
- func (ii Block) Border() (float64, color.Color)
- func (ii Block) ColorFilling() ColorFilling
- func (b *Block) Content() Content
- func (ii Block) Data() any
- func (ii Block) Decorations() []Decoration
- func (ii Block) DoEvent(event Event)
- func (ii Block) EventHandler() EventHandler
- func (ii Block) Focused() bool
- func (ii Block) Hovered() bool
- func (ii Block) HoveredTicks() uint
- func (ii Block) JustFocused() bool
- func (ii Block) JustPressed() bool
- func (ii Block) JustUnhovered() bool
- func (ii Block) LastCursor() image.Point
- func (ii Block) LastFullRegion() image.Rectangle
- func (ii Block) LastRegion() image.Rectangle
- func (ii Block) Margin() (left, right, top, bottom float64)
- func (ii Block) MaxSize() (int, int)
- func (ii Block) MinSize() (int, int)
- func (ii Block) Padding() (left, right, top, bottom int)
- func (ii Block) Pressed() bool
- func (ii Block) PressedTicks() uint
- func (ii Block) PrimaryColor() color.Color
- func (ii Block) PrimaryColorOffset() float64
- func (ii Block) Rounding() float64
- func (ii Block) SecondaryColor() color.Color
- func (ii Block) SetAlign(x, y AlignMode)
- func (ii Block) SetAlignX(x AlignMode)
- func (ii Block) SetAlignY(y AlignMode)
- func (ii Block) SetBorderColor(clr color.Color)
- func (ii Block) SetBorderColorAlpha(alpha float64)
- func (ii Block) SetBorderWidth(width float64)
- func (ii Block) SetColorAlpha(alpha float64)
- func (ii Block) SetColorFilling(filling ColorFilling)
- func (ii Block) SetColorPrimary(clr color.Color)
- func (ii Block) SetColorPrimaryOffset(offset float64)
- func (ii Block) SetColorSecondary(clr color.Color)
- func (b *Block) SetContent(c Content)
- func (ii Block) SetData(data any)
- func (ii Block) SetEventActionOptions(opts EventOptions)
- func (ii Block) SetEventHandler(handler EventHandler)
- func (ii Block) SetEventHandling(handled bool)
- func (ii Block) SetEventStyleOptions(opts EventOptions)
- func (ii Block) SetFocusHandling(handled bool)
- func (ii Block) SetItemOptions(opts ...ItemOption)
- func (ii Block) SetMargin(left, right, top, bottom float64)
- func (ii Block) SetMarginBottom(pixels float64)
- func (ii Block) SetMarginLeft(pixels float64)
- func (ii Block) SetMarginRight(pixels float64)
- func (ii Block) SetMarginTop(pixels float64)
- func (ii Block) SetMaxHeight(height int)
- func (ii Block) SetMaxWidth(width int)
- func (ii Block) SetMinHeight(height int)
- func (ii Block) SetMinWidth(width int)
- func (ii Block) SetPadding(left, right, top, bottom int)
- func (ii Block) SetPaddingBottom(pixels int)
- func (ii Block) SetPaddingLeft(pixels int)
- func (ii Block) SetPaddingRight(pixels int)
- func (ii Block) SetPaddingTop(pixels int)
- func (ii Block) SetRounding(factor float64)
- func (ii Block) SetShape(shape Shape)
- func (ii Block) SetSkipped(skipped bool)
- func (ii Block) SetSourceOffset(offset image.Point)
- func (ii Block) Shape() Shape
- func (ii Block) Skipped() bool
- func (ii Block) SourceOffset() image.Point
- func (b *Block) WithOptions(opts ...BlockOption) *Block
- type BlockOption
- type ColorFilling
- type Content
- type Decoration
- type Event
- type EventHandler
- type EventOptions
- type Grid
- func (g *Grid) Add(x, y, columns, rows int, item Item)
- func (ii Grid) AddDeco(deco Decoration)
- func (ii Grid) Align() (AlignMode, AlignMode)
- func (ii Grid) Alpha() float64
- func (ii Grid) Border() (float64, color.Color)
- func (ii Grid) ColorFilling() ColorFilling
- func (g *Grid) Columns() int
- func (ii Grid) Data() any
- func (ii Grid) Decorations() []Decoration
- func (g *Grid) Dimensions() (int, int)
- func (ii Grid) DoEvent(event Event)
- func (ii Grid) EventHandler() EventHandler
- func (ii Grid) Focused() bool
- func (g *Grid) ForEach(fn func(i Item))
- func (g *Grid) GridBase() *Grid
- func (ii Grid) Hovered() bool
- func (ii Grid) HoveredTicks() uint
- func (ii Grid) JustFocused() bool
- func (ii Grid) JustPressed() bool
- func (ii Grid) JustUnhovered() bool
- func (ii Grid) LastCursor() image.Point
- func (ii Grid) LastFullRegion() image.Rectangle
- func (ii Grid) LastRegion() image.Rectangle
- func (ii Grid) Margin() (left, right, top, bottom float64)
- func (ii Grid) MaxSize() (int, int)
- func (ii Grid) MinSize() (int, int)
- func (ii Grid) Padding() (left, right, top, bottom int)
- func (ii Grid) Pressed() bool
- func (ii Grid) PressedTicks() uint
- func (ii Grid) PrimaryColor() color.Color
- func (ii Grid) PrimaryColorOffset() float64
- func (ii Grid) Rounding() float64
- func (g *Grid) Rows() int
- func (ii Grid) SecondaryColor() color.Color
- func (ii Grid) SetAlign(x, y AlignMode)
- func (ii Grid) SetAlignX(x AlignMode)
- func (ii Grid) SetAlignY(y AlignMode)
- func (ii Grid) SetBorderColor(clr color.Color)
- func (ii Grid) SetBorderColorAlpha(alpha float64)
- func (ii Grid) SetBorderWidth(width float64)
- func (ii Grid) SetColorAlpha(alpha float64)
- func (ii Grid) SetColorFilling(filling ColorFilling)
- func (ii Grid) SetColorPrimary(clr color.Color)
- func (ii Grid) SetColorPrimaryOffset(offset float64)
- func (ii Grid) SetColorSecondary(clr color.Color)
- func (ii Grid) SetData(data any)
- func (ii Grid) SetEventActionOptions(opts EventOptions)
- func (ii Grid) SetEventHandler(handler EventHandler)
- func (ii Grid) SetEventHandling(handled bool)
- func (ii Grid) SetEventStyleOptions(opts EventOptions)
- func (ii Grid) SetFocusHandling(handled bool)
- func (ii Grid) SetItemOptions(opts ...ItemOption)
- func (ii Grid) SetMargin(left, right, top, bottom float64)
- func (ii Grid) SetMarginBottom(pixels float64)
- func (ii Grid) SetMarginLeft(pixels float64)
- func (ii Grid) SetMarginRight(pixels float64)
- func (ii Grid) SetMarginTop(pixels float64)
- func (ii Grid) SetMaxHeight(height int)
- func (ii Grid) SetMaxWidth(width int)
- func (ii Grid) SetMinHeight(height int)
- func (ii Grid) SetMinWidth(width int)
- func (ii Grid) SetPadding(left, right, top, bottom int)
- func (ii Grid) SetPaddingBottom(pixels int)
- func (ii Grid) SetPaddingLeft(pixels int)
- func (ii Grid) SetPaddingRight(pixels int)
- func (ii Grid) SetPaddingTop(pixels int)
- func (ii Grid) SetRounding(factor float64)
- func (ii Grid) SetShape(shape Shape)
- func (ii Grid) SetSkipped(skipped bool)
- func (ii Grid) SetSourceOffset(offset image.Point)
- func (ii Grid) Shape() Shape
- func (ii Grid) Skipped() bool
- func (ii Grid) SourceOffset() image.Point
- func (g *Grid) WithOptions(opts ...GridOption) *Grid
- type GridOption
- type InputState
- type Item
- type ItemOption
- type Layout
- func (l *Layout) Dimensions() (int, int)
- func (l *Layout) Draw(screen *ebiten.Image)
- func (l *Layout) Grid() *Grid
- func (l *Layout) SetDimensions(width, height int)
- func (l *Layout) SetUnit(unit image.Rectangle)
- func (l *Layout) Unit() image.Rectangle
- func (l *Layout) Update(offset image.Point, is InputState)
- func (l *Layout) WithGrid(g *Grid) *Layout
- type Shape
Constants ¶
const ( ShapeBox = Shape(graphics.ShapeBox) ShapeEllipse = Shape(graphics.ShapeEllipse) ShapeRhombus = Shape(graphics.ShapeRhombus) ShapeOctogon = Shape(graphics.ShapeOctogon) ShapeNone = Shape(graphics.ShapeNone) )
const ( ColorFillingVertical = ColorFilling(graphics.ColorFillingVertical) ColorFillingDistance = ColorFilling(graphics.ColorFillingDistance) ColorFillingNone = ColorFilling(graphics.ColorFillingNone) )
Variables ¶
This section is empty.
Functions ¶
func GetFontSize ¶
func GetFontSize() float64
func GetFontSource ¶
func GetFontSource() *text.GoTextFaceSource
func SetBlockOption ¶
func SetBlockOption(option func(*Block))
func SetEventHandler ¶
func SetEventHandler(ec EventHandler)
func SetFocusedItem ¶
func SetFocusedItem(item Item)
func SetFontSize ¶
func SetFontSize(size float64)
func SetFontSource ¶
func SetFontSource(source *text.GoTextFaceSource)
func SetGridOption ¶
func SetGridOption(option func(*Grid))
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
func (Block) AddDeco ¶
func (ii Block) AddDeco(deco Decoration)
func (Block) ColorFilling ¶
func (ii Block) ColorFilling() ColorFilling
func (Block) Decorations ¶
func (ii Block) Decorations() []Decoration
func (Block) EventHandler ¶
func (ii Block) EventHandler() EventHandler
func (Block) HoveredTicks ¶
func (ii Block) HoveredTicks() uint
func (Block) JustFocused ¶
func (ii Block) JustFocused() bool
func (Block) JustPressed ¶
func (ii Block) JustPressed() bool
func (Block) JustUnhovered ¶
func (ii Block) JustUnhovered() bool
func (Block) LastCursor ¶
func (Block) LastFullRegion ¶
func (Block) LastRegion ¶
func (Block) PressedTicks ¶
func (ii Block) PressedTicks() uint
func (Block) PrimaryColor ¶
func (Block) PrimaryColorOffset ¶
func (ii Block) PrimaryColorOffset() float64
func (Block) SecondaryColor ¶
func (Block) SetBorderColor ¶
func (Block) SetBorderColorAlpha ¶
func (ii Block) SetBorderColorAlpha(alpha float64)
func (Block) SetBorderWidth ¶
func (ii Block) SetBorderWidth(width float64)
func (Block) SetColorAlpha ¶
func (ii Block) SetColorAlpha(alpha float64)
func (Block) SetColorFilling ¶
func (ii Block) SetColorFilling(filling ColorFilling)
func (Block) SetColorPrimary ¶
func (Block) SetColorPrimaryOffset ¶
func (ii Block) SetColorPrimaryOffset(offset float64)
func (Block) SetColorSecondary ¶
func (*Block) SetContent ¶
func (Block) SetEventActionOptions ¶
func (ii Block) SetEventActionOptions(opts EventOptions)
func (Block) SetEventHandler ¶
func (ii Block) SetEventHandler(handler EventHandler)
func (Block) SetEventHandling ¶
func (ii Block) SetEventHandling(handled bool)
func (Block) SetEventStyleOptions ¶
func (ii Block) SetEventStyleOptions(opts EventOptions)
func (Block) SetFocusHandling ¶
func (ii Block) SetFocusHandling(handled bool)
SetFocusHandling defines whether an item should take the focused state, therefore unfocusing the previously focused item.
func (Block) SetItemOptions ¶
func (ii Block) SetItemOptions(opts ...ItemOption)
func (Block) SetMarginBottom ¶
func (ii Block) SetMarginBottom(pixels float64)
func (Block) SetMarginLeft ¶
func (ii Block) SetMarginLeft(pixels float64)
func (Block) SetMarginRight ¶
func (ii Block) SetMarginRight(pixels float64)
func (Block) SetMarginTop ¶
func (ii Block) SetMarginTop(pixels float64)
func (Block) SetMaxHeight ¶
func (ii Block) SetMaxHeight(height int)
func (Block) SetMaxWidth ¶
func (ii Block) SetMaxWidth(width int)
func (Block) SetMinHeight ¶
func (ii Block) SetMinHeight(height int)
func (Block) SetMinWidth ¶
func (ii Block) SetMinWidth(width int)
func (Block) SetPadding ¶
func (ii Block) SetPadding(left, right, top, bottom int)
func (Block) SetPaddingBottom ¶
func (ii Block) SetPaddingBottom(pixels int)
func (Block) SetPaddingLeft ¶
func (ii Block) SetPaddingLeft(pixels int)
func (Block) SetPaddingRight ¶
func (ii Block) SetPaddingRight(pixels int)
func (Block) SetPaddingTop ¶
func (ii Block) SetPaddingTop(pixels int)
func (Block) SetRounding ¶
func (ii Block) SetRounding(factor float64)
func (Block) SetSkipped ¶
func (ii Block) SetSkipped(skipped bool)
func (Block) SetSourceOffset ¶
func (Block) SourceOffset ¶
func (*Block) WithOptions ¶
func (b *Block) WithOptions(opts ...BlockOption) *Block
type BlockOption ¶
type BlockOption = func(*Block)
func WithBlockContent ¶
func WithBlockContent(c Content) BlockOption
type ColorFilling ¶
type ColorFilling graphics.ColorFilling
type Decoration ¶
type EventHandler ¶
type EventHandler interface {
State(item Item, is InputState) Event
}
func GetEventHandler ¶
func GetEventHandler() EventHandler
type EventOptions ¶
type EventOptions [EventMax]ItemOption
type Grid ¶
type Grid struct {
// contains filtered or unexported fields
}
func (Grid) AddDeco ¶
func (ii Grid) AddDeco(deco Decoration)
func (Grid) ColorFilling ¶
func (ii Grid) ColorFilling() ColorFilling
func (Grid) Decorations ¶
func (ii Grid) Decorations() []Decoration
func (*Grid) Dimensions ¶
func (Grid) EventHandler ¶
func (ii Grid) EventHandler() EventHandler
func (Grid) HoveredTicks ¶
func (ii Grid) HoveredTicks() uint
func (Grid) JustFocused ¶
func (ii Grid) JustFocused() bool
func (Grid) JustPressed ¶
func (ii Grid) JustPressed() bool
func (Grid) JustUnhovered ¶
func (ii Grid) JustUnhovered() bool
func (Grid) LastCursor ¶
func (Grid) LastFullRegion ¶
func (Grid) LastRegion ¶
func (Grid) PressedTicks ¶
func (ii Grid) PressedTicks() uint
func (Grid) PrimaryColor ¶
func (Grid) PrimaryColorOffset ¶
func (ii Grid) PrimaryColorOffset() float64
func (Grid) SecondaryColor ¶
func (Grid) SetBorderColor ¶
func (Grid) SetBorderColorAlpha ¶
func (ii Grid) SetBorderColorAlpha(alpha float64)
func (Grid) SetBorderWidth ¶
func (ii Grid) SetBorderWidth(width float64)
func (Grid) SetColorAlpha ¶
func (ii Grid) SetColorAlpha(alpha float64)
func (Grid) SetColorFilling ¶
func (ii Grid) SetColorFilling(filling ColorFilling)
func (Grid) SetColorPrimary ¶
func (Grid) SetColorPrimaryOffset ¶
func (ii Grid) SetColorPrimaryOffset(offset float64)
func (Grid) SetColorSecondary ¶
func (Grid) SetEventActionOptions ¶
func (ii Grid) SetEventActionOptions(opts EventOptions)
func (Grid) SetEventHandler ¶
func (ii Grid) SetEventHandler(handler EventHandler)
func (Grid) SetEventHandling ¶
func (ii Grid) SetEventHandling(handled bool)
func (Grid) SetEventStyleOptions ¶
func (ii Grid) SetEventStyleOptions(opts EventOptions)
func (Grid) SetFocusHandling ¶
func (ii Grid) SetFocusHandling(handled bool)
SetFocusHandling defines whether an item should take the focused state, therefore unfocusing the previously focused item.
func (Grid) SetItemOptions ¶
func (ii Grid) SetItemOptions(opts ...ItemOption)
func (Grid) SetMarginBottom ¶
func (ii Grid) SetMarginBottom(pixels float64)
func (Grid) SetMarginLeft ¶
func (ii Grid) SetMarginLeft(pixels float64)
func (Grid) SetMarginRight ¶
func (ii Grid) SetMarginRight(pixels float64)
func (Grid) SetMarginTop ¶
func (ii Grid) SetMarginTop(pixels float64)
func (Grid) SetMaxHeight ¶
func (ii Grid) SetMaxHeight(height int)
func (Grid) SetMaxWidth ¶
func (ii Grid) SetMaxWidth(width int)
func (Grid) SetMinHeight ¶
func (ii Grid) SetMinHeight(height int)
func (Grid) SetMinWidth ¶
func (ii Grid) SetMinWidth(width int)
func (Grid) SetPadding ¶
func (ii Grid) SetPadding(left, right, top, bottom int)
func (Grid) SetPaddingBottom ¶
func (ii Grid) SetPaddingBottom(pixels int)
func (Grid) SetPaddingLeft ¶
func (ii Grid) SetPaddingLeft(pixels int)
func (Grid) SetPaddingRight ¶
func (ii Grid) SetPaddingRight(pixels int)
func (Grid) SetPaddingTop ¶
func (ii Grid) SetPaddingTop(pixels int)
func (Grid) SetRounding ¶
func (ii Grid) SetRounding(factor float64)
func (Grid) SetSkipped ¶
func (ii Grid) SetSkipped(skipped bool)
func (Grid) SetSourceOffset ¶
func (Grid) SourceOffset ¶
func (*Grid) WithOptions ¶
func (g *Grid) WithOptions(opts ...GridOption) *Grid
type GridOption ¶
type GridOption = func(*Grid)
type InputState ¶
type InputState interface { Cursor() image.Point MouseWheel() (float64, float64) KeyPressDuration(ebiten.Key) int MouseButtonPressDuration(ebiten.MouseButton) int GamepadButtonPressDuration(ebiten.GamepadID, ebiten.GamepadButton) int StandardGamepadButtonPressDuration(ebiten.GamepadID, ebiten.StandardGamepadButton) int TouchPressDuration(ebiten.TouchID) int KeyJustReleased(ebiten.Key) bool MouseButtonJustReleased(ebiten.MouseButton) bool GamepadButtonJustReleased(ebiten.GamepadID, ebiten.GamepadButton) bool StandardGamepadButtonJustReleased(ebiten.GamepadID, ebiten.StandardGamepadButton) bool TouchJustReleased(ebiten.TouchID) bool DroppedFiles() fs.FS }
func GetInputState ¶
func GetInputState() InputState
type Item ¶
type Item interface { SetItemOptions(opts ...ItemOption) // State Pressed() bool PressedTicks() uint JustPressed() bool Hovered() bool HoveredTicks() uint JustUnhovered() bool Focused() bool JustFocused() bool Skipped() bool SetSkipped(skipped bool) // Style options SetShape(shape Shape) SetRounding(factor float64) SetMinWidth(width int) SetMinHeight(height int) SetMaxWidth(width int) SetMaxHeight(height int) SetAlign(x, y AlignMode) SetAlignX(x AlignMode) SetAlignY(y AlignMode) SetMargin(left, right, top, bottom float64) SetMarginLeft(pixels float64) SetMarginRight(pixels float64) SetMarginTop(pixels float64) SetMarginBottom(pixels float64) SetPadding(left, right, top, bottom int) SetPaddingLeft(pixels int) SetPaddingRight(pixels int) SetPaddingTop(pixels int) SetPaddingBottom(pixels int) SetBorderWidth(width float64) SetBorderColor(clr color.Color) SetBorderColorAlpha(alpha float64) SetColorPrimary(clr color.Color) SetColorSecondary(clr color.Color) SetColorPrimaryOffset(offset float64) SetColorAlpha(alpha float64) SetColorFilling(filling ColorFilling) // Getters Shape() Shape Rounding() float64 MinSize() (int, int) MaxSize() (int, int) Align() (AlignMode, AlignMode) Margin() (left, right, top, bottom float64) Padding() (left, right, top, bottom int) Border() (float64, color.Color) PrimaryColor() color.Color SecondaryColor() color.Color PrimaryColorOffset() float64 Alpha() float64 ColorFilling() ColorFilling // Event SetFocusHandling(handled bool) SetEventHandling(handled bool) SetEventHandler(handler EventHandler) EventHandler() EventHandler SetEventStyleOptions(EventOptions) SetEventActionOptions(EventOptions) DoEvent(event Event) // Class attributes Classes() []string SetClasses(classes ...string) AddClasses(classes ...string) // Decorations Decorations() []Decoration AddDeco(deco Decoration) // User data Data() any SetData(data any) // contains filtered or unexported methods }
func FocusedItem ¶
func FocusedItem() Item
type ItemOption ¶
type ItemOption func(Item)
func WithCustomStyleFunc ¶
func WithCustomStyleFunc[T Item](fn func(T, InputState)) ItemOption
WithCustomStyleFunc specifies a function to define the style of an item based on events. The function fn will replace the default function. This function is called every tick, and will always called before the update function.
func WithCustomUpdateFunc ¶
func WithCustomUpdateFunc[T Item](fn func(T, InputState)) ItemOption
WithCustomUpdateFunc specifies a function to be called every tick for logic handling. The function fn will replace the default function. This function can also be used to edit the style of components and will overwrite any changes made by the func provided by WithStyleFunc, since it executes after.
func WithData ¶
func WithData(data any) ItemOption
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
Layout represents a surface (or window) acting as a grid, container for child UI items A Layout cannot exist without a grid