component

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultHorizontalPadding added in v0.4.0

func SetDefaultHorizontalPadding(padding int)

func SetDefaultPadding added in v0.4.0

func SetDefaultPadding(left, right, top, bottom int)

func SetDefaultVerticalPadding added in v0.4.0

func SetDefaultVerticalPadding(padding int)

Types

type Button

type Button struct {
	PressedEvent  *event.Event
	ReleasedEvent *event.Event
	ClickedEvent  *event.Event
	// contains filtered or unexported fields
}

func NewButton

func NewButton(options *ButtonOptions) *Button

func (*Button) AbsPosX added in v0.5.0

func (c *Button) AbsPosX() float64

AbsPosX returns the component's absolute position X.

func (*Button) AbsPosY added in v0.5.0

func (c *Button) AbsPosY() float64

AbsPosY returns the component's absolute position Y.

func (*Button) AbsPosition added in v0.5.0

func (c *Button) AbsPosition() (posX float64, posY float64)

AbsPosition return the component's absolute position.

func (*Button) AddClickedHandler

func (b *Button) AddClickedHandler(f ButtonClickedHandlerFunc) *Button

func (*Button) AddCursorEnterHandler added in v0.4.0

func (c *Button) AddCursorEnterHandler(f ComponentCursorEnterHandlerFunc) *component

func (*Button) AddCursorExitHandler added in v0.4.0

func (c *Button) AddCursorExitHandler(f ComponentCursorExitHandlerFunc) *component

func (*Button) AddMouseButtonPressedHandler added in v0.4.0

func (c *Button) AddMouseButtonPressedHandler(f ComponentMouseButtonPressedHandlerFunc) *component

func (*Button) AddMouseButtonReleasedHandler added in v0.4.0

func (c *Button) AddMouseButtonReleasedHandler(f ComponentMouseButtonReleasedHandlerFunc) *component

func (*Button) AddPressedHandler

func (b *Button) AddPressedHandler(f ButtonPressedHandlerFunc) *Button

func (*Button) AddReleasedHandler

func (b *Button) AddReleasedHandler(f ButtonReleasedHandlerFunc) *Button

func (*Button) Dimensions added in v0.4.0

func (c *Button) Dimensions() (int, int)

Dimensions returns the component's size (width and height).

func (*Button) Disable added in v0.5.0

func (c *Button) Disable() bool

Disable returns the component's disabled state.

func (*Button) Draw

func (b *Button) Draw() *ebiten.Image

func (*Button) FireEvents

func (c *Button) FireEvents()

FireEvents checks if the mouse cursor is inside the component and fires events accordingly.

func (*Button) Height added in v0.4.0

func (c *Button) Height() int

Height returns the component's height.

func (*Button) HeightWithPadding added in v0.4.0

func (c *Button) HeightWithPadding() int

HeightWithPadding returns the component's height with top and bottom paddings.

func (*Button) Hidden added in v0.5.0

func (c *Button) Hidden() bool

Hidden returns the component's hidden state.

func (*Button) PosX added in v0.4.0

func (c *Button) PosX() float64

PosX returns the component's position X.

func (*Button) PosY added in v0.4.0

func (c *Button) PosY() float64

PosY returns the component's position Y.

func (*Button) Position

func (c *Button) Position() (float64, float64)

Position returns the component's position (x and y).

func (*Button) SetDimensions

func (c *Button) SetDimensions(width, height int)

SetDimensions sets the component's dimensions (width and height).

func (*Button) SetDisabled

func (c *Button) SetDisabled(disabled bool)

SetDisabled sets the component's disabled state.

func (*Button) SetHeight

func (c *Button) SetHeight(height int)

SetHeight sets the component's height.

func (*Button) SetHidden added in v0.5.0

func (c *Button) SetHidden(hidden bool)

SetHidden sets the component's hidden state.

func (*Button) SetLabel

func (b *Button) SetLabel(label *Label)

SetLabel sets the label of the button and sets the dimensions of the button accordingly.

func (*Button) SetPosX

func (c *Button) SetPosX(posX float64)

SetPosX sets the component's position X.

func (*Button) SetPosY

func (c *Button) SetPosY(posY float64)

SetPosY sets the component's position Y.

func (*Button) SetPosision added in v0.4.0

func (c *Button) SetPosision(posX, posY float64)

SetPosision sets the component's position (x and y).

func (*Button) SetWidth

func (c *Button) SetWidth(width int)

SetWidth sets the component's width.

func (*Button) Width added in v0.4.0

func (c *Button) Width() int

Width returns the component's width.

func (*Button) WidthWithPadding added in v0.4.0

func (c *Button) WidthWithPadding() int

WidthWithPadding returns the component's width with left and right paddings.

type ButtonClickedEventArgs

type ButtonClickedEventArgs struct {
	Button *Button
}

type ButtonClickedHandlerFunc

type ButtonClickedHandlerFunc func(args *ButtonClickedEventArgs)

type ButtonDrawer added in v0.6.0

type ButtonDrawer interface {
	Draw(*Button) *ebiten.Image
}

type ButtonOptions

type ButtonOptions struct {
	Width  *int
	Height *int

	Drawer ButtonDrawer

	Label *Label

	Padding *Padding
}

type ButtonPressedEventArgs

type ButtonPressedEventArgs struct {
	Button *Button
}

type ButtonPressedHandlerFunc

type ButtonPressedHandlerFunc func(args *ButtonPressedEventArgs)

type ButtonReleasedEventArgs

type ButtonReleasedEventArgs struct {
	Button *Button
	Inside bool
}

type ButtonReleasedHandlerFunc

type ButtonReleasedHandlerFunc func(args *ButtonReleasedEventArgs)

type CheckBox

type CheckBox struct {
	Checked bool

	ToggledEvent *event.Event
	// contains filtered or unexported fields
}

func NewCheckBox

func NewCheckBox(options *CheckBoxOptions) *CheckBox

func (*CheckBox) AbsPosX added in v0.5.0

func (c *CheckBox) AbsPosX() float64

AbsPosX returns the component's absolute position X.

func (*CheckBox) AbsPosY added in v0.5.0

func (c *CheckBox) AbsPosY() float64

AbsPosY returns the component's absolute position Y.

func (*CheckBox) AbsPosition added in v0.5.0

func (c *CheckBox) AbsPosition() (posX float64, posY float64)

AbsPosition return the component's absolute position.

func (*CheckBox) AddCursorEnterHandler added in v0.4.0

func (c *CheckBox) AddCursorEnterHandler(f ComponentCursorEnterHandlerFunc) *component

func (*CheckBox) AddCursorExitHandler added in v0.4.0

func (c *CheckBox) AddCursorExitHandler(f ComponentCursorExitHandlerFunc) *component

func (*CheckBox) AddMouseButtonPressedHandler added in v0.4.0

func (c *CheckBox) AddMouseButtonPressedHandler(f ComponentMouseButtonPressedHandlerFunc) *component

func (*CheckBox) AddMouseButtonReleasedHandler added in v0.4.0

func (c *CheckBox) AddMouseButtonReleasedHandler(f ComponentMouseButtonReleasedHandlerFunc) *component

func (*CheckBox) AddToggledHandler

func (cb *CheckBox) AddToggledHandler(f CheckBoxToggledHandlerFunc) *CheckBox

func (*CheckBox) Dimensions added in v0.4.0

func (c *CheckBox) Dimensions() (int, int)

Dimensions returns the component's size (width and height).

func (*CheckBox) Disable added in v0.5.0

func (c *CheckBox) Disable() bool

Disable returns the component's disabled state.

func (*CheckBox) Draw

func (cb *CheckBox) Draw() *ebiten.Image

func (*CheckBox) FireEvents

func (c *CheckBox) FireEvents()

FireEvents checks if the mouse cursor is inside the component and fires events accordingly.

func (*CheckBox) Height added in v0.4.0

func (c *CheckBox) Height() int

Height returns the component's height.

func (*CheckBox) HeightWithPadding added in v0.4.0

func (c *CheckBox) HeightWithPadding() int

HeightWithPadding returns the component's height with top and bottom paddings.

func (*CheckBox) Hidden added in v0.5.0

func (c *CheckBox) Hidden() bool

Hidden returns the component's hidden state.

func (*CheckBox) PosX added in v0.4.0

func (c *CheckBox) PosX() float64

PosX returns the component's position X.

func (*CheckBox) PosY added in v0.4.0

func (c *CheckBox) PosY() float64

PosY returns the component's position Y.

func (*CheckBox) Position

func (c *CheckBox) Position() (float64, float64)

Position returns the component's position (x and y).

func (*CheckBox) Set

func (cb *CheckBox) Set(checked bool)

func (*CheckBox) SetDimensions

func (c *CheckBox) SetDimensions(width, height int)

SetDimensions sets the component's dimensions (width and height).

func (*CheckBox) SetDisabled

func (c *CheckBox) SetDisabled(disabled bool)

SetDisabled sets the component's disabled state.

func (*CheckBox) SetHeight

func (c *CheckBox) SetHeight(height int)

SetHeight sets the component's height.

func (*CheckBox) SetHidden added in v0.5.0

func (c *CheckBox) SetHidden(hidden bool)

SetHidden sets the component's hidden state.

func (*CheckBox) SetLabel

func (cb *CheckBox) SetLabel(label *Label)

SetLabel sets the label of the checkbox and adjusts the checkbox's dimensions accordingly.

func (*CheckBox) SetPosX

func (c *CheckBox) SetPosX(posX float64)

SetPosX sets the component's position X.

func (*CheckBox) SetPosY

func (c *CheckBox) SetPosY(posY float64)

SetPosY sets the component's position Y.

func (*CheckBox) SetPosision added in v0.4.0

func (c *CheckBox) SetPosision(posX, posY float64)

SetPosision sets the component's position (x and y).

func (*CheckBox) SetWidth

func (c *CheckBox) SetWidth(width int)

SetWidth sets the component's width.

func (*CheckBox) Toggle

func (cb *CheckBox) Toggle()

func (*CheckBox) Width added in v0.4.0

func (c *CheckBox) Width() int

Width returns the component's width.

func (*CheckBox) WidthWithPadding added in v0.4.0

func (c *CheckBox) WidthWithPadding() int

WidthWithPadding returns the component's width with left and right paddings.

type CheckBoxDrawer added in v0.6.0

type CheckBoxDrawer interface {
	Draw(checkbox *CheckBox) *ebiten.Image
}

type CheckBoxOptions

type CheckBoxOptions struct {
	Label *Label

	Padding *Padding

	Drawer CheckBoxDrawer
}

type CheckBoxToggledEventArgs

type CheckBoxToggledEventArgs struct {
	CheckBox *CheckBox
}

type CheckBoxToggledHandlerFunc

type CheckBoxToggledHandlerFunc func(args *CheckBoxToggledEventArgs)

type Component

type Component interface {
	// Draw draws the component to it's image.
	Draw() *ebiten.Image
	// Dimensions returns the component's dimensions (width and height).
	Dimensions() (width int, height int)
	// Width returns the component's width.
	Width() int
	// WidthWithPadding returns the component's width with left and right paddings.
	WidthWithPadding() int
	// Height returns the component's height.
	Height() int
	// HeightWithPadding returns the component's height with top and bottom paddings.
	HeightWithPadding() int
	// Position returns the component's position.
	Position() (posX float64, posY float64)
	// PosX returns the component's position X.
	PosX() float64
	// PosY returns the component's position Y.
	PosY() float64
	// AbsPosition return the component's absolute position.
	AbsPosition() (posX float64, posY float64)
	// AbsPosX returns the component's absolute position X.
	AbsPosX() float64
	// AbsPosY returns the component's absolute position Y.
	AbsPosY() float64
	// Disable returns the component's disabled state.
	Disable() bool
	// SetDisabled sets the component's disabled state.
	SetDisabled(disabled bool)
	// Hidden returns the component's hidden state.
	Hidden() bool
	// SetHidden sets the component's hidden state.
	SetHidden(hidden bool)
	// FireEvents fires the component's events.
	FireEvents()
	// SetWidth sets the component's width.
	SetWidth(width int)
	// SetHeight sets the component's height.
	SetHeight(height int)
	// SetDimensions sets the component's dimensions.
	SetDimensions(width, height int)
	// SetPosX sets the component's position X.
	SetPosX(posX float64)
	// SetPosY sets the component's position Y.
	SetPosY(posY float64)
	// SetPosision sets the component's position (x and y)
	SetPosision(posX, posY float64)
	// contains filtered or unexported methods
}

Component is an abstraction of a user interface component, like a button or checkbox.

type ComponentCursorEnterEventArgs

type ComponentCursorEnterEventArgs struct {
	Component *component
}

ComponentCursorEnterEventArgs are the arguments for cursor enter events.

type ComponentCursorEnterHandlerFunc

type ComponentCursorEnterHandlerFunc func(args *ComponentCursorEnterEventArgs) //nolint:golint

ComponentCursorEnterHandlerFunc is a function that handles cursor enter events.

type ComponentCursorExitEventArgs

type ComponentCursorExitEventArgs struct {
	Component *component
}

ComponentCursorExitEventArgs are the arguments for cursor exit events.

type ComponentCursorExitHandlerFunc

type ComponentCursorExitHandlerFunc func(args *ComponentCursorExitEventArgs) //nolint:golint

ComponentCursorExitHandlerFunc is a function that handles cursor exit events.

type ComponentMouseButtonPressedEventArgs

type ComponentMouseButtonPressedEventArgs struct {
	Component *component
	Button    ebiten.MouseButton
}

ComponentMouseButtonPressedEventArgs are the arguments for mouse button press events.

type ComponentMouseButtonPressedHandlerFunc

type ComponentMouseButtonPressedHandlerFunc func(args *ComponentMouseButtonPressedEventArgs) //nolint:golint

ComponentMouseButtonPressedHandlerFunc is a function that handles mouse button press events.

type ComponentMouseButtonReleasedEventArgs

type ComponentMouseButtonReleasedEventArgs struct {
	Component *component
	Button    ebiten.MouseButton
	Inside    bool
}

ComponentMouseButtonReleasedEventArgs are the arguments for mouse button release events.

type ComponentMouseButtonReleasedHandlerFunc

type ComponentMouseButtonReleasedHandlerFunc func(args *ComponentMouseButtonReleasedEventArgs) //nolint:golint

ComponentMouseButtonReleasedHandlerFunc is a function that handles mouse button release events.

type ComponentOptions

type ComponentOptions struct {
	Padding  *Padding
	Disabled bool
	Hidden   bool
}

ComponentOptions is a struct that holds component options.

type Container

type Container interface {
	Component
	AddComponent(Component)
	SetBackgroundColor(imgColor.RGBA)
	GetBackgroundColor() imgColor.RGBA
}

func NewContainer added in v0.5.0

func NewContainer(options *ContainerOptions) Container

Newcontainer creates a new simple container

type ContainerOptions added in v0.5.0

type ContainerOptions struct {
	Layout Layout

	Width  *int
	Height *int

	Padding *Padding
}

type DefaultButtonDrawer added in v0.6.0

type DefaultButtonDrawer struct {
	Color         color.RGBA
	ColorPressed  color.RGBA
	ColorHovered  color.RGBA
	ColorDisabled color.RGBA
}

func (DefaultButtonDrawer) Draw added in v0.6.0

func (d DefaultButtonDrawer) Draw(bttn *Button) *ebiten.Image

type DefaultCheckBoxDrawer added in v0.6.0

type DefaultCheckBoxDrawer struct {
	Color color.RGBA
}

func (DefaultCheckBoxDrawer) Draw added in v0.6.0

type DefaultSliderDrawer added in v0.6.0

type DefaultSliderDrawer struct {
	Color         color.RGBA
	ColorPressed  color.RGBA
	ColorHovered  color.RGBA
	ColorDisabled color.RGBA
}

func (DefaultSliderDrawer) Draw added in v0.6.0

func (d DefaultSliderDrawer) Draw(slider *Slider) *ebiten.Image

type GridLayout added in v0.5.0

type GridLayout struct {
	Columns       int
	ColumnsWidths []int
	ColumnGap     int

	Rows        int
	RowsHeights []int
	RowGap      int
	// contains filtered or unexported fields
}

func (*GridLayout) Arrange added in v0.5.0

func (gl *GridLayout) Arrange(c *container, component Component)

func (*GridLayout) Rearrange added in v0.5.0

func (gl *GridLayout) Rearrange(c *container)

func (*GridLayout) Setup added in v0.5.0

func (gl *GridLayout) Setup()

type HorizontalAlignment

type HorizontalAlignment int
const (
	AlignmentLeft HorizontalAlignment = iota
	AlignmentCenteredHorizontally
	AlignmentRight
)

type HorizontalListLayout added in v0.5.0

type HorizontalListLayout struct {
	ColumnGap int
}

func (*HorizontalListLayout) Arrange added in v0.5.0

func (hl *HorizontalListLayout) Arrange(c *container, component Component)

func (*HorizontalListLayout) Rearrange added in v0.5.0

func (hl *HorizontalListLayout) Rearrange(c *container)

type Label

type Label struct {
	Inverted bool
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel(labelText string, options *LabelOptions) *Label

func (*Label) AbsPosX added in v0.5.0

func (c *Label) AbsPosX() float64

AbsPosX returns the component's absolute position X.

func (*Label) AbsPosY added in v0.5.0

func (c *Label) AbsPosY() float64

AbsPosY returns the component's absolute position Y.

func (*Label) AbsPosition added in v0.5.0

func (c *Label) AbsPosition() (posX float64, posY float64)

AbsPosition return the component's absolute position.

func (*Label) AddCursorEnterHandler added in v0.4.0

func (c *Label) AddCursorEnterHandler(f ComponentCursorEnterHandlerFunc) *component

func (*Label) AddCursorExitHandler added in v0.4.0

func (c *Label) AddCursorExitHandler(f ComponentCursorExitHandlerFunc) *component

func (*Label) AddMouseButtonPressedHandler added in v0.4.0

func (c *Label) AddMouseButtonPressedHandler(f ComponentMouseButtonPressedHandlerFunc) *component

func (*Label) AddMouseButtonReleasedHandler added in v0.4.0

func (c *Label) AddMouseButtonReleasedHandler(f ComponentMouseButtonReleasedHandlerFunc) *component

func (*Label) Dimensions added in v0.4.0

func (c *Label) Dimensions() (int, int)

Dimensions returns the component's size (width and height).

func (*Label) Disable added in v0.5.0

func (c *Label) Disable() bool

Disable returns the component's disabled state.

func (*Label) Draw

func (l *Label) Draw() *ebiten.Image

func (*Label) FireEvents

func (c *Label) FireEvents()

FireEvents checks if the mouse cursor is inside the component and fires events accordingly.

func (*Label) Height added in v0.4.0

func (c *Label) Height() int

Height returns the component's height.

func (*Label) HeightWithPadding added in v0.4.0

func (c *Label) HeightWithPadding() int

HeightWithPadding returns the component's height with top and bottom paddings.

func (*Label) Hidden added in v0.5.0

func (c *Label) Hidden() bool

Hidden returns the component's hidden state.

func (*Label) InvertColor

func (l *Label) InvertColor()

func (*Label) PosX added in v0.4.0

func (c *Label) PosX() float64

PosX returns the component's position X.

func (*Label) PosY added in v0.4.0

func (c *Label) PosY() float64

PosY returns the component's position Y.

func (*Label) Position

func (c *Label) Position() (float64, float64)

Position returns the component's position (x and y).

func (*Label) SetDimensions

func (c *Label) SetDimensions(width, height int)

SetDimensions sets the component's dimensions (width and height).

func (*Label) SetDisabled

func (c *Label) SetDisabled(disabled bool)

SetDisabled sets the component's disabled state.

func (*Label) SetHeight

func (c *Label) SetHeight(height int)

SetHeight sets the component's height.

func (*Label) SetHidden added in v0.5.0

func (c *Label) SetHidden(hidden bool)

SetHidden sets the component's hidden state.

func (*Label) SetPosX

func (l *Label) SetPosX(posX float64)

func (*Label) SetPosY

func (l *Label) SetPosY(posY float64)

func (*Label) SetPosision added in v0.4.0

func (c *Label) SetPosision(posX, posY float64)

SetPosision sets the component's position (x and y).

func (*Label) SetPosistion

func (l *Label) SetPosistion(posX, posY float64)

func (*Label) SetText added in v0.5.0

func (l *Label) SetText(labelText string)

func (*Label) SetWidth

func (c *Label) SetWidth(width int)

SetWidth sets the component's width.

func (*Label) Width added in v0.4.0

func (c *Label) Width() int

Width returns the component's width.

func (*Label) WidthWithPadding added in v0.4.0

func (c *Label) WidthWithPadding() int

WidthWithPadding returns the component's width with left and right paddings.

type LabelOptions

type LabelOptions struct {
	Color color.Color
	Font  font.Face

	HorizontalAlignment HorizontalAlignment
	VerticalAlignment   VerticalAlignment

	Inverted bool

	Padding *Padding
}

type Layout added in v0.5.0

type Layout interface {
	Rearrange(*container)
	Arrange(*container, Component)
}

type Padding added in v0.5.0

type Padding struct {
	Top    int
	Bottom int
	Left   int
	Right  int
}
var DefaultPadding Padding = Padding{
	Top:    0,
	Bottom: 0,
	Left:   0,
	Right:  0,
}

func NewPadding added in v0.5.0

func NewPadding(top, right, bottom, left int) *Padding

func (*Padding) Validate added in v0.5.0

func (p *Padding) Validate()

type Slider added in v0.5.0

type Slider struct {
	SlidedEvent *event.Event

	PressedEvent  *event.Event
	ReleasedEvent *event.Event
	ClickedEvent  *event.Event
	// contains filtered or unexported fields
}

func NewSlider added in v0.5.0

func NewSlider(options *SliderOptions) *Slider

func (*Slider) AbsPosX added in v0.5.0

func (c *Slider) AbsPosX() float64

AbsPosX returns the component's absolute position X.

func (*Slider) AbsPosY added in v0.5.0

func (c *Slider) AbsPosY() float64

AbsPosY returns the component's absolute position Y.

func (*Slider) AbsPosition added in v0.5.0

func (c *Slider) AbsPosition() (posX float64, posY float64)

AbsPosition return the component's absolute position.

func (*Slider) AddComponent added in v0.5.0

func (s *Slider) AddComponent(Component)

func (*Slider) AddCursorEnterHandler added in v0.5.0

func (c *Slider) AddCursorEnterHandler(f ComponentCursorEnterHandlerFunc) *component

func (*Slider) AddCursorExitHandler added in v0.5.0

func (c *Slider) AddCursorExitHandler(f ComponentCursorExitHandlerFunc) *component

func (*Slider) AddMouseButtonPressedHandler added in v0.5.0

func (c *Slider) AddMouseButtonPressedHandler(f ComponentMouseButtonPressedHandlerFunc) *component

func (*Slider) AddMouseButtonReleasedHandler added in v0.5.0

func (c *Slider) AddMouseButtonReleasedHandler(f ComponentMouseButtonReleasedHandlerFunc) *component

func (*Slider) AddSlidedHandler added in v0.5.0

func (s *Slider) AddSlidedHandler(f SliderSlidedHandlerFunc) *Slider

func (*Slider) Dimensions added in v0.5.0

func (c *Slider) Dimensions() (int, int)

Dimensions returns the component's size (width and height).

func (*Slider) Disable added in v0.5.0

func (c *Slider) Disable() bool

Disable returns the component's disabled state.

func (*Slider) Draw added in v0.5.0

func (s *Slider) Draw() *ebiten.Image

func (*Slider) FireEvents added in v0.5.0

func (s *Slider) FireEvents()

FireEvents checks if the mouse cursor is inside the component and fires events accordingly.

func (*Slider) GetBackgroundColor added in v0.5.0

func (s *Slider) GetBackgroundColor() color.RGBA

func (*Slider) GetValue added in v0.5.0

func (s *Slider) GetValue() float64

func (*Slider) Height added in v0.5.0

func (c *Slider) Height() int

Height returns the component's height.

func (*Slider) HeightWithPadding added in v0.5.0

func (c *Slider) HeightWithPadding() int

HeightWithPadding returns the component's height with top and bottom paddings.

func (*Slider) Hidden added in v0.5.0

func (c *Slider) Hidden() bool

Hidden returns the component's hidden state.

func (*Slider) PosX added in v0.5.0

func (c *Slider) PosX() float64

PosX returns the component's position X.

func (*Slider) PosY added in v0.5.0

func (c *Slider) PosY() float64

PosY returns the component's position Y.

func (*Slider) Position added in v0.5.0

func (c *Slider) Position() (float64, float64)

Position returns the component's position (x and y).

func (*Slider) Set added in v0.5.0

func (s *Slider) Set(value float64)

func (*Slider) SetBackgroundColor added in v0.5.0

func (s *Slider) SetBackgroundColor(color color.RGBA)

func (*Slider) SetDimensions added in v0.5.0

func (c *Slider) SetDimensions(width, height int)

SetDimensions sets the component's dimensions (width and height).

func (*Slider) SetDisabled added in v0.5.0

func (s *Slider) SetDisabled(disabled bool)

func (*Slider) SetHeight added in v0.5.0

func (c *Slider) SetHeight(height int)

SetHeight sets the component's height.

func (*Slider) SetHidden added in v0.5.0

func (c *Slider) SetHidden(hidden bool)

SetHidden sets the component's hidden state.

func (*Slider) SetPosX added in v0.5.0

func (c *Slider) SetPosX(posX float64)

SetPosX sets the component's position X.

func (*Slider) SetPosY added in v0.5.0

func (c *Slider) SetPosY(posY float64)

SetPosY sets the component's position Y.

func (*Slider) SetPosision added in v0.5.0

func (s *Slider) SetPosision(posX, posY float64)

func (*Slider) SetWidth added in v0.5.0

func (c *Slider) SetWidth(width int)

SetWidth sets the component's width.

func (*Slider) Width added in v0.5.0

func (c *Slider) Width() int

Width returns the component's width.

func (*Slider) WidthWithPadding added in v0.5.0

func (c *Slider) WidthWithPadding() int

WidthWithPadding returns the component's width with left and right paddings.

type SliderClickedEventArgs added in v0.5.0

type SliderClickedEventArgs struct {
	Slider *Slider
}

type SliderClickedHandlerFunc added in v0.5.0

type SliderClickedHandlerFunc func(args *SliderClickedEventArgs)

type SliderDrawer added in v0.6.0

type SliderDrawer interface {
	Draw(slider *Slider) *ebiten.Image
}

type SliderOptions added in v0.5.0

type SliderOptions struct {
	Min          *float64
	Max          *float64
	Step         *float64
	DefaultValue *float64

	Width  *int
	Height *int

	Padding *Padding

	Drawer       SliderDrawer
	HandleDrawer ButtonDrawer
}

type SliderPressedEventArgs added in v0.5.0

type SliderPressedEventArgs struct {
	Slider *Slider
}

type SliderPressedHandlerFunc added in v0.5.0

type SliderPressedHandlerFunc func(args *SliderPressedEventArgs)

type SliderReleasedEventArgs added in v0.5.0

type SliderReleasedEventArgs struct {
	Slider *Slider
	Inside bool
}

type SliderReleasedHandlerFunc added in v0.5.0

type SliderReleasedHandlerFunc func(args *SliderReleasedEventArgs)

type SliderSlidedEventArgs added in v0.5.0

type SliderSlidedEventArgs struct {
	Slider *Slider
	Value  float64
}

type SliderSlidedHandlerFunc added in v0.5.0

type SliderSlidedHandlerFunc func(args *SliderSlidedEventArgs)

type Sprite added in v0.6.0

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

func NewSprite added in v0.6.0

func NewSprite(image *ebiten.Image, options *SpriteOptions) *Sprite

func (*Sprite) AbsPosX added in v0.6.0

func (c *Sprite) AbsPosX() float64

AbsPosX returns the component's absolute position X.

func (*Sprite) AbsPosY added in v0.6.0

func (c *Sprite) AbsPosY() float64

AbsPosY returns the component's absolute position Y.

func (*Sprite) AbsPosition added in v0.6.0

func (c *Sprite) AbsPosition() (posX float64, posY float64)

AbsPosition return the component's absolute position.

func (*Sprite) AddCursorEnterHandler added in v0.6.0

func (c *Sprite) AddCursorEnterHandler(f ComponentCursorEnterHandlerFunc) *component

func (*Sprite) AddCursorExitHandler added in v0.6.0

func (c *Sprite) AddCursorExitHandler(f ComponentCursorExitHandlerFunc) *component

func (*Sprite) AddMouseButtonPressedHandler added in v0.6.0

func (c *Sprite) AddMouseButtonPressedHandler(f ComponentMouseButtonPressedHandlerFunc) *component

func (*Sprite) AddMouseButtonReleasedHandler added in v0.6.0

func (c *Sprite) AddMouseButtonReleasedHandler(f ComponentMouseButtonReleasedHandlerFunc) *component

func (*Sprite) Dimensions added in v0.6.0

func (c *Sprite) Dimensions() (int, int)

Dimensions returns the component's size (width and height).

func (*Sprite) Disable added in v0.6.0

func (c *Sprite) Disable() bool

Disable returns the component's disabled state.

func (*Sprite) Draw added in v0.6.0

func (s *Sprite) Draw() *ebiten.Image

func (*Sprite) FireEvents added in v0.6.0

func (c *Sprite) FireEvents()

FireEvents checks if the mouse cursor is inside the component and fires events accordingly.

func (*Sprite) Height added in v0.6.0

func (c *Sprite) Height() int

Height returns the component's height.

func (*Sprite) HeightWithPadding added in v0.6.0

func (c *Sprite) HeightWithPadding() int

HeightWithPadding returns the component's height with top and bottom paddings.

func (*Sprite) Hidden added in v0.6.0

func (c *Sprite) Hidden() bool

Hidden returns the component's hidden state.

func (*Sprite) PosX added in v0.6.0

func (c *Sprite) PosX() float64

PosX returns the component's position X.

func (*Sprite) PosY added in v0.6.0

func (c *Sprite) PosY() float64

PosY returns the component's position Y.

func (*Sprite) Position added in v0.6.0

func (c *Sprite) Position() (float64, float64)

Position returns the component's position (x and y).

func (*Sprite) SetDimensions added in v0.6.0

func (c *Sprite) SetDimensions(width, height int)

SetDimensions sets the component's dimensions (width and height).

func (*Sprite) SetDisabled added in v0.6.0

func (c *Sprite) SetDisabled(disabled bool)

SetDisabled sets the component's disabled state.

func (*Sprite) SetHeight added in v0.6.0

func (c *Sprite) SetHeight(height int)

SetHeight sets the component's height.

func (*Sprite) SetHidden added in v0.6.0

func (c *Sprite) SetHidden(hidden bool)

SetHidden sets the component's hidden state.

func (*Sprite) SetImage added in v0.6.0

func (s *Sprite) SetImage(image *ebiten.Image)

func (*Sprite) SetPosX added in v0.6.0

func (c *Sprite) SetPosX(posX float64)

SetPosX sets the component's position X.

func (*Sprite) SetPosY added in v0.6.0

func (c *Sprite) SetPosY(posY float64)

SetPosY sets the component's position Y.

func (*Sprite) SetPosision added in v0.6.0

func (c *Sprite) SetPosision(posX, posY float64)

SetPosision sets the component's position (x and y).

func (*Sprite) SetWidth added in v0.6.0

func (c *Sprite) SetWidth(width int)

SetWidth sets the component's width.

func (*Sprite) Width added in v0.6.0

func (c *Sprite) Width() int

Width returns the component's width.

func (*Sprite) WidthWithPadding added in v0.6.0

func (c *Sprite) WidthWithPadding() int

WidthWithPadding returns the component's width with left and right paddings.

type SpriteOptions added in v0.6.0

type SpriteOptions struct {
	Padding *Padding
}

type VerticalAlignment

type VerticalAlignment int
const (
	AlignmentTop VerticalAlignment = iota
	AlignmentCenteredVertically
	AlignmentBottom
)

type VerticalListLayout added in v0.5.0

type VerticalListLayout struct {
	RowGap int
}

func (*VerticalListLayout) Arrange added in v0.5.0

func (vl *VerticalListLayout) Arrange(c *container, component Component)

func (*VerticalListLayout) Rearrange added in v0.5.0

func (vl *VerticalListLayout) Rearrange(c *container)

Jump to

Keyboard shortcuts

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