ui

package
v0.0.0-...-d37d129 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Width  = 1920.0
	Height = 1080.0
)

Variables

View Source
var BackgroundColor = color.RGBA{R: 255, G: 255, B: 255, A: 255}
View Source
var (
	CancelButtonColorPalette = ButtonColorPalette{
		BackgroundColor:        colornames.Red,
		BackgroundColorHovered: colornames.Darkred,
		TextColor:              colornames.Whitesmoke,
		TextColorHovered:       colornames.White,
	}
)

Functions

func NewDecideScreen

func NewDecideScreen(herderLegacy herderlegacy.HerderLegacy, config DecideScreenConfig) herderlegacy.Screen

func NewListScreen

func NewListScreen(herderLegacy herderlegacy.HerderLegacy, config ListScreenConfig) herderlegacy.Screen

func NewMessageScreen

func NewMessageScreen(herderLegacy herderlegacy.HerderLegacy, config MessageScreenConfig) herderlegacy.Screen

Types

type Button

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

func NewButton

func NewButton(config ButtonConfig) *Button

func (*Button) Callback

func (b *Button) Callback() func()

func (*Button) ColorPalette

func (b *Button) ColorPalette() ButtonColorPalette

func (*Button) Disabled

func (b *Button) Disabled() bool

func (*Button) Draw

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

func (*Button) Position

func (b *Button) Position() Position

func (*Button) SetCallback

func (b *Button) SetCallback(callback func())

func (*Button) SetColorPalette

func (b *Button) SetColorPalette(colorPalette ButtonColorPalette)

func (*Button) SetDisabled

func (b *Button) SetDisabled(disabled bool)

func (*Button) SetPosition

func (b *Button) SetPosition(position Position)

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
	BackgroundColorHovered color.Color
	TextColor              color.Color
	TextColorHovered       color.Color

	BackgroundColorDisabled        color.Color
	BackgroundColorHoveredDisabled color.Color
	TextColorDisabled              color.Color
	TextColorHoveredDisabled       color.Color
}

type ButtonConfig

type ButtonConfig struct {
	Position           Position
	Text               string
	CustomColorPalette bool
	ColorPalette       ButtonColorPalette
	Silent             bool
	Callback           func()
	Disabled           bool
}

type Component

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

type Countdown

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

func NewCountdown

func NewCountdown(config CountdownConfig) *Countdown

func (*Countdown) Abgelaufen

func (c *Countdown) Abgelaufen() bool

func (*Countdown) AbgelaufenCallback

func (c *Countdown) AbgelaufenCallback() func()

func (*Countdown) Draw

func (c *Countdown) Draw(screen *ebiten.Image)

func (*Countdown) Position

func (c *Countdown) Position() Position

func (*Countdown) SetAbgelaufenCallback

func (c *Countdown) SetAbgelaufenCallback(callback func())

func (*Countdown) SetPosition

func (c *Countdown) SetPosition(position Position)

func (*Countdown) SetVerbleibendeZeit

func (c *Countdown) SetVerbleibendeZeit(zeit int)

func (*Countdown) Update

func (c *Countdown) Update()

func (*Countdown) VerbleibendeZeit

func (c *Countdown) VerbleibendeZeit() int

type CountdownColorPalette

type CountdownColorPalette struct {
	Color      color.Color
	HoverColor color.Color

	LittleTimeColor      color.Color
	LittleTimeHoverColor color.Color
}

type CountdownConfig

type CountdownConfig struct {
	Position           Position
	StartZeit          int
	AbgelaufenCallback func()
	CustomColorPalette bool
	ColorPalette       CountdownColorPalette
}

type DecideScreenConfig

type DecideScreenConfig struct {
	Title string
	Text  string

	CancelText   string
	CancelAction func() herderlegacy.Screen

	ConfirmText   string
	ConfirmAction func() herderlegacy.Screen
}

type HorizontalerAnchor

type HorizontalerAnchor float64
const (
	HorizontalerAnchorLinks  HorizontalerAnchor = 0
	HorizontalerAnchorMitte  HorizontalerAnchor = 0.5
	HorizontalerAnchorRechts HorizontalerAnchor = 1
)

type ListScreenButtonWidget

type ListScreenButtonWidget struct {
	Text     string
	Callback func()

	CustomColorPalette bool
	ColorPalette       ButtonColorPalette
}

type ListScreenConfig

type ListScreenConfig struct {
	Title   string
	Text    string
	Widgets []ListScreenWidget

	CancelText   string
	CancelAction func() herderlegacy.Screen
}

type ListScreenSelectionWidget

type ListScreenSelectionWidget[T any] struct {
	Text     string
	Value    T
	Values   []T
	Callback func(T)
	ToString func(T) string
}

type ListScreenToggleWidget

type ListScreenToggleWidget struct {
	Text     string
	Callback func(bool)
	Enabled  bool
}

type ListScreenWidget

type ListScreenWidget interface {
	// contains filtered or unexported methods
}

type MessageScreenConfig

type MessageScreenConfig struct {
	Title          string
	Text           string
	ContinueText   string
	ContinueAction func() herderlegacy.Screen
}

type Position

type Position struct {
	X, Y             float64
	AnchorHorizontal HorizontalerAnchor
	AnchorVertikal   VertikalerAnchor
}

func NewCenteredPosition

func NewCenteredPosition(x, y float64) Position

type Selection

type Selection[T any] struct {
	// contains filtered or unexported fields
}

func NewSelection

func NewSelection[T any](herderLegacy herderlegacy.HerderLegacy, config SelectionConfig[T]) *Selection[T]

func (*Selection[T]) Draw

func (s *Selection[T]) Draw(screen *ebiten.Image)

func (*Selection[T]) Position

func (s *Selection[T]) Position() Position

func (*Selection[T]) SetPosition

func (s *Selection[T]) SetPosition(position Position)

func (*Selection[T]) SetValue

func (s *Selection[T]) SetValue(value T)

func (*Selection[T]) Update

func (s *Selection[T]) Update()

func (*Selection[T]) Value

func (s *Selection[T]) Value() T

type SelectionConfig

type SelectionConfig[T any] struct {
	Position Position
	Text     string
	Value    T
	Values   []T
	ToString func(T) string
	Callback func(T)
}

type Text

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

func NewText

func NewText(config TextConfig) *Text

func (*Text) ColorPalette

func (t *Text) ColorPalette() TextColorPalatte

func (*Text) Draw

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

func (*Text) Position

func (t *Text) Position() Position

func (*Text) SetColorPalette

func (t *Text) SetColorPalette(colorPalette TextColorPalatte)

func (*Text) SetPosition

func (t *Text) SetPosition(position Position)

func (*Text) SetText

func (t *Text) SetText(text string)

func (*Text) Text

func (t *Text) Text() string

func (*Text) Update

func (t *Text) Update()

type TextColorPalatte

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

type TextConfig

type TextConfig struct {
	Position           Position
	Text               string
	CustomColorPalette bool
	ColorPalette       TextColorPalatte
}

type Title

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

func NewTitle

func NewTitle(config TitleConfig) *Title

func (*Title) ColorPalette

func (t *Title) ColorPalette() TitleColorPalette

func (*Title) Draw

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

func (*Title) Position

func (t *Title) Position() Position

func (*Title) SetColorPalette

func (t *Title) SetColorPalette(colorPalette TitleColorPalette)

func (*Title) SetPosition

func (t *Title) SetPosition(position Position)

func (*Title) SetText

func (t *Title) SetText(text string)

func (*Title) Text

func (t *Title) Text() string

func (*Title) Update

func (t *Title) Update()

type TitleColorPalette

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

type TitleConfig

type TitleConfig struct {
	Position           Position
	Text               string
	CustomColorPalette bool
	ColorPalette       TitleColorPalette
}

type Toggle

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

func NewToggle

func NewToggle(config ToggleConfig) *Toggle

func (*Toggle) Draw

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

func (*Toggle) Enabled

func (t *Toggle) Enabled() bool

func (*Toggle) Position

func (t *Toggle) Position() Position

func (*Toggle) SetEnabled

func (t *Toggle) SetEnabled(enabled bool)

func (*Toggle) SetPosition

func (t *Toggle) SetPosition(position Position)

func (*Toggle) Update

func (t *Toggle) Update()

type ToggleConfig

type ToggleConfig struct {
	Position Position
	Text     string
	Enabled  bool
	Callback func(bool)
}

type VertikalerAnchor

type VertikalerAnchor float64
const (
	VertikalerAnchorOben  VertikalerAnchor = 0
	VertikalerAnchorMitte VertikalerAnchor = 0.5
	VertikalerAnchorUnten VertikalerAnchor = 1
)

Jump to

Keyboard shortcuts

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