Documentation
¶
Overview ¶
ImGui utilities.
Index ¶
- Variables
- func CheckboxHeight() float32
- func ComboChoice[T comparable](label string, selected *T, choices []T) bool
- func ComboChoiceAny[T any](label string, selected *T, choices []T, isEqual func(a, b T) bool, ...) bool
- func ComboHeight() float32
- func CopyableTextf(format string, args ...any)
- func CopyableTextfV(opts CopyableTextOptions, format string, args ...any)
- func FilePicker(label string, path *string, directory bool) (changed bool)
- func S[T constraints.Float | constraints.Integer](x T) float32
- func SVec2[X, Y constraints.Float | constraints.Integer](x X, y Y) imgui.Vec2
- func StickyActivate(activate bool, time float64) (active bool)
- func StickyActivateID(id imgui.ID, activate bool, time float64) (active bool)
- func TextError(err error)
- func Textcf(color imgui.Vec4, format string, args ...any)
- func Textf(format string, args ...any)
- type CopyableTextOptions
- type PopupManager
Constants ¶
This section is empty.
Variables ¶
var GlobalScale float32 = 1
Functions ¶
func CheckboxHeight ¶
func CheckboxHeight() float32
func ComboChoice ¶ added in v0.5.23
func ComboChoice[T comparable](label string, selected *T, choices []T) bool
ComboChoice creates a combo box where you can choose a value from choices. Uses fmt.Sprint to turn values into strings.
func ComboChoiceAny ¶ added in v0.5.29
func ComboChoiceAny[T any](label string, selected *T, choices []T, isEqual func(a, b T) bool, toString func(T) string) bool
ComboChoiceAny is like ComboChoice, but it uses user-supplied isEqual and toString functions and therefore accepts arbitrary types.
func ComboHeight ¶
func ComboHeight() float32
func CopyableTextf ¶ added in v0.5.17
CopyableTextf is the same as CopyableTextfV with default options.
func CopyableTextfV ¶ added in v0.5.17
func CopyableTextfV(opts CopyableTextOptions, format string, args ...any)
CopyableTextfV creates a text item, which can be clicked to copy to clipboard. Pass zero value into opts for default.
func FilePicker ¶ added in v0.6.0
func S ¶ added in v0.6.9
func S[T constraints.Float | constraints.Integer](x T) float32
S scales the given number by the current GUI scale after converting it to float32.
Use SVec2 to make a scaled imgui.Vec2.
Requires GlobalScale to be set.
func SVec2 ¶ added in v0.6.9
func SVec2[X, Y constraints.Float | constraints.Integer](x X, y Y) imgui.Vec2
SVec2 creates an imgui.Vec2 scaled by the current GUI scale.
See S.
Requires GlobalScale to be set.
func StickyActivate ¶ added in v0.6.6
StickyActivate is like StickyActivateID, but will automatically use the last item's ID.
func StickyActivateID ¶ added in v0.6.6
StickyActivateID will set the given ID to be sticky-active. The ID doesn't have to belong to an existing item. (Note that this is different from ImGUI's builtin concept of activation.) Once activate is true, this function will keep returning true for the given time, or until a different item is sticky-activated.
Types ¶
type CopyableTextOptions ¶ added in v0.6.0
type CopyableTextOptions struct {
// Tooltip shown when hovering normally.
// Default: fonts.I("Content_copy") + " Click to copy to clipboard"
TooltipHovered string
// Tooltip shown for 1s after copying to clipboard.
// Default: fonts.I("Check") + " Copied"
TooltipCopied string
// Mouse button to copy to clipboard.
// Default: left mouse button
Btn imgui.MouseButton
// Text to be copied into clipboard.
// Default: Formatted text passed in.
ClipboardText string
// Text color. Zero-value (default)
// indicates default text color.
Color imgui.Vec4
}
type PopupManager ¶ added in v0.5.24
type PopupManager struct {
// Name to whether open. Values may be freely
// modified. Values may also be set before
// the corresponding call to Popup() is made
// without effecting popup order.
Open map[string]bool
// contains filtered or unexported fields
}
PopupManager is for when you want the next popup to only open after the previous one is closed. Popup order is determined by the order PopupManager.Popup() initially is called in.
func NewPopupManager ¶ added in v0.5.24
func NewPopupManager() *PopupManager
func (*PopupManager) Popup ¶ added in v0.5.24
func (m *PopupManager) Popup(name string, content func(close func()), flags imgui.WindowFlags, closeBtn bool)
Popup draws a popup window with the given name. Internally uses BeginPopupModal. Put content drawing code into the body() function body. Call close() to close the current popup.