ui

package
v0.0.0-...-ecfa503 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button struct {
	X, Y          int
	Width, Height int
	Label         string
	OnClick       func()

	Input InputHandler
	// contains filtered or unexported fields
}

Button represents a simple UI button.

func NewButton

func NewButton(x, y, width, height int, label string, onClick func()) *Button

func (*Button) Draw

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

func (*Button) Update

func (b *Button) Update()

type DefaultInputHandler

type DefaultInputHandler struct{}

DefaultInputHandler is the default implementation using Ebiten.

func (*DefaultInputHandler) CursorPosition

func (d *DefaultInputHandler) CursorPosition() (int, int)

func (*DefaultInputHandler) IsMouseButtonPressed

func (d *DefaultInputHandler) IsMouseButtonPressed(button ebiten.MouseButton) bool

type InputHandler

type InputHandler interface {
	CursorPosition() (int, int)
	IsMouseButtonPressed(button ebiten.MouseButton) bool
}

InputHandler abstracts input handling for testing.

Jump to

Keyboard shortcuts

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