eeui

package
v0.0.0-...-86a4e1d Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ButtonStateNormal = iota
	ButtonStateHover
)

Variables

View Source
var (
	ButtonColorNormal = color.RGBA{160, 160, 160, 255}
)

Functions

func HSplitRect

func HSplitRect(r image.Rectangle, n int) []image.Rectangle

func HSplitRectBySizeHints

func HSplitRectBySizeHints(r image.Rectangle, sty BoxLayoutStyles, sizeHints []SizeHint) []image.Rectangle

func VSplitRect

func VSplitRect(r image.Rectangle, n int) []image.Rectangle

func VSplitRectBySizeHints

func VSplitRectBySizeHints(r image.Rectangle, sty BoxLayoutStyles, sizeHints []SizeHint) []image.Rectangle

Types

type BoxLayoutStyles

type BoxLayoutStyles struct {
	Padding  int
	Gap      int
	SizeHint SizeHint
}

type Button

type Button struct {
	// contains filtered or unexported fields
}

func NewButton

func NewButton(text string, evts *EventHandler) *Button

func (*Button) ChangeText

func (b *Button) ChangeText(text string)

func (*Button) Draw

func (c *Button) Draw(ctx *DrawContext)

func (*Button) OnClick

func (b *Button) OnClick(fn func())

func (*Button) Resize

func (c *Button) Resize(ctx *ResizeContext)

func (*Button) SizeHint

func (c *Button) SizeHint() SizeHint

type ButtonState

type ButtonState byte

type DrawContext

type DrawContext struct {
	Screen *ebiten.Image
	Font   *truetype.Font
}

type EventHandler

type EventHandler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler() *EventHandler

NewHandler

func (*EventHandler) OnKeyDown

func (h *EventHandler) OnKeyDown(cb KeyCallback)

func (*EventHandler) OnKeyUp

func (h *EventHandler) OnKeyUp(cb KeyCallback)

func (*EventHandler) OnMouseLeftClicked

func (h *EventHandler) OnMouseLeftClicked(cb MouseCallback)

func (*EventHandler) OnMouseMove

func (h *EventHandler) OnMouseMove(cb MouseCallback)

func (*EventHandler) OnMouseRightClicked

func (h *EventHandler) OnMouseRightClicked(cb MouseCallback)

func (*EventHandler) Update

func (h *EventHandler) Update()

type Form

type Form struct {
	// contains filtered or unexported fields
}

func NewForm

func NewForm(widget Widget, evts *EventHandler, font *truetype.Font) *Form

func (*Form) Draw

func (f *Form) Draw(screen *ebiten.Image)

func (*Form) Resize

func (f *Form) Resize(x, y, width, height int)

type HBoxLayout

type HBoxLayout struct {
	// contains filtered or unexported fields
}

func NewHBoxLayout

func NewHBoxLayout(styles BoxLayoutStyles, ws ...Widget) *HBoxLayout

HBox

func (*HBoxLayout) Draw

func (c *HBoxLayout) Draw(ctx *DrawContext)

func (*HBoxLayout) Resize

func (c *HBoxLayout) Resize(ctx *ResizeContext)

func (*HBoxLayout) SizeHint

func (c *HBoxLayout) SizeHint() SizeHint

type ImageButton

type ImageButton struct {
	// contains filtered or unexported fields
}

func NewImageButton

func NewImageButton(img *ebiten.Image, dx, dy int, evts *EventHandler) *ImageButton

func (*ImageButton) Draw

func (c *ImageButton) Draw(ctx *DrawContext)

func (*ImageButton) OnClick

func (b *ImageButton) OnClick(fn func())

func (*ImageButton) Resize

func (c *ImageButton) Resize(ctx *ResizeContext)

func (*ImageButton) SizeHint

func (c *ImageButton) SizeHint() SizeHint

type KeyCallback

type KeyCallback func(ebiten.Key)

Events

type KeyCallbacks

type KeyCallbacks []KeyCallback

Events

func (KeyCallbacks) Call

func (cbs KeyCallbacks) Call(k ebiten.Key)

type MouseCallback

type MouseCallback func(image.Point)

Events

type MouseCallbacks

type MouseCallbacks []MouseCallback

Events

func (MouseCallbacks) Call

func (cbs MouseCallbacks) Call(p image.Point)

type ResizeContext

type ResizeContext struct {
	Rect image.Rectangle
}

type SizeHint

type SizeHint struct {
	MaxWidth  int
	MaxHeight int
}

type TextBox

type TextBox struct {
	// contains filtered or unexported fields
}

func NewTextBox

func NewTextBox(evts *EventHandler) *TextBox

func (*TextBox) ChangeTextFunc

func (b *TextBox) ChangeTextFunc(fn func() []string)

func (*TextBox) Draw

func (c *TextBox) Draw(ctx *DrawContext)

func (*TextBox) Resize

func (c *TextBox) Resize(ctx *ResizeContext)

func (*TextBox) SizeHint

func (c *TextBox) SizeHint() SizeHint

type VBoxLayout

type VBoxLayout struct {
	// contains filtered or unexported fields
}

func NewVBoxLayout

func NewVBoxLayout(styles BoxLayoutStyles, ws ...Widget) *VBoxLayout

func (*VBoxLayout) Draw

func (c *VBoxLayout) Draw(ctx *DrawContext)

func (*VBoxLayout) Resize

func (c *VBoxLayout) Resize(ctx *ResizeContext)

func (*VBoxLayout) SizeHint

func (c *VBoxLayout) SizeHint() SizeHint

type Widget

type Widget interface {
	Draw(ctx *DrawContext)     // Draw hast to take its absolute position into account
	Resize(ctx *ResizeContext) // Resizes to absolute screen position
	SizeHint() SizeHint
}

Jump to

Keyboard shortcuts

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