Documentation
¶
Index ¶
- Constants
- func CalculateBounds(text string, font font.Face) (int, int)
- func DrawColoredRect(target *ebiten.Image, x, y, w, h int, r, g, b, alpha uint8)
- func GetLastDeviceScale() float64
- func ScaleToDevice(x int) int
- func SetDeviceScale(scale float64)
- func UnscaleFromDevice(x int) int
- type Button
- func (b *Button) GetRequestedSize() (int, int)
- func (b *Button) GetVisible() bool
- func (b *Button) Invalidate()
- func (b *Button) IsEnabled() bool
- func (b *Button) Render(screen *ebiten.Image, x, y, width, height int)
- func (b *Button) SetEnabled(enabled bool)
- func (b *Button) SetVisible(visible bool)
- func (b *Button) Update() (dirty bool)
- type Desktop
- func (d *Desktop) CreateButton(caption string, onClick func()) *Button
- func (d *Desktop) CreateHBox() *HBox
- func (d *Desktop) CreatePanel() *Panel
- func (d *Desktop) CreateVBox() *VBox
- func (d *Desktop) Draw(screen *ebiten.Image)
- func (d *Desktop) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)
- func (d *Desktop) RegenerateFonts()
- func (d *Desktop) SetPrimaryWidget(widget Widget)
- func (d *Desktop) Update()
- type FontConfig
- type FontItemConfig
- type HAlign
- type HBox
- func (h *HBox) AddChild(widget Widget)
- func (h *HBox) GetAlignment() HAlign
- func (h *HBox) GetChildSpacing() int
- func (h *HBox) GetExpandChild() bool
- func (h *HBox) GetPadding() int
- func (h *HBox) GetRequestedSize() (int, int)
- func (h *HBox) Invalidate()
- func (h *HBox) Render(screen *ebiten.Image, x, y, width, height int)
- func (h *HBox) SetAlignment(align HAlign)
- func (h *HBox) SetChildSpacing(spacing int)
- func (h *HBox) SetExpandChild(expand bool)
- func (h *HBox) SetPadding(padding int)
- func (h *HBox) SetStretchComponent(widget Widget)
- func (h *HBox) Update() (dirty bool)
- type Panel
- type UIColorConfig
- type UIConfig
- type VAlign
- type VBox
- func (v *VBox) AddChild(widget Widget)
- func (v *VBox) GetAlignment() VAlign
- func (v *VBox) GetChildSpacing() int
- func (v *VBox) GetExpandChild() bool
- func (v *VBox) GetPadding() int
- func (v *VBox) GetRequestedSize() (int, int)
- func (v *VBox) Invalidate()
- func (v *VBox) Render(screen *ebiten.Image, x, y, width, height int)
- func (v *VBox) SetAlignment(align VAlign)
- func (v *VBox) SetChildSpacing(spacing int)
- func (v *VBox) SetExpandChild(expand bool)
- func (v *VBox) SetPadding(padding int)
- func (v *VBox) SetStretchComponent(widget Widget)
- func (v *VBox) Update() (dirty bool)
- type Widget
Constants ¶
View Source
const ( HAlignLeft = HAlign(iota) HAlignCenter HAlignRight )
View Source
const ( VAlignTop = VAlign(iota) VAlignMiddle VAlignBottom )
Variables ¶
This section is empty.
Functions ¶
func DrawColoredRect ¶
func GetLastDeviceScale ¶
func GetLastDeviceScale() float64
func ScaleToDevice ¶
func SetDeviceScale ¶
func SetDeviceScale(scale float64)
func UnscaleFromDevice ¶
Types ¶
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
func (*Button) GetRequestedSize ¶
func (*Button) GetVisible ¶
func (*Button) Invalidate ¶
func (b *Button) Invalidate()
func (*Button) SetEnabled ¶
func (*Button) SetVisible ¶
type Desktop ¶
type Desktop struct { Config UIConfig // contains filtered or unexported fields }
func CreateDesktop ¶
func (*Desktop) CreateButton ¶
func (*Desktop) CreateHBox ¶
func (*Desktop) CreatePanel ¶
func (*Desktop) CreateVBox ¶
func (*Desktop) RegenerateFonts ¶
func (d *Desktop) RegenerateFonts()
RegenerateFonts regenerates the fonts (at startup and when dragging to a different DPI display).
func (*Desktop) SetPrimaryWidget ¶
type FontConfig ¶
type FontConfig struct { Normal FontItemConfig `json:"normal"` Symbols FontItemConfig `json:"symbols"` Monospaced FontItemConfig `json:"monospaced"` Info FontItemConfig `json:"info"` }
type FontItemConfig ¶
type HBox ¶
type HBox struct {
// contains filtered or unexported fields
}
func (*HBox) GetAlignment ¶
func (*HBox) GetChildSpacing ¶
func (*HBox) GetExpandChild ¶
func (*HBox) GetPadding ¶
func (*HBox) GetRequestedSize ¶
func (*HBox) Invalidate ¶
func (h *HBox) Invalidate()
func (*HBox) SetAlignment ¶
func (*HBox) SetChildSpacing ¶
func (*HBox) SetExpandChild ¶
func (*HBox) SetPadding ¶
func (*HBox) SetStretchComponent ¶
type Panel ¶
type Panel struct {
// contains filtered or unexported fields
}
func (Panel) GetRequestedSize ¶
func (Panel) Invalidate ¶
func (p Panel) Invalidate()
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"` }
type VBox ¶
type VBox struct {
// contains filtered or unexported fields
}
func (*VBox) GetAlignment ¶
func (*VBox) GetChildSpacing ¶
func (*VBox) GetExpandChild ¶
func (*VBox) GetPadding ¶
func (*VBox) GetRequestedSize ¶
func (*VBox) Invalidate ¶
func (v *VBox) Invalidate()
func (*VBox) SetAlignment ¶
func (*VBox) SetChildSpacing ¶
func (*VBox) SetExpandChild ¶
func (*VBox) SetPadding ¶
func (*VBox) SetStretchComponent ¶
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.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.