ui

package
v0.0.0-...-7de579e Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BackgroundColor = color.RGBA{R: 255, G: 255, B: 255, A: 255}
	ButtonColors    = ButtonColorPalette{
		BackgroundColor:      color.RGBA{R: 18, G: 53, B: 91, A: 255},
		BackgroundHoverColor: color.RGBA{R: 134, G: 22, B: 87, A: 255},
		TextColor:            color.RGBA{R: 212, G: 245, B: 245, A: 255},
		TextHoverColor:       color.RGBA{R: 212, G: 245, B: 245, A: 255},
	}
	DisabledButtonColors = ButtonColorPalette{
		BackgroundColor:      color.RGBA{R: 42, G: 59, B: 82, A: 255},
		BackgroundHoverColor: color.RGBA{R: 29, G: 37, B: 48, A: 255},
		TextColor:            color.RGBA{R: 212, G: 245, B: 245, A: 255},
	}
	TextColors = TextColorPalette{
		Color:      color.RGBA{R: 87, G: 70, B: 123, A: 255},
		HoverColor: color.RGBA{R: 82, G: 73, B: 72, A: 255},
	}
	TitleColors = TextColorPalette{
		Color:      color.RGBA{R: 87, G: 70, B: 123, A: 255},
		HoverColor: color.RGBA{R: 112, G: 248, B: 186, A: 255},
	}
)

Functions

func IsClicked

func IsClicked(p Position, width, height int, btn ebiten.MouseButton) bool

func IsHovered

func IsHovered(p Position, width, height int) bool

func IsInside

func IsInside(pos Position, width, height, x, y int) bool

Types

type Button

type Button struct {
	Pos      Position
	Callback func()
	// contains filtered or unexported fields
}

func NewButton

func NewButton(config ButtonConfig) *Button

func (*Button) Colors

func (b *Button) Colors() *ButtonColorPalette

func (*Button) Draw

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

func (*Button) SetColors

func (b *Button) SetColors(colors *ButtonColorPalette)

func (*Button) SetText

func (b *Button) SetText(text string)

func (*Button) Text

func (b *Button) Text() string

func (*Button) Update

func (b *Button) Update()

type ButtonColorPalette

type ButtonColorPalette struct {
	BackgroundColor      color.Color
	BackgroundHoverColor color.Color
	TextColor            color.Color
	TextHoverColor       color.Color
}

type ButtonConfig

type ButtonConfig struct {
	Pos      Position
	Text     string
	Colors   *ButtonColorPalette
	Callback func()
}

type CenteredPosition

type CenteredPosition struct {
	X, Y int
}

func (CenteredPosition) TopLeftCorner

func (c CenteredPosition) TopLeftCorner(width, height int) (int, int)

type Component

type Component interface {
	Update()
	Draw(screen *ebiten.Image)
}

type DynamicPosition

type DynamicPosition func(width, height int) Position

func (DynamicPosition) TopLeftCorner

func (d DynamicPosition) TopLeftCorner(width, height int) (int, int)

type Position

type Position interface {
	TopLeftCorner(width, height int) (int, int)
}

type Text

type Text struct {
	Pos    Position
	Text   string
	Colors *TextColorPalette
	Font   font.Face
}

func NewText

func NewText(config TextConfig) *Text

func (*Text) Draw

func (t *Text) Draw(screen *ebiten.Image)

func (*Text) Update

func (t *Text) Update()

type TextColorPalette

type TextColorPalette struct {
	Color      color.Color
	HoverColor color.Color
}

type TextConfig

type TextConfig struct {
	Pos    Position
	Text   string
	Colors *TextColorPalette
	Font   font.Face
}

type TopLeftCornerPosition

type TopLeftCornerPosition struct {
	X, Y int
}

func (TopLeftCornerPosition) TopLeftCorner

func (t TopLeftCornerPosition) TopLeftCorner(int, int) (int, int)

Jump to

Keyboard shortcuts

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