Documentation ¶
Index ¶
- Constants
- Variables
- func Max[T constraints.Ordered](a, b T) T
- func PushID[T AddressableByC](ctx *Context, data *T)
- func SizeOfCommand() int32
- type AddressableByC
- type Buf
- type ClipCommand
- type Color
- type ColorID
- type Command
- type CommandType
- type Container
- func (c *Container) Body() Rect
- func (c *Container) ContentSize() Vec2
- func (c *Container) Open() bool
- func (c *Container) Rect() Rect
- func (c *Container) Scroll() Vec2
- func (c *Container) SetBody(r Rect)
- func (c *Container) SetOpen(v bool)
- func (c *Container) SetRect(r Rect)
- func (c *Container) SetScroll(v Vec2)
- func (c *Container) ZIndex() int32
- type Context
- func (ctx *Context) Begin()
- func (ctx *Context) BeginPanel(name string)
- func (ctx *Context) BeginPanelEx(name string, flags OptFlags)
- func (ctx *Context) BeginPopup(name string) bool
- func (ctx *Context) BeginTreenode(label string) bool
- func (ctx *Context) BeginTreenodeEx(label string, flags OptFlags) bool
- func (ctx *Context) BeginWindow(title string, rect Rect) bool
- func (ctx *Context) BeginWindowEx(title string, rect Rect, flags OptFlags) bool
- func (ctx *Context) Button(label string) bool
- func (ctx *Context) ButtonEx(label string, icon int32, flags OptFlags) bool
- func (ctx *Context) Checkbox(label string, state *int32) ResultFlags
- func (ctx *Context) DrawControlText(str string, rect Rect, colorid ColorID, flags OptFlags)
- func (ctx *Context) DrawIcon(id int32, rect Rect, color Color)
- func (ctx *Context) DrawRect(rect Rect, color Color)
- func (ctx *Context) End()
- func (ctx *Context) EndPanel()
- func (ctx *Context) EndPopup()
- func (ctx *Context) EndTreenode()
- func (ctx *Context) EndWindow()
- func (ctx *Context) Focus() ID
- func (ctx *Context) GetContainer(name string) *Container
- func (ctx *Context) GetCurrentContainer() *Container
- func (ctx *Context) Header(label string) bool
- func (ctx *Context) HeaderEx(label string, flags OptFlags) bool
- func (ctx *Context) Hover() ID
- func (ctx *Context) HoverRoot() *Container
- func (ctx *Context) InputKeyDown(k Key)
- func (ctx *Context) InputKeyUp(k Key)
- func (ctx *Context) InputMouseDown(x, y int32, b MouseButton)
- func (ctx *Context) InputMouseMove(x, y int32)
- func (ctx *Context) InputMouseUp(x, y int32, b MouseButton)
- func (ctx *Context) InputScroll(x, y int32)
- func (ctx *Context) InputText(text string)
- func (ctx *Context) Label(str string)
- func (ctx *Context) LastID() ID
- func (ctx *Context) LayoutBeginColumn()
- func (ctx *Context) LayoutEndColumn()
- func (ctx *Context) LayoutHeight(height int32)
- func (ctx *Context) LayoutNext() Rect
- func (ctx *Context) LayoutRow(items int32, widths []int32, height int32)
- func (ctx *Context) LayoutSetNext(rect Rect, relative bool)
- func (ctx *Context) LayoutWidth(width int32)
- func (ctx *Context) OpenPopup(name string)
- func (ctx *Context) PopID()
- func (c *Context) PopStyle()
- func (ctx *Context) PushIDInt32(id *int32)
- func (c *Context) PushStyleColor(id ColorID, color Color)
- func (c *Context) PushStyleFont(font Font)
- func (c *Context) PushStyleInt(id IntStyles, value int32)
- func (c *Context) PushStyleSize(size Vec2)
- func (ctx *Context) Render()
- func (ctx *Context) SetBeginCallback(fn func())
- func (ctx *Context) SetBeginRender(fn func())
- func (ctx *Context) SetEndCallback(fn func())
- func (ctx *Context) SetEndRender(fn func())
- func (ctx *Context) SetFocus(id ID)
- func (ctx *Context) SetRenderCommand(fn func(cmd *Command))
- func (ctx *Context) Slider(value *float32, low, high float32) ResultFlags
- func (ctx *Context) SliderEx(value *float32, low, high, step float32, format string, flags OptFlags) ResultFlags
- func (ctx *Context) Style() *Style
- func (ctx *Context) Text(str string)
- func (ctx *Context) Textbox(buf *Buf) ResultFlags
- func (ctx *Context) TextboxEx(buf *Buf, flags OptFlags) ResultFlags
- type Font
- type GetTextHeightFunc
- type GetTextWidthFunc
- type ID
- type IconCommand
- type IntStyles
- type JumpCommand
- type Key
- type MouseButton
- type OptFlags
- type Rect
- type RectCommand
- type ResultFlags
- type Style
- type TextCommand
- type Vec2
Constants ¶
View Source
const ( FormatReal = "%.3g" FormatSlider = "%.2f" )
Variables ¶
View Source
var ( DefaultGetTextWidth GetTextWidthFunc = func(font Font, text string) int32 { println("DefaultGetTextWidth", font, text) return 1 } DefaultGetTextHeight GetTextHeightFunc = func(font Font) int32 { println("DefaultGetTextHeight", font) return 1 } )
View Source
var (
ErrBufferTooSmall = errors.New("buffer too small")
)
Functions ¶
func Max ¶
func Max[T constraints.Ordered](a, b T) T
func PushID ¶
func PushID[T AddressableByC](ctx *Context, data *T)
func SizeOfCommand ¶
func SizeOfCommand() int32
Types ¶
type AddressableByC ¶
type AddressableByC interface { constraints.Integer | constraints.Float }
type ClipCommand ¶
type ClipCommand struct {
*Command
}
func (*ClipCommand) Rect ¶
func (c *ClipCommand) Rect() Rect
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func (*Command) Clip ¶
func (c *Command) Clip() ClipCommand
func (*Command) Icon ¶
func (c *Command) Icon() IconCommand
func (*Command) Jump ¶
func (c *Command) Jump() JumpCommand
func (*Command) Rect ¶
func (c *Command) Rect() RectCommand
func (*Command) Text ¶
func (c *Command) Text() TextCommand
func (*Command) Type ¶
func (c *Command) Type() CommandType
type CommandType ¶
type CommandType int32
const ( CommandJump CommandType = iota + 1 CommandClip CommandRect CommandText CommandIcon CommandMax )
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func (*Container) ContentSize ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext() *Context
func (*Context) BeginPanel ¶
func (*Context) BeginPanelEx ¶
func (*Context) BeginPopup ¶
func (*Context) BeginTreenode ¶
func (*Context) BeginTreenodeEx ¶
func (*Context) BeginWindowEx ¶
func (*Context) DrawControlText ¶
func (*Context) EndTreenode ¶
func (ctx *Context) EndTreenode()
func (*Context) GetContainer ¶ added in v0.0.2
func (*Context) GetCurrentContainer ¶
func (*Context) HoverRoot ¶
HoverRoot returns the container that is currently hovered. This is useful for determining if the mouse is hovering over a window.
func (*Context) InputKeyDown ¶
func (*Context) InputKeyUp ¶
func (*Context) InputMouseDown ¶
func (ctx *Context) InputMouseDown(x, y int32, b MouseButton)
func (*Context) InputMouseMove ¶
InputMouseMove is the actual position of the mouse in pixels.
func (*Context) InputMouseUp ¶
func (ctx *Context) InputMouseUp(x, y int32, b MouseButton)
func (*Context) InputScroll ¶
func (*Context) LayoutBeginColumn ¶
func (ctx *Context) LayoutBeginColumn()
func (*Context) LayoutEndColumn ¶
func (ctx *Context) LayoutEndColumn()
func (*Context) LayoutHeight ¶
func (*Context) LayoutNext ¶
func (*Context) LayoutSetNext ¶
func (*Context) LayoutWidth ¶
func (*Context) PushIDInt32 ¶
func (*Context) PushStyleColor ¶
func (*Context) PushStyleFont ¶
func (*Context) PushStyleInt ¶
func (*Context) PushStyleSize ¶
func (*Context) SetBeginCallback ¶
func (ctx *Context) SetBeginCallback(fn func())
func (*Context) SetBeginRender ¶
func (ctx *Context) SetBeginRender(fn func())
func (*Context) SetEndCallback ¶
func (ctx *Context) SetEndCallback(fn func())
func (*Context) SetEndRender ¶
func (ctx *Context) SetEndRender(fn func())
func (*Context) SetRenderCommand ¶
func (*Context) Textbox ¶
func (ctx *Context) Textbox(buf *Buf) ResultFlags
type GetTextHeightFunc ¶
type GetTextWidthFunc ¶
type IconCommand ¶
type IconCommand struct {
*Command
}
func (*IconCommand) Color ¶
func (c *IconCommand) Color() Color
func (*IconCommand) ID ¶
func (c *IconCommand) ID() int32
func (*IconCommand) Rect ¶
func (c *IconCommand) Rect() Rect
type JumpCommand ¶
type JumpCommand struct {
*Command
}
func (*JumpCommand) Dst ¶
func (c *JumpCommand) Dst() uintptr
type MouseButton ¶
type MouseButton int32
const ( MouseLeft MouseButton = 1 << iota MouseRight MouseMiddle )
type RectCommand ¶
type RectCommand struct {
*Command
}
func (*RectCommand) Color ¶
func (c *RectCommand) Color() Color
func (*RectCommand) Rect ¶
func (c *RectCommand) Rect() Rect
type ResultFlags ¶
type ResultFlags int32
const ( ResActive ResultFlags = 1 << iota ResSubmit ResChange )
type TextCommand ¶
type TextCommand struct {
*Command
}
func (*TextCommand) Color ¶
func (c *TextCommand) Color() Color
func (*TextCommand) Font ¶
func (c *TextCommand) Font() Font
func (*TextCommand) Pos ¶
func (c *TextCommand) Pos() Vec2
func (*TextCommand) Text ¶
func (c *TextCommand) Text() string
Click to show internal directories.
Click to hide internal directories.