yuai

package module
v0.0.0-...-4d42dd7 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

yuai

A GUI library for Ebiten

Documentation

Index

Constants

View Source
const (
	HAlignLeft = HAlign(iota)
	HAlignCenter
	HAlignRight
)
View Source
const (
	VAlignTop = VAlign(iota)
	VAlignMiddle
	VAlignBottom
)

Variables

This section is empty.

Functions

func CalculateBounds

func CalculateBounds(text string, font font.Face) (int, int)

func DrawColoredRect

func DrawColoredRect(target *ebiten.Image, x, y, w, h int, r, g, b, alpha uint8)

func GetLastDeviceScale

func GetLastDeviceScale() float64

func ScaleToDevice

func ScaleToDevice(x int) int

func SetDeviceScale

func SetDeviceScale(scale float64)

func UnscaleFromDevice

func UnscaleFromDevice(x int) int

Types

type Button

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

func (*Button) GetRequestedSize

func (b *Button) GetRequestedSize() (int, int)

func (*Button) GetVisible

func (b *Button) GetVisible() bool

func (*Button) Invalidate

func (b *Button) Invalidate()

func (*Button) IsEnabled

func (b *Button) IsEnabled() bool

func (*Button) Render

func (b *Button) Render(screen *ebiten.Image, x, y, width, height int)

func (*Button) SetEnabled

func (b *Button) SetEnabled(enabled bool)

func (*Button) SetVisible

func (b *Button) SetVisible(visible bool)

func (*Button) Update

func (b *Button) Update() (dirty bool)

type Desktop

type Desktop struct {
	Config UIConfig
	// contains filtered or unexported fields
}

func CreateDesktop

func CreateDesktop(x, y, width, height int, configFile string) (*Desktop, error)

func (*Desktop) CreateButton

func (d *Desktop) CreateButton(caption string, onClick func()) *Button

func (*Desktop) CreateHBox

func (d *Desktop) CreateHBox() *HBox

func (*Desktop) CreatePanel

func (d *Desktop) CreatePanel() *Panel

func (*Desktop) CreateVBox

func (d *Desktop) CreateVBox() *VBox

func (*Desktop) Draw

func (d *Desktop) Draw(screen *ebiten.Image)

func (*Desktop) Layout

func (d *Desktop) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*Desktop) RegenerateFonts

func (d *Desktop) RegenerateFonts()

RegenerateFonts regenerates the fonts (at startup and when dragging to a different DPI display).

func (*Desktop) SetPrimaryWidget

func (d *Desktop) SetPrimaryWidget(widget Widget)

func (*Desktop) Update

func (d *Desktop) Update()

type FontConfig

type FontConfig struct {
	Normal     FontItemConfig `json:"normal"`
	Symbols    FontItemConfig `json:"symbols"`
	Monospaced FontItemConfig `json:"monospaced"`
	Info       FontItemConfig `json:"info"`
}

type FontItemConfig

type FontItemConfig struct {
	Face string `json:"face"`
	Size int    `json:"size"`
}

type HAlign

type HAlign = int

type HBox

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

func (*HBox) AddChild

func (h *HBox) AddChild(widget Widget)

func (*HBox) GetAlignment

func (h *HBox) GetAlignment() HAlign

func (*HBox) GetChildSpacing

func (h *HBox) GetChildSpacing() int

func (*HBox) GetExpandChild

func (h *HBox) GetExpandChild() bool

func (*HBox) GetPadding

func (h *HBox) GetPadding() int

func (*HBox) GetRequestedSize

func (h *HBox) GetRequestedSize() (int, int)

func (*HBox) Invalidate

func (h *HBox) Invalidate()

func (*HBox) Render

func (h *HBox) Render(screen *ebiten.Image, x, y, width, height int)

func (*HBox) SetAlignment

func (h *HBox) SetAlignment(align HAlign)

func (*HBox) SetChildSpacing

func (h *HBox) SetChildSpacing(spacing int)

func (*HBox) SetExpandChild

func (h *HBox) SetExpandChild(expand bool)

func (*HBox) SetPadding

func (h *HBox) SetPadding(padding int)

func (*HBox) SetStretchComponent

func (h *HBox) SetStretchComponent(widget Widget)

func (*HBox) Update

func (h *HBox) Update() (dirty bool)

type Panel

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

func (Panel) GetRequestedSize

func (p Panel) GetRequestedSize() (int, int)

func (Panel) Invalidate

func (p Panel) Invalidate()

func (Panel) Render

func (p Panel) Render(screen *ebiten.Image, x, y, width, height int)

func (Panel) Update

func (p Panel) Update() (dirty bool)

type UIColorConfig

type UIColorConfig struct {
	WindowBackground []uint8 `json:"windowBackground"`
	Text             []uint8 `json:"text"`
	Primary          []uint8 `json:"primary"`
	PrimaryHighlight []uint8 `json:"primaryHighlight"`
	Disabled         []uint8 `json:"disabled"`
	DisabledText     []uint8 `json:"disabledText"`
	PanelBackground  []uint8 `json:"panelBackground"`
}

type UIConfig

type UIConfig struct {
	Colors UIColorConfig `json:"colors"`
	Fonts  FontConfig    `json:"fonts"`
}

func (*UIConfig) Load

func (c *UIConfig) Load(fileName string)

type VAlign

type VAlign = int

type VBox

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

func (*VBox) AddChild

func (v *VBox) AddChild(widget Widget)

func (*VBox) GetAlignment

func (v *VBox) GetAlignment() VAlign

func (*VBox) GetChildSpacing

func (v *VBox) GetChildSpacing() int

func (*VBox) GetExpandChild

func (v *VBox) GetExpandChild() bool

func (*VBox) GetPadding

func (v *VBox) GetPadding() int

func (*VBox) GetRequestedSize

func (v *VBox) GetRequestedSize() (int, int)

func (*VBox) Invalidate

func (v *VBox) Invalidate()

func (*VBox) Render

func (v *VBox) Render(screen *ebiten.Image, x, y, width, height int)

func (*VBox) SetAlignment

func (v *VBox) SetAlignment(align VAlign)

func (*VBox) SetChildSpacing

func (v *VBox) SetChildSpacing(spacing int)

func (*VBox) SetExpandChild

func (v *VBox) SetExpandChild(expand bool)

func (*VBox) SetPadding

func (v *VBox) SetPadding(padding int)

func (*VBox) SetStretchComponent

func (v *VBox) SetStretchComponent(widget Widget)

func (*VBox) Update

func (v *VBox) Update() (dirty bool)

type Widget

type Widget interface {
	// Render renders the widget.
	Render(screen *ebiten.Image, x, y, width, height int)

	// Update updates the widget.
	Update() (dirty bool)

	// GetRequestedSize returns the size the widget wants to be.
	GetRequestedSize() (int, int)

	// Invalidate causes the widget to recalculate itself and invalid all of its children.
	Invalidate()
}

Widget is an abstract representation of a UI widget.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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