imutils

package
v0.7.13 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: BSD-3-Clause, BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

ImGui utilities.

Index

Constants

This section is empty.

Variables

View Source
var GlobalScale float32 = 1

Used for S and SVec2.

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

func CopyableTextf(format string, args ...any)

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 FilePicker(label string, path *string, directory bool) (changed bool)

func S added in v0.6.9

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

func StickyActivate(activate bool, time float64) (active bool)

StickyActivate is like StickyActivateID, but will automatically use the last item's ID.

func StickyActivateID added in v0.6.6

func StickyActivateID(id imgui.ID, activate bool, time float64) (active bool)

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.

func TextError

func TextError(err error)

func Textcf added in v0.5.2

func Textcf(color imgui.Vec4, format string, args ...any)

func Textf

func Textf(format string, args ...any)

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.

Jump to

Keyboard shortcuts

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