ui

package
v0.0.0-...-1330837 Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const PADDING_SIZE = 24

Variables

View Source
var (
	ForegroundColor color.Color = color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}
	BackgroundColor color.Color = color.RGBA{R: 0x24, G: 0x24, B: 0x24, A: 0xff}
	Transparent     color.Color = color.Transparent
)

Functions

This section is empty.

Types

type Container

type Container interface {
	Position() (int, int)
	Size() (int, int)
	Rect() (int, int, int, int)
	Widgets() []Widget
	FindWidgetAt(int, int) Widget
	LayoutWidgets()
	StartDrag()
	DragBy(int, int)
	StopDrag()
	CancelDrag()
	Tapped()
	Visible() bool
	Show()
	Hide()
	Layout(int, int) (int, int)
	Update()
	Draw(*ebiten.Image)
}

Container is an interface for a UI widget

type ContainerBase

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

func (*ContainerBase) Draw

func (cb *ContainerBase) Draw(screen *ebiten.Image)

func (*ContainerBase) FindWidgetAt

func (cb *ContainerBase) FindWidgetAt(x, y int) Widget

func (*ContainerBase) Position

func (cb *ContainerBase) Position() (int, int)

func (*ContainerBase) Rect

func (cb *ContainerBase) Rect() (int, int, int, int)

func (*ContainerBase) Size

func (cb *ContainerBase) Size() (int, int)

func (*ContainerBase) Widgets

func (cb *ContainerBase) Widgets() []Widget

type Label

type Label struct {
	WidgetBase
	// contains filtered or unexported fields
}

Label is a button that display some text

func NewLabel

func NewLabel(parent Container, id string, align gg.Align, text string, fontFace font.Face, requestType string) *Label

func (*Label) Activate

func (l *Label) Activate()

func (*Label) Deactivate

func (l *Label) Deactivate()

func (*Label) Tapped

func (l *Label) Tapped()

func (*Label) UpdateText

func (l *Label) UpdateText(text string)

type PanelBase

type PanelBase struct {
	ContainerBase
}

func (*PanelBase) CancelDrag

func (pb *PanelBase) CancelDrag()

func (*PanelBase) DragBy

func (pb *PanelBase) DragBy(dx, dy int)

func (*PanelBase) Hide

func (pb *PanelBase) Hide()

func (*PanelBase) Layout

func (pb *PanelBase) Layout(outsideWidth, outsideHeight int) (int, int)

func (*PanelBase) LayoutWidgets

func (pb *PanelBase) LayoutWidgets()

Layout widgets that belong to this container by setting the x,y of each relative to their parent

func (*PanelBase) Show

func (pb *PanelBase) Show()

func (*PanelBase) StartDrag

func (pb *PanelBase) StartDrag()

func (*PanelBase) StopDrag

func (pb *PanelBase) StopDrag()

func (*PanelBase) Tapped

func (pb *PanelBase) Tapped()

func (*PanelBase) Update

func (pb *PanelBase) Update()

func (*PanelBase) Visible

func (pb *PanelBase) Visible() bool

type StatusPanel

type StatusPanel struct {
	DayLabel *Label
	PanelBase
}

func NewStatusPanel

func NewStatusPanel() *StatusPanel

type UI

type UI struct {
	StatusPanel *StatusPanel
	// contains filtered or unexported fields
}

func New

func New() *UI

func (*UI) Draw

func (u *UI) Draw(screen *ebiten.Image)

func (*UI) Layout

func (u *UI) Layout(outsideWidth, outsideHeight int) (int, int)

func (*UI) Update

func (u *UI) Update()

type Widget

type Widget interface {
	Parent() Container
	ID() string
	Size() (int, int)
	Position() (int, int)
	Rect() (int, int, int, int)
	OffsetRect() (int, int, int, int)
	SetPosition(int, int)
	Align() gg.Align
	Disabled() bool
	Activate()
	Deactivate()
	Tapped()
	Update()
	Draw(*ebiten.Image)
}

IWidget is an interface for widget

type WidgetBase

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

Widget base is a button that display a single icon

func (*WidgetBase) Activate

func (wb *WidgetBase) Activate()

func (*WidgetBase) Align

func (wb *WidgetBase) Align() gg.Align

func (*WidgetBase) Deactivate

func (wb *WidgetBase) Deactivate()

func (*WidgetBase) Disabled

func (wb *WidgetBase) Disabled() bool

func (*WidgetBase) Draw

func (wb *WidgetBase) Draw(screen *ebiten.Image)

func (*WidgetBase) ID

func (wb *WidgetBase) ID() string

func (*WidgetBase) OffsetRect

func (wb *WidgetBase) OffsetRect() (int, int, int, int)

func (*WidgetBase) Parent

func (wb *WidgetBase) Parent() Container

func (*WidgetBase) Position

func (wb *WidgetBase) Position() (int, int)

func (*WidgetBase) Rect

func (wb *WidgetBase) Rect() (int, int, int, int)

func (*WidgetBase) SetPosition

func (wb *WidgetBase) SetPosition(x, y int)

func (*WidgetBase) Size

func (wb *WidgetBase) Size() (int, int)

func (*WidgetBase) Tapped

func (wb *WidgetBase) Tapped()

func (*WidgetBase) Update

func (wb *WidgetBase) Update()

Jump to

Keyboard shortcuts

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