auto

package
v0.0.0-...-e1c21c9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: Zlib Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Button

func Button(id gui.ID, text string, style *gui.ButtonStyle, p *Options) (event gui.EventType)

Widget: Button

func CheckBox

func CheckBox(text string, style *gui.CheckBoxStyle) bool

func Clear

func Clear(names ...string)

func Define

func Define(name string)

Define a view group

func DefineType

func DefineType(name string, xt ViewType)

func Image

func Image(id gui.ID, tex gfx.Tex2D, style *gui.ImageStyle, p *Options)

Widget: Image

func ImageButton

func ImageButton(id gui.ID, normal, pressed gfx.Tex2D, style *gui.ImageButtonStyle, p *Options) gui.EventType

func InputText

func InputText(hint string, style *gui.InputStyle, p *Options)

Widgets: InputEditor

func Layout

func Layout(id gui.ID, gui func(g *Group), w, h float32, xt LayoutType)

func LayoutX

func LayoutX(id gui.ID, gui func(g *Group), opt *Options, xt LayoutType)

func ListView

func ListView()

Widget: ListView TODO

func ProgressBar

func ProgressBar(fraction float32, style *gui.ProgressBarStyle, p *Options)

Widget: ProgressBar, Slider

func Slider

func Slider(id gui.ID, value *float32, style *gui.SliderStyle, p *Options) (v gui.EventType)

func Text

func Text(id gui.ID, text string, style *gui.TextStyle, p *Options)

Widgets: Text

func TextSizeColored

func TextSizeColored(id gui.ID, text string, color gfx.Color, size float32, opt *Options)

Types

type DirtyFlag

type DirtyFlag uint32
const (
	FlagSize DirtyFlag = 1 << iota
	FlagMargin
	FlagGravity
)

type Element

type Element struct {

	// 相对偏移 和 大小
	gui.Rect
	// contains filtered or unexported fields
}

当 W = 0, H = 0 的时候,按 WrapContent 的方式绘制

type Flag

type Flag uint32

type Group

type Group struct {
	LayoutType
	Flag
	*Element
	// 仅用来缓存...
	Cursor struct{ X, Y float32 }
	Offset struct{ X, Y float32 }
	gui.Padding

	// 当前帧布局的计算变量
	Size    struct{ W, H float32 }
	Gravity struct{ X, Y float32 }
	// contains filtered or unexported fields
}

func (*Group) SetGravity

func (g *Group) SetGravity(x, y float32)

func (*Group) SetPadding

func (g *Group) SetPadding(top, left, right, bottom float32)

func (*Group) SetSize

func (g *Group) SetSize(w, h float32)

type LayoutMan

type LayoutMan struct {
	*g.Context
	Options
	// contains filtered or unexported fields
}

func (*LayoutMan) BeginElement

func (lm *LayoutMan) BeginElement(id g.ID, opt *Options) (elem *Element, ok bool)

计算单个UI元素 如果有大小则记录出偏移和Margin 否则只返回元素

func (*LayoutMan) BeginLayout

func (lm *LayoutMan) BeginLayout(id g.ID, opt *Options, xtype LayoutType)

func (*LayoutMan) Button

func (lm *LayoutMan) Button(id g.ID, text string, style *g.ButtonStyle, opt *Options) (event g.EventType)

Widget: Button

func (*LayoutMan) Clear

func (lm *LayoutMan) Clear(names ...string)

func (*LayoutMan) DefineLayout

func (lm *LayoutMan) DefineLayout(name string, xt ViewType)

func (*LayoutMan) EndElement

func (lm *LayoutMan) EndElement(elem *Element)

结束绘制, 每绘制完一个元素都要偏移一下光标

func (*LayoutMan) EndLayout

func (lm *LayoutMan) EndLayout()

func (*LayoutMan) Image

func (lm *LayoutMan) Image(id g.ID, tex gfx.Tex2D, style *g.ImageStyle, opt *Options)

Widget: Image

func (*LayoutMan) ImageButton

func (lm *LayoutMan) ImageButton(id g.ID, normal, pressed gfx.Tex2D, style *g.ImageButtonStyle, opt *Options) (event g.EventType)

func (*LayoutMan) InputText

func (lm *LayoutMan) InputText(hint string, lyt layout, style *g.InputStyle)

Widgets: InputEditor

func (*LayoutMan) Slider

func (lm *LayoutMan) Slider(id g.ID, value *float32, style *g.SliderStyle, opt *Options) (e g.EventType)

Slider 需要设定一些自定义的属性,目前没有想好如何实现,先把逻辑实现了 用两种颜色来绘制

func (*LayoutMan) Text

func (lm *LayoutMan) Text(id g.ID, text string, style *g.TextStyle, opt *Options) *Element

type LayoutType

type LayoutType int

Awesome GUI System

const (
	Vertical LayoutType = iota
	Horizontal
	OverLay
)

type Options

type Options struct {
	gui.Rect

	Flag DirtyFlag // dirty flag
	// contains filtered or unexported fields
}

Shadow of current ui-element

func Gravity

func Gravity(x, y float32) *Options

Options: gravity

func Margin

func Margin(top, left, right, bottom float32) *Options

Options: margin

func Size

func Size(w, h float32) *Options

Options: Size

func (*Options) Gravity

func (p *Options) Gravity(x, y float32) *Options

func (*Options) Margin

func (p *Options) Margin(top, left, right, bottom float32) *Options

set flag

func (*Options) Size

func (p *Options) Size(w, h float32) *Options

type ViewType

type ViewType int
const (
	Normal ViewType = iota
	Popup
)

Jump to

Keyboard shortcuts

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