imgui

package module
v0.0.0-...-4934c46 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0, MIT Imports: 2 Imported by: 0

README

Dear Imgui for Go

Continuous Integration

[!WARNING]

Until this project reaches a stable 1.0 release, the API is not guaranteed to be stable and may change at any time.

This project provides Go-bindings for the Dear Imgui library. In addition to providing raw access to the underlying C++ API, it also provides a more Go-idiomatic abstraction leveraging a Widget hierarchy to allow easy construction of GUI layouts.

This project leverages the cimgui project as FFI bindings.

Why yet another go-imgui wrapper?

Every existing imgui library either:

  • Is outdated/not maintained/abandoned
  • Forces a transitive dependency on unnecessary packages (e.g. testify or other CGO wrapper tools)
  • Doesn't feel Go-idiomatic (mostly 1:1 exposing of the C++ API)

Ultimately, rolling my own version is not that hard, and prevents pulling in dependencies I can't trust.

Documentation

Overview

Package imgui is an idiomatic Go wrapper around Dear ImGui.

The intended use-case for this package is to leverage the "Widget" hierarchy, and to use optional Display types for everything. However, this package _also_ exposes an "immediate"-mode API that models the Begin/End API from ImGui near 1:1 -- except instead of "End" functions, the Begin function returns an EndFunc which can be called in a defer statement.

## Widgets

The UI is a retained tree of Widget values rebuilt each frame inside the render callback (see app.Run). Containers hold child widgets and own their begin/end pairing, so ordering can never be wrong; build widgets as plain structs (composite literals) or with the per-package constructors, set their fields, and add them to a container:

w := window.New("Hello")
b := button.New("Click")
b.OnClick = func() { count++ }
w.AddWidget(text.Labelf("count = %d", count), b)
w.Display()

Widgets live in concept subpackages (text, button, input, color, layout, window, tree, tab, table, menu, popup, combo, tooltip, plot, texture, debug). This root package holds the Widget interface, the shared value types (Vec2, Vec4, Color), the context/frame lifecycle, and the Custom escape hatch. The thin C bindings live in the internal cimgui package and are not part of the public API.

## Immediate-mode

Alongside the retained Widget tree, this package also exposes a near 1:1 immediate-mode mapping of the Dear ImGui C API for cases the widget tree does not yet model. These functions are typically driven from a Custom widget (or any code running between NewFrame and Render) and each documents the ImGui:: function it models. Three conventions adapt the C API to Go:

  • Enum bitflags become an "Options" struct of bool fields, always passed by pointer so a nil argument selects Dear ImGui's defaults (see for example WindowOptions and Window). Optional scalar parameters such as a printf format string are carried on the same struct.
  • Single-choice enums (such as Dir, Cond and Col) remain typed constants.
  • The begin/end scopes return an EndFunc to call (typically deferred) instead of a separate End function; for example "open, end := imgui.Window(...); defer end()". The Push/Pop primitives are instead exposed as standalone pairs (such as PushStyleColor and PopStyleColor, or TreePush and TreePop).

C++ overloads that differ only by a value type are unified with generics (for example CheckboxFlags, the value/pointer overloads of Selectable and MenuItem, and the id-overloaded Child, whose id may be a string label or a precomputed uint32). Overloads that differ in arity or behaviour keep distinct names (for example RadioButton versus RadioButtonGroup).

Index

Constants

View Source
const (
	DirNone  = cimgui.DirNone  // ImGuiDir_None
	DirLeft  = cimgui.DirLeft  // ImGuiDir_Left
	DirRight = cimgui.DirRight // ImGuiDir_Right
	DirUp    = cimgui.DirUp    // ImGuiDir_Up
	DirDown  = cimgui.DirDown  // ImGuiDir_Down
)

Direction values for Dir.

View Source
const (
	CondNone         = cimgui.CondNone         // ImGuiCond_None
	CondAlways       = cimgui.CondAlways       // ImGuiCond_Always
	CondOnce         = cimgui.CondOnce         // ImGuiCond_Once
	CondFirstUseEver = cimgui.CondFirstUseEver // ImGuiCond_FirstUseEver
	CondAppearing    = cimgui.CondAppearing    // ImGuiCond_Appearing
)

Condition values for Cond.

View Source
const (
	ColText             = cimgui.ColText             // ImGuiCol_Text
	ColTextDisabled     = cimgui.ColTextDisabled     // ImGuiCol_TextDisabled
	ColWindowBg         = cimgui.ColWindowBg         // ImGuiCol_WindowBg
	ColChildBg          = cimgui.ColChildBg          // ImGuiCol_ChildBg
	ColPopupBg          = cimgui.ColPopupBg          // ImGuiCol_PopupBg
	ColBorder           = cimgui.ColBorder           // ImGuiCol_Border
	ColFrameBg          = cimgui.ColFrameBg          // ImGuiCol_FrameBg
	ColFrameBgHovered   = cimgui.ColFrameBgHovered   // ImGuiCol_FrameBgHovered
	ColFrameBgActive    = cimgui.ColFrameBgActive    // ImGuiCol_FrameBgActive
	ColTitleBg          = cimgui.ColTitleBg          // ImGuiCol_TitleBg
	ColTitleBgActive    = cimgui.ColTitleBgActive    // ImGuiCol_TitleBgActive
	ColTitleBgCollapsed = cimgui.ColTitleBgCollapsed // ImGuiCol_TitleBgCollapsed
	ColMenuBarBg        = cimgui.ColMenuBarBg        // ImGuiCol_MenuBarBg
	ColCheckMark        = cimgui.ColCheckMark        // ImGuiCol_CheckMark
	ColSliderGrab       = cimgui.ColSliderGrab       // ImGuiCol_SliderGrab
	ColSliderGrabActive = cimgui.ColSliderGrabActive // ImGuiCol_SliderGrabActive
	ColButton           = cimgui.ColButton           // ImGuiCol_Button
	ColButtonHovered    = cimgui.ColButtonHovered    // ImGuiCol_ButtonHovered
	ColButtonActive     = cimgui.ColButtonActive     // ImGuiCol_ButtonActive
	ColHeader           = cimgui.ColHeader           // ImGuiCol_Header
	ColHeaderHovered    = cimgui.ColHeaderHovered    // ImGuiCol_HeaderHovered
	ColHeaderActive     = cimgui.ColHeaderActive     // ImGuiCol_HeaderActive
	ColSeparator        = cimgui.ColSeparator        // ImGuiCol_Separator
	ColTab              = cimgui.ColTab              // ImGuiCol_Tab
	ColTabHovered       = cimgui.ColTabHovered       // ImGuiCol_TabHovered
	ColTabSelected      = cimgui.ColTabSelected      // ImGuiCol_TabSelected
	ColPlotLines        = cimgui.ColPlotLines        // ImGuiCol_PlotLines
	ColPlotHistogram    = cimgui.ColPlotHistogram    // ImGuiCol_PlotHistogram
	ColTextSelectedBg   = cimgui.ColTextSelectedBg   // ImGuiCol_TextSelectedBg
	ColModalWindowDimBg = cimgui.ColModalWindowDimBg // ImGuiCol_ModalWindowDimBg
)

Color identifiers for Col.

View Source
const (
	StyleVarAlpha            = cimgui.StyleVarAlpha            // ImGuiStyleVar_Alpha
	StyleVarDisabledAlpha    = cimgui.StyleVarDisabledAlpha    // ImGuiStyleVar_DisabledAlpha
	StyleVarWindowPadding    = cimgui.StyleVarWindowPadding    // ImGuiStyleVar_WindowPadding
	StyleVarWindowRounding   = cimgui.StyleVarWindowRounding   // ImGuiStyleVar_WindowRounding
	StyleVarWindowBorderSize = cimgui.StyleVarWindowBorderSize // ImGuiStyleVar_WindowBorderSize
	StyleVarFramePadding     = cimgui.StyleVarFramePadding     // ImGuiStyleVar_FramePadding
	StyleVarFrameRounding    = cimgui.StyleVarFrameRounding    // ImGuiStyleVar_FrameRounding
	StyleVarFrameBorderSize  = cimgui.StyleVarFrameBorderSize  // ImGuiStyleVar_FrameBorderSize
	StyleVarItemSpacing      = cimgui.StyleVarItemSpacing      // ImGuiStyleVar_ItemSpacing
	StyleVarItemInnerSpacing = cimgui.StyleVarItemInnerSpacing // ImGuiStyleVar_ItemInnerSpacing
	StyleVarIndentSpacing    = cimgui.StyleVarIndentSpacing    // ImGuiStyleVar_IndentSpacing
	StyleVarScrollbarSize    = cimgui.StyleVarScrollbarSize    // ImGuiStyleVar_ScrollbarSize
	StyleVarGrabMinSize      = cimgui.StyleVarGrabMinSize      // ImGuiStyleVar_GrabMinSize
	StyleVarGrabRounding     = cimgui.StyleVarGrabRounding     // ImGuiStyleVar_GrabRounding
	StyleVarTabRounding      = cimgui.StyleVarTabRounding      // ImGuiStyleVar_TabRounding
)

Style-variable identifiers for StyleVar.

View Source
const (
	DataTypeS8     = cimgui.DataTypeS8     // ImGuiDataType_S8
	DataTypeU8     = cimgui.DataTypeU8     // ImGuiDataType_U8
	DataTypeS16    = cimgui.DataTypeS16    // ImGuiDataType_S16
	DataTypeU16    = cimgui.DataTypeU16    // ImGuiDataType_U16
	DataTypeS32    = cimgui.DataTypeS32    // ImGuiDataType_S32
	DataTypeU32    = cimgui.DataTypeU32    // ImGuiDataType_U32
	DataTypeS64    = cimgui.DataTypeS64    // ImGuiDataType_S64
	DataTypeU64    = cimgui.DataTypeU64    // ImGuiDataType_U64
	DataTypeFloat  = cimgui.DataTypeFloat  // ImGuiDataType_Float
	DataTypeDouble = cimgui.DataTypeDouble // ImGuiDataType_Double
	DataTypeBool   = cimgui.DataTypeBool   // ImGuiDataType_Bool
)

Element types for DataType.

View Source
const (
	MouseButtonLeft   = cimgui.MouseButtonLeft   // ImGuiMouseButton_Left
	MouseButtonRight  = cimgui.MouseButtonRight  // ImGuiMouseButton_Right
	MouseButtonMiddle = cimgui.MouseButtonMiddle // ImGuiMouseButton_Middle
)

Mouse buttons for MouseButton.

View Source
const (
	KeyUpArrow   = cimgui.KeyUpArrow   // ImGuiKey_UpArrow
	KeyDownArrow = cimgui.KeyDownArrow // ImGuiKey_DownArrow
)

Keys for Key.

Variables

This section is empty.

Functions

func ArrowButton

func ArrowButton(strID string, dir Dir) bool

ArrowButton draws a square button containing an arrow in dir and reports whether it was clicked. It models ImGui::ArrowButton.

func Bullet

func Bullet()

Bullet draws a small bullet and keeps the cursor on the same line. It models ImGui::Bullet.

func BulletText

func BulletText(text string)

BulletText draws text prefixed with a bullet. It models ImGui::BulletText.

func Button

func Button(label string, size Vec2) bool

Button draws a button and reports whether it was clicked this frame. A zero size auto-fits the label. It models ImGui::Button.

func Checkbox

func Checkbox(label string, v *bool) bool

Checkbox draws a checkbox bound to v and reports whether it changed this frame. It models ImGui::Checkbox.

func CheckboxFlags

func CheckboxFlags[T SignedOrUnsigned32](label string, flags *T, flagsValue T) bool

CheckboxFlags draws a checkbox that toggles flagsValue within the bitset flags, reporting whether it changed. flags may point to an int32 or uint32, modelling ImGui::CheckboxFlags.

func CloseCurrentPopup

func CloseCurrentPopup()

CloseCurrentPopup closes the popup currently being drawn. It models ImGui::CloseCurrentPopup.

func CollapsingHeader

func CollapsingHeader(label string, opts *TreeNodeOptions) bool

CollapsingHeader draws a collapsing header and reports whether it is open. It models ImGui::CollapsingHeader (the flags overload).

func CollapsingHeaderClosable

func CollapsingHeaderClosable(label string, pVisible *bool, opts *TreeNodeOptions) bool

CollapsingHeaderClosable draws a collapsing header with a close button bound to pVisible; when *pVisible becomes false the header is hidden. It reports whether the header is open and models ImGui::CollapsingHeader (the bool* overload).

func ColorButton

func ColorButton(descID string, col Vec4, size Vec2, opts *ColorEditOptions) bool

ColorButton draws a color swatch button and reports whether it was clicked. A zero size auto-fits. It models ImGui::ColorButton.

func ColorEdit3

func ColorEdit3(label string, col *[3]float32, opts *ColorEditOptions) bool

ColorEdit3 edits an RGB color in place and reports whether it changed. It models ImGui::ColorEdit3.

func ColorEdit4

func ColorEdit4(label string, col *[4]float32, opts *ColorEditOptions) bool

ColorEdit4 edits an RGBA color in place and reports whether it changed. It models ImGui::ColorEdit4.

func ColorPicker3

func ColorPicker3(label string, col *[3]float32, opts *ColorEditOptions) bool

ColorPicker3 shows an RGB color picker editing col in place. It models ImGui::ColorPicker3.

func ColorPicker4

func ColorPicker4(label string, col *[4]float32, refCol *[4]float32, opts *ColorEditOptions) bool

ColorPicker4 shows an RGBA color picker editing col in place. refCol, when non-nil, supplies the reference color swatch. It models ImGui::ColorPicker4.

func ComboFunc

func ComboFunc(label string, currentItem *int32, getter func(idx int32) string, itemsCount, popupMaxHeightInItems int32) bool

ComboFunc draws a combo box whose itemsCount labels are produced lazily by getter, updating currentItem and reporting whether it changed. A negative popupMaxHeightInItems uses the default. It models ImGui::Combo (the getter overload).

func ComboItems

func ComboItems(label string, currentItem *int32, items []string, popupMaxHeightInItems int32) bool

ComboItems draws a combo box selecting an index within items, updating currentItem and reporting whether it changed. A negative popupMaxHeightInItems uses the default. It models ImGui::Combo (the items-array overload).

func ComboZeroSep

func ComboZeroSep(label string, currentItem *int32, itemsSeparatedByZeros string, popupMaxHeightInItems int32) bool

ComboZeroSep draws a combo box whose items come from a single string of NUL-separated, double-NUL-terminated entries (e.g. "a\x00b\x00c\x00"). It models ImGui::Combo (the zero-separated-string overload).

func Display

func Display(widgets ...Widget)

Display draws each widget in order. It is a convenience for the top level of a frame, e.g. imgui.Display(window1, window2).

func DragFloat

func DragFloat(label string, v *float32, speed, vMin, vMax float32, opts *SliderOptions) bool

DragFloat draws a draggable float bound to v with the given drag speed, soft-clamped to [vMin,vMax], and reports whether it changed. It models ImGui::DragFloat.

func DragFloat2

func DragFloat2(label string, v *[2]float32, speed, vMin, vMax float32, opts *SliderOptions) bool

DragFloat2 draws a draggable 2-component float bound to v. It models ImGui::DragFloat2.

func DragFloat3

func DragFloat3(label string, v *[3]float32, speed, vMin, vMax float32, opts *SliderOptions) bool

DragFloat3 draws a draggable 3-component float bound to v. It models ImGui::DragFloat3.

func DragFloat4

func DragFloat4(label string, v *[4]float32, speed, vMin, vMax float32, opts *SliderOptions) bool

DragFloat4 draws a draggable 4-component float bound to v. It models ImGui::DragFloat4.

func DragFloatRange2

func DragFloatRange2(label string, vCurrentMin, vCurrentMax *float32, speed, vMin, vMax float32, opts *SliderOptions) bool

DragFloatRange2 draws two draggable floats editing the range [vCurrentMin,vCurrentMax]. It models ImGui::DragFloatRange2.

func DragInt

func DragInt(label string, v *int32, speed float32, vMin, vMax int32, opts *SliderOptions) bool

DragInt draws a draggable int bound to v with the given drag speed, soft-clamped to [vMin,vMax], and reports whether it changed. It models ImGui::DragInt.

func DragInt2

func DragInt2(label string, v *[2]int32, speed float32, vMin, vMax int32, opts *SliderOptions) bool

DragInt2 draws a draggable 2-component int bound to v. It models ImGui::DragInt2.

func DragInt3

func DragInt3(label string, v *[3]int32, speed float32, vMin, vMax int32, opts *SliderOptions) bool

DragInt3 draws a draggable 3-component int bound to v. It models ImGui::DragInt3.

func DragInt4

func DragInt4(label string, v *[4]int32, speed float32, vMin, vMax int32, opts *SliderOptions) bool

DragInt4 draws a draggable 4-component int bound to v. It models ImGui::DragInt4.

func DragIntRange2

func DragIntRange2(label string, vCurrentMin, vCurrentMax *int32, speed float32, vMin, vMax int32, opts *SliderOptions) bool

DragIntRange2 draws two draggable ints editing the range [vCurrentMin,vCurrentMax]. It models ImGui::DragIntRange2.

func DragScalar

func DragScalar(label string, dataType DataType, pData unsafe.Pointer, speed float32, pMin, pMax unsafe.Pointer, opts *SliderOptions) bool

DragScalar draws a draggable widget for an arbitrary data type. It models ImGui::DragScalar.

func DragScalarN

func DragScalarN(label string, dataType DataType, pData unsafe.Pointer, components int32, speed float32, pMin, pMax unsafe.Pointer, opts *SliderOptions) bool

DragScalarN draws draggable widgets for components values of dataType stored contiguously at pData. It models ImGui::DragScalarN.

func DrawListAddBezierCubic

func DrawListAddBezierCubic(d DrawList, p1, p2, p3, p4 Vec2, col U32, thickness float32, numSegments int32)

DrawListAddBezierCubic draws a cubic Bézier curve through the four control points. A zero numSegments auto-tessellates. It models ImDrawList::AddBezierCubic.

func DrawListAddCircle

func DrawListAddCircle(d DrawList, center Vec2, radius float32, col U32, numSegments int32, thickness float32)

DrawListAddCircle draws a circle outline. A zero numSegments auto-tessellates. It models ImDrawList::AddCircle.

func DrawListAddCircleFilled

func DrawListAddCircleFilled(d DrawList, center Vec2, radius float32, col U32, numSegments int32)

DrawListAddCircleFilled draws a filled circle. It models ImDrawList::AddCircleFilled.

func DrawListAddConvexPolyFilled

func DrawListAddConvexPolyFilled(d DrawList, points []Vec2, col U32)

DrawListAddConvexPolyFilled fills the convex polygon described by points. It models ImDrawList::AddConvexPolyFilled.

func DrawListAddLine

func DrawListAddLine(d DrawList, p1, p2 Vec2, col U32, thickness float32)

DrawListAddLine draws a line from p1 to p2. It models ImDrawList::AddLine.

func DrawListAddPolyline

func DrawListAddPolyline(d DrawList, points []Vec2, col U32, thickness float32, opts *DrawOptions)

DrawListAddPolyline draws a connected sequence of line segments. It models ImDrawList::AddPolyline.

func DrawListAddQuad

func DrawListAddQuad(d DrawList, p1, p2, p3, p4 Vec2, col U32, thickness float32)

DrawListAddQuad draws a quad outline. It models ImDrawList::AddQuad.

func DrawListAddQuadFilled

func DrawListAddQuadFilled(d DrawList, p1, p2, p3, p4 Vec2, col U32)

DrawListAddQuadFilled draws a filled quad. It models ImDrawList::AddQuadFilled.

func DrawListAddRect

func DrawListAddRect(d DrawList, pMin, pMax Vec2, col U32, rounding, thickness float32, opts *DrawOptions)

DrawListAddRect draws a rectangle outline between pMin and pMax. It models ImDrawList::AddRect.

func DrawListAddRectFilled

func DrawListAddRectFilled(d DrawList, pMin, pMax Vec2, col U32, rounding float32, opts *DrawOptions)

DrawListAddRectFilled draws a filled rectangle between pMin and pMax. It models ImDrawList::AddRectFilled.

func DrawListAddText

func DrawListAddText(d DrawList, pos Vec2, col U32, text string)

DrawListAddText draws text at pos. It models ImDrawList::AddText.

func DrawListAddTriangle

func DrawListAddTriangle(d DrawList, p1, p2, p3 Vec2, col U32, thickness float32)

DrawListAddTriangle draws a triangle outline. It models ImDrawList::AddTriangle.

func DrawListAddTriangleFilled

func DrawListAddTriangleFilled(d DrawList, p1, p2, p3 Vec2, col U32)

DrawListAddTriangleFilled draws a filled triangle. It models ImDrawList::AddTriangleFilled.

func DrawListPopClipRect

func DrawListPopClipRect(d DrawList)

DrawListPopClipRect undoes the most recent DrawListPushClipRect. It models ImDrawList::PopClipRect.

func DrawListPushClipRect

func DrawListPushClipRect(d DrawList, min, max Vec2, intersectWithCurrent bool)

DrawListPushClipRect restricts subsequent drawing to the given rectangle. It models ImDrawList::PushClipRect.

func Dummy

func Dummy(size Vec2)

Dummy adds an empty item of the given size. It models ImGui::Dummy.

func EndFrame

func EndFrame()

EndFrame ends the frame; normally Render calls this for you.

func GetTreeNodeToLabelSpacing

func GetTreeNodeToLabelSpacing() float32

GetTreeNodeToLabelSpacing returns the horizontal distance from a tree node's start to its label. It models ImGui::GetTreeNodeToLabelSpacing.

func Image

func Image(texRef TextureRef, size, uv0, uv1 Vec2)

Image draws texRef as an image. uv0 and uv1 are the texture coordinates of the top-left and bottom-right corners ({0,0} and {1,1} for the whole texture). It models ImGui::Image.

func ImageButton

func ImageButton(strID string, texRef TextureRef, size, uv0, uv1 Vec2, bgCol, tintCol Vec4) bool

ImageButton draws a clickable image button and reports whether it was clicked. It models ImGui::ImageButton.

func ImageWithBg

func ImageWithBg(texRef TextureRef, size, uv0, uv1 Vec2, bgCol, tintCol Vec4)

ImageWithBg draws texRef over the background color bgCol and tinted by tintCol. It models ImGui::ImageWithBg.

func Indent

func Indent(indentW float32)

Indent increases the indent. A zero width uses the default. It models ImGui::Indent.

func InputDouble

func InputDouble(label string, v *float64, step, stepFast float64, opts *InputOptions) bool

InputDouble edits a double in a box with optional step buttons. It models ImGui::InputDouble.

func InputFloat

func InputFloat(label string, v *float32, step, stepFast float32, opts *InputOptions) bool

InputFloat edits a float in a box with optional step buttons (a zero step hides them). It models ImGui::InputFloat.

func InputFloat2

func InputFloat2(label string, v *[2]float32, opts *InputOptions) bool

InputFloat2 edits a 2-component float bound to v. It models ImGui::InputFloat2.

func InputFloat3

func InputFloat3(label string, v *[3]float32, opts *InputOptions) bool

InputFloat3 edits a 3-component float bound to v. It models ImGui::InputFloat3.

func InputFloat4

func InputFloat4(label string, v *[4]float32, opts *InputOptions) bool

InputFloat4 edits a 4-component float bound to v. It models ImGui::InputFloat4.

func InputInt

func InputInt(label string, v *int32, step, stepFast int32, opts *InputOptions) bool

InputInt edits an int in a box with optional step buttons (a zero step hides them). It models ImGui::InputInt.

func InputInt2

func InputInt2(label string, v *[2]int32, opts *InputOptions) bool

InputInt2 edits a 2-component int bound to v. It models ImGui::InputInt2.

func InputInt3

func InputInt3(label string, v *[3]int32, opts *InputOptions) bool

InputInt3 edits a 3-component int bound to v. It models ImGui::InputInt3.

func InputInt4

func InputInt4(label string, v *[4]int32, opts *InputOptions) bool

InputInt4 edits a 4-component int bound to v. It models ImGui::InputInt4.

func InputScalar

func InputScalar(label string, dataType DataType, pData, pStep, pStepFast unsafe.Pointer, opts *InputOptions) bool

InputScalar edits a single value of an arbitrary data type. pData, pStep and pStepFast point to values of dataType; pStep and pStepFast may be nil. It models ImGui::InputScalar.

func InputScalarN

func InputScalarN(label string, dataType DataType, pData unsafe.Pointer, components int32, pStep, pStepFast unsafe.Pointer, opts *InputOptions) bool

InputScalarN edits components values of dataType stored contiguously at pData. pStep and pStepFast may be nil. It models ImGui::InputScalarN.

func InputText

func InputText(label string, buf []byte, opts *InputOptions) bool

InputText edits the NUL-terminated text held in buf (capacity len(buf)) and reports whether it changed. It models ImGui::InputText. For an automatically growing buffer, use InputTextResizable.

func InputTextMultiline

func InputTextMultiline(label string, buf []byte, size Vec2, opts *InputOptions) bool

InputTextMultiline edits buf in a multi-line box of the given size. It models ImGui::InputTextMultiline.

func InputTextMultilineResizable

func InputTextMultilineResizable(label string, buf *TextBuffer, size Vec2, cb InputTextCallback, opts *InputOptions) bool

InputTextMultilineResizable is InputTextResizable in a multi-line box of the given size. It models ImGui::InputTextMultiline with a resize callback.

func InputTextResizable

func InputTextResizable(label string, buf *TextBuffer, cb InputTextCallback, opts *InputOptions) bool

InputTextResizable edits buf, growing it automatically as text is entered, and reports whether it changed. cb, when non-nil, receives the callback events enabled in opts (the resize event is always handled internally). It models ImGui::InputText with a resize callback.

func InputTextWithHint

func InputTextWithHint(label, hint string, buf []byte, opts *InputOptions) bool

InputTextWithHint edits buf, showing hint while empty. It models ImGui::InputTextWithHint.

func InputTextWithHintResizable

func InputTextWithHintResizable(label, hint string, buf *TextBuffer, cb InputTextCallback, opts *InputOptions) bool

InputTextWithHintResizable is InputTextResizable showing hint while empty. It models ImGui::InputTextWithHint with a resize callback.

func InvisibleButton

func InvisibleButton(strID string, size Vec2, opts *ButtonOptions) bool

InvisibleButton draws a sizeable behaviour-only button with no visuals and reports whether it was clicked. It models ImGui::InvisibleButton.

func IsItemActive

func IsItemActive() bool

IsItemActive reports whether the previous item is active (e.g. held). It models ImGui::IsItemActive.

func IsItemClicked

func IsItemClicked(button MouseButton) bool

IsItemClicked reports whether the previous item was clicked with the given mouse button. It models ImGui::IsItemClicked.

func IsItemHovered

func IsItemHovered(opts *HoveredOptions) bool

IsItemHovered reports whether the previous item is hovered. It models ImGui::IsItemHovered.

func IsPopupOpen

func IsPopupOpen(strID string, opts *PopupOptions) bool

IsPopupOpen reports whether the popup with the given string ID is open. It models ImGui::IsPopupOpen.

func LabelText

func LabelText(label, text string)

LabelText draws a value on the left and a label on the right. It models ImGui::LabelText.

func ListBoxFunc

func ListBoxFunc(label string, currentItem *int32, getter func(idx int32) string, itemsCount, heightInItems int32) bool

ListBoxFunc draws a list box whose itemsCount labels are produced lazily by getter, updating currentItem and reporting whether it changed. A negative heightInItems uses the default. It models ImGui::ListBox (the getter overload).

func ListBoxItems

func ListBoxItems(label string, currentItem *int32, items []string, heightInItems int32) bool

ListBoxItems draws a list box selecting an index within items, updating currentItem and reporting whether it changed. A negative heightInItems uses the default. It models ImGui::ListBox (the items-array overload).

func MenuItem[T BoolOrPtr](label, shortcut string, selected T, enabled bool) bool

MenuItem draws a menu item and reports whether it was activated. shortcut may be empty. selected is either a bool (rendered checked) or a *bool (toggled on activation); the form is inferred at the call site. It models ImGui::MenuItem.

func NewFrame

func NewFrame()

NewFrame begins a new frame. Call once per frame before any widget calls.

func NewLine

func NewLine()

NewLine moves to the next line. It models ImGui::NewLine.

func OpenPopup

func OpenPopup[T ID](id T, opts *PopupOptions)

OpenPopup marks the popup identified by id (a string label or precomputed uint32 id) to open on the next frame. It models ImGui::OpenPopup.

func PlotHistogram

func PlotHistogram(label string, values []float32, valuesOffset int32, overlayText string, scaleMin, scaleMax float32, graphSize Vec2, stride int32)

PlotHistogram draws a histogram of values. See PlotLines for the meaning of the remaining parameters. It models ImGui::PlotHistogram (the values overload).

func PlotHistogramFunc

func PlotHistogramFunc(label string, getter func(idx int32) float32, valuesCount, valuesOffset int32, overlayText string, scaleMin, scaleMax float32, graphSize Vec2)

PlotHistogramFunc draws a histogram of valuesCount samples produced lazily by getter. See PlotLines for the remaining parameters. It models ImGui::PlotHistogram (the getter overload).

func PlotLines

func PlotLines(label string, values []float32, valuesOffset int32, overlayText string, scaleMin, scaleMax float32, graphSize Vec2, stride int32)

PlotLines draws a line plot of values. A zero graphSize auto-fits; equal scaleMin and scaleMax auto-scale; overlayText may be empty. valuesOffset rotates the starting index and stride is the byte stride between samples (use 4 for a packed []float32). It models ImGui::PlotLines (the values overload).

func PlotLinesFunc

func PlotLinesFunc(label string, getter func(idx int32) float32, valuesCount, valuesOffset int32, overlayText string, scaleMin, scaleMax float32, graphSize Vec2)

PlotLinesFunc draws a line plot of valuesCount samples produced lazily by getter. See PlotLines for the remaining parameters. It models ImGui::PlotLines (the getter overload).

func PopItemWidth

func PopItemWidth()

PopItemWidth restores the width pushed by PushItemWidth. It models ImGui::PopItemWidth.

func PopStyleColor

func PopStyleColor(count int32)

PopStyleColor pops count entries from the style-color stack. It models ImGui::PopStyleColor.

func PopStyleVar

func PopStyleVar(count int32)

PopStyleVar pops count entries from the style-variable stack. It models ImGui::PopStyleVar.

func ProgressBar

func ProgressBar(fraction float32, size Vec2, overlay string)

ProgressBar draws a progress bar filled to fraction (0..1). A zero size auto-fits; a non-empty overlay is drawn centered over the bar. It models ImGui::ProgressBar.

func PushItemWidth

func PushItemWidth(itemWidth float32)

PushItemWidth pushes the width of common widgets; balance it with PopItemWidth. It models ImGui::PushItemWidth. Prefer ItemWidth for scoped use.

func PushStyleColor

func PushStyleColor(idx Col, col Vec4)

PushStyleColor pushes col onto the style-color stack for idx; balance it with PopStyleColor. It models ImGui::PushStyleColor. Prefer StyleColor for scoped use.

func PushStyleVar

func PushStyleVar[T StyleVarValue](idx StyleVar, val T)

PushStyleVar pushes val onto the style-variable stack for idx; balance it with PopStyleVar. val may be a float32 or a Vec2, modelling the float and ImVec2 overloads of ImGui::PushStyleVar. Prefer StyleVarScope for scoped use.

func RadioButton

func RadioButton(label string, active bool) bool

RadioButton draws a radio button rendered active and reports whether it was clicked. It models ImGui::RadioButton (the bool overload).

func RadioButtonGroup

func RadioButtonGroup(label string, v *int32, vButton int32) bool

RadioButtonGroup draws a radio button that sets *v to vButton when clicked and renders active while *v equals vButton, reporting whether it changed. It models ImGui::RadioButton (the int* overload).

func Render

func Render()

Render finalizes the frame's draw data for the renderer backend.

func SameLine

func SameLine(offsetFromStartX, spacing float32)

SameLine continues the current line. Pass zeros for default spacing. It models ImGui::SameLine.

func Selectable

func Selectable[T BoolOrPtr](label string, selected T, size Vec2, opts *SelectableOptions) bool

Selectable draws a selectable item and reports whether it was clicked. A zero size fits the label. selected is either a bool (rendered selected) or a *bool (toggled on click); the form is inferred at the call site. It models ImGui::Selectable.

func Separator

func Separator()

Separator draws a horizontal line. It models ImGui::Separator.

func SeparatorText

func SeparatorText(label string)

SeparatorText draws a horizontal separator with a centered label. It models ImGui::SeparatorText.

func SetCursorScreenPos

func SetCursorScreenPos(pos Vec2)

SetCursorScreenPos moves the cursor to pos in absolute screen coordinates. It models ImGui::SetCursorScreenPos.

func SetItemDefaultFocus

func SetItemDefaultFocus()

SetItemDefaultFocus makes the previous item the default-focused one when the window appears. It models ImGui::SetItemDefaultFocus.

func SetKeyboardFocusHere

func SetKeyboardFocusHere(offset int32)

SetKeyboardFocusHere focuses the next item (offset 0) or a later item. It models ImGui::SetKeyboardFocusHere.

func SetNextItemOpen

func SetNextItemOpen(isOpen bool, cond Cond)

SetNextItemOpen sets the open state applied to the next tree node or header. It models ImGui::SetNextItemOpen.

func SetNextItemWidth

func SetNextItemWidth(itemWidth float32)

SetNextItemWidth sets the width of the next common widget. It models ImGui::SetNextItemWidth.

func SetNextWindowBgAlpha

func SetNextWindowBgAlpha(alpha float32)

SetNextWindowBgAlpha overrides the background alpha of the next window. It models ImGui::SetNextWindowBgAlpha.

func SetNextWindowCollapsed

func SetNextWindowCollapsed(collapsed bool, cond Cond)

SetNextWindowCollapsed sets the collapsed state applied to the next window. It models ImGui::SetNextWindowCollapsed.

func SetNextWindowContentSize

func SetNextWindowContentSize(size Vec2)

SetNextWindowContentSize sets the content size applied to the next window. It models ImGui::SetNextWindowContentSize.

func SetNextWindowFocus

func SetNextWindowFocus()

SetNextWindowFocus focuses the next window. It models ImGui::SetNextWindowFocus.

func SetNextWindowPos

func SetNextWindowPos(pos Vec2, cond Cond, pivot Vec2)

SetNextWindowPos sets the position applied to the next window, with an optional pivot (0,0 top-left .. 1,1 bottom-right). It models ImGui::SetNextWindowPos.

func SetNextWindowSize

func SetNextWindowSize(size Vec2, cond Cond)

SetNextWindowSize sets the size applied to the next window. It models ImGui::SetNextWindowSize.

func SetTabItemClosed

func SetTabItemClosed(label string)

SetTabItemClosed notifies the tab bar that the named tab or window was closed externally this frame. It models ImGui::SetTabItemClosed.

func SetTooltip

func SetTooltip(text string)

SetTooltip sets the contents of a tooltip shown while the previous item is hovered. It models ImGui::SetTooltip.

func ShowAboutWindow

func ShowAboutWindow(pOpen *bool)

ShowAboutWindow displays the about window. pOpen may be nil. It models ImGui::ShowAboutWindow.

func ShowDemoWindow

func ShowDemoWindow(pOpen *bool)

ShowDemoWindow displays the Dear ImGui demo window. pOpen may be nil; when non-nil it shows a close button and is updated with the open state. It models ImGui::ShowDemoWindow.

func ShowMetricsWindow

func ShowMetricsWindow(pOpen *bool)

ShowMetricsWindow displays the metrics/debug window. pOpen may be nil. It models ImGui::ShowMetricsWindow.

func SliderAngle

func SliderAngle(label string, vRad *float32, vDegreesMin, vDegreesMax float32, opts *SliderOptions) bool

SliderAngle draws a slider editing vRad (radians) shown in degrees, clamped to [vDegreesMin,vDegreesMax]. It models ImGui::SliderAngle.

func SliderFloat

func SliderFloat(label string, v *float32, vMin, vMax float32, opts *SliderOptions) bool

SliderFloat draws a float slider bound to v, constrained to [vMin,vMax], and reports whether it changed. It models ImGui::SliderFloat.

func SliderFloat2

func SliderFloat2(label string, v *[2]float32, vMin, vMax float32, opts *SliderOptions) bool

SliderFloat2 draws a 2-component float slider bound to v. It models ImGui::SliderFloat2.

func SliderFloat3

func SliderFloat3(label string, v *[3]float32, vMin, vMax float32, opts *SliderOptions) bool

SliderFloat3 draws a 3-component float slider bound to v. It models ImGui::SliderFloat3.

func SliderFloat4

func SliderFloat4(label string, v *[4]float32, vMin, vMax float32, opts *SliderOptions) bool

SliderFloat4 draws a 4-component float slider bound to v. It models ImGui::SliderFloat4.

func SliderInt

func SliderInt(label string, v *int32, vMin, vMax int32, opts *SliderOptions) bool

SliderInt draws an int slider bound to v, constrained to [vMin,vMax], and reports whether it changed. It models ImGui::SliderInt.

func SliderInt2

func SliderInt2(label string, v *[2]int32, vMin, vMax int32, opts *SliderOptions) bool

SliderInt2 draws a 2-component int slider bound to v. It models ImGui::SliderInt2.

func SliderInt3

func SliderInt3(label string, v *[3]int32, vMin, vMax int32, opts *SliderOptions) bool

SliderInt3 draws a 3-component int slider bound to v. It models ImGui::SliderInt3.

func SliderInt4

func SliderInt4(label string, v *[4]int32, vMin, vMax int32, opts *SliderOptions) bool

SliderInt4 draws a 4-component int slider bound to v. It models ImGui::SliderInt4.

func SliderScalar

func SliderScalar(label string, dataType DataType, pData, pMin, pMax unsafe.Pointer, opts *SliderOptions) bool

SliderScalar draws a slider for an arbitrary data type. pData, pMin and pMax point to values of dataType. It models ImGui::SliderScalar.

func SliderScalarN

func SliderScalarN(label string, dataType DataType, pData unsafe.Pointer, components int32, pMin, pMax unsafe.Pointer, opts *SliderOptions) bool

SliderScalarN draws a slider editing components values of dataType stored contiguously at pData. It models ImGui::SliderScalarN.

func SmallButton

func SmallButton(label string) bool

SmallButton draws a button with no frame padding and reports whether it was clicked. It models ImGui::SmallButton.

func Spacing

func Spacing()

Spacing adds vertical spacing. It models ImGui::Spacing.

func StyleColorsClassic

func StyleColorsClassic()

StyleColorsClassic applies the built-in classic style.

func StyleColorsDark

func StyleColorsDark()

StyleColorsDark applies the built-in dark style.

func StyleColorsLight

func StyleColorsLight()

StyleColorsLight applies the built-in light style.

func TabItemButton

func TabItemButton(label string, opts *TabItemOptions) bool

TabItemButton draws a tab that behaves like a button and reports whether it was clicked. It models ImGui::TabItemButton.

func TableAngledHeadersRow

func TableAngledHeadersRow()

TableAngledHeadersRow submits an angled-text headers row. It models ImGui::TableAngledHeadersRow.

func TableHeader

func TableHeader(label string)

TableHeader submits a single header cell with the given label. It models ImGui::TableHeader.

func TableHeadersRow

func TableHeadersRow()

TableHeadersRow submits a row of headers using the labels from TableSetupColumn. It models ImGui::TableHeadersRow.

func TableNextColumn

func TableNextColumn() bool

TableNextColumn advances to the next column (wrapping to a new row as needed) and reports whether the column is visible. It models ImGui::TableNextColumn.

func TableNextRow

func TableNextRow(minRowHeight float32, opts *TableRowOptions)

TableNextRow advances to the next row. A zero minRowHeight uses the default. It models ImGui::TableNextRow.

func TableSetColumnIndex

func TableSetColumnIndex(columnN int32) bool

TableSetColumnIndex moves to the given column and reports whether it is visible. It models ImGui::TableSetColumnIndex.

func TableSetupColumn

func TableSetupColumn(label string, initWidthOrWeight float32, userID uint32, opts *TableColumnOptions)

TableSetupColumn declares a column. initWidthOrWeight is interpreted per the column's sizing flag; userID may be 0. It models ImGui::TableSetupColumn.

func TableSetupScrollFreeze

func TableSetupScrollFreeze(cols, rows int32)

TableSetupScrollFreeze locks the given number of columns and rows so they stay visible while scrolling. It models ImGui::TableSetupScrollFreeze.

func TextColored

func TextColored(col Vec4, text string)

TextColored draws text in the given RGBA color. It models ImGui::TextColored.

func TextDisabled

func TextDisabled(text string)

TextDisabled draws text using the disabled text color. It models ImGui::TextDisabled.

func TextLink(label string) bool

TextLink draws text styled as a hyperlink and reports whether it was clicked. It models ImGui::TextLink.

func TextLinkOpenURL

func TextLinkOpenURL(label, url string) bool

TextLinkOpenURL draws a hyperlink that opens url when clicked, reporting whether it was clicked. It models ImGui::TextLinkOpenURL.

func TextUnformatted

func TextUnformatted(text string)

TextUnformatted draws text verbatim, with no printf-style formatting applied. It models ImGui::TextUnformatted.

func TextWrapped

func TextWrapped(text string)

TextWrapped draws text, wrapping at the window's right edge. It models ImGui::TextWrapped.

func TreePop

func TreePop()

TreePop unindents and pops the ID pushed by TreePush. It models ImGui::TreePop. (A tree node opened with TreeNode or TreeNodeEx is closed instead by the EndFunc those return.)

func TreePush

func TreePush(strID string)

TreePush indents and pushes strID onto the ID stack; balance it with TreePop. It models ImGui::TreePush.

func Unindent

func Unindent(indentW float32)

Unindent decreases the indent. A zero width uses the default. It models ImGui::Unindent.

func VSliderFloat

func VSliderFloat(label string, size Vec2, v *float32, vMin, vMax float32, opts *SliderOptions) bool

VSliderFloat draws a vertical float slider of the given size bound to v. It models ImGui::VSliderFloat.

func VSliderInt

func VSliderInt(label string, size Vec2, v *int32, vMin, vMax int32, opts *SliderOptions) bool

VSliderInt draws a vertical int slider of the given size bound to v. It models ImGui::VSliderInt.

func VSliderScalar

func VSliderScalar(label string, size Vec2, dataType DataType, pData, pMin, pMax unsafe.Pointer, opts *SliderOptions) bool

VSliderScalar draws a vertical slider of the given size for an arbitrary data type. It models ImGui::VSliderScalar.

Types

type BoolOrPtr

type BoolOrPtr interface {
	bool | *bool
}

BoolOrPtr is a selected-state value accepted by Selectable and MenuItem, held either by value (bool) or by pointer (*bool).

type ButtonOptions

type ButtonOptions struct {
	MouseButtonLeft   bool // ImGuiButtonFlags_MouseButtonLeft
	MouseButtonRight  bool // ImGuiButtonFlags_MouseButtonRight
	MouseButtonMiddle bool // ImGuiButtonFlags_MouseButtonMiddle
	EnableNav         bool // ImGuiButtonFlags_EnableNav
}

ButtonOptions are the optional inputs to InvisibleButton. A nil *ButtonOptions uses Dear ImGui's defaults; each field maps to an ImGuiButtonFlags_ bit.

type ChildOptions

type ChildOptions struct {
	Borders                bool // ImGuiChildFlags_Borders
	AlwaysUseWindowPadding bool // ImGuiChildFlags_AlwaysUseWindowPadding
	ResizeX                bool // ImGuiChildFlags_ResizeX
	ResizeY                bool // ImGuiChildFlags_ResizeY
	AutoResizeX            bool // ImGuiChildFlags_AutoResizeX
	AutoResizeY            bool // ImGuiChildFlags_AutoResizeY
	AlwaysAutoResize       bool // ImGuiChildFlags_AlwaysAutoResize
	FrameStyle             bool // ImGuiChildFlags_FrameStyle
	NavFlattened           bool // ImGuiChildFlags_NavFlattened
}

ChildOptions are the optional inputs to Child. A nil *ChildOptions uses Dear ImGui's defaults; each field maps to an ImGuiChildFlags_ bit.

type Col

type Col = cimgui.Col

Col identifies a styleable interface color, modelling ImGuiCol. It indexes the style-color stack used by StyleColor and GetStyleColorVec4.

type Color

type Color struct {
	R, G, B, A float32
}

Color is an RGBA color with components in the 0..1 range.

func ColorFromVec4

func ColorFromVec4(v Vec4) Color

ColorFromVec4 builds a Color from a Vec4.

func (Color) U32

func (c Color) U32() U32

U32 packs the color into a U32.

func (Color) Vec4

func (c Color) Vec4() Vec4

Vec4 converts the color to a Vec4 (the form Dear ImGui consumes).

type ColorEditOptions

type ColorEditOptions struct {
	NoAlpha          bool // ImGuiColorEditFlags_NoAlpha
	NoPicker         bool // ImGuiColorEditFlags_NoPicker
	NoOptions        bool // ImGuiColorEditFlags_NoOptions
	NoSmallPreview   bool // ImGuiColorEditFlags_NoSmallPreview
	NoInputs         bool // ImGuiColorEditFlags_NoInputs
	NoTooltip        bool // ImGuiColorEditFlags_NoTooltip
	NoLabel          bool // ImGuiColorEditFlags_NoLabel
	NoSidePreview    bool // ImGuiColorEditFlags_NoSidePreview
	NoDragDrop       bool // ImGuiColorEditFlags_NoDragDrop
	NoBorder         bool // ImGuiColorEditFlags_NoBorder
	AlphaOpaque      bool // ImGuiColorEditFlags_AlphaOpaque
	AlphaNoBg        bool // ImGuiColorEditFlags_AlphaNoBg
	AlphaPreviewHalf bool // ImGuiColorEditFlags_AlphaPreviewHalf
	AlphaBar         bool // ImGuiColorEditFlags_AlphaBar
	HDR              bool // ImGuiColorEditFlags_HDR
	DisplayRGB       bool // ImGuiColorEditFlags_DisplayRGB
	DisplayHSV       bool // ImGuiColorEditFlags_DisplayHSV
	DisplayHex       bool // ImGuiColorEditFlags_DisplayHex
	Uint8            bool // ImGuiColorEditFlags_Uint8
	Float            bool // ImGuiColorEditFlags_Float
	PickerHueBar     bool // ImGuiColorEditFlags_PickerHueBar
	PickerHueWheel   bool // ImGuiColorEditFlags_PickerHueWheel
	InputRGB         bool // ImGuiColorEditFlags_InputRGB
	InputHSV         bool // ImGuiColorEditFlags_InputHSV
}

ColorEditOptions are the optional inputs to the color editors, pickers and swatch button. A nil *ColorEditOptions uses Dear ImGui's defaults; each field maps to an ImGuiColorEditFlags_ bit.

type ComboOptions

type ComboOptions struct {
	PopupAlignLeft  bool // ImGuiComboFlags_PopupAlignLeft
	HeightSmall     bool // ImGuiComboFlags_HeightSmall
	HeightRegular   bool // ImGuiComboFlags_HeightRegular
	HeightLarge     bool // ImGuiComboFlags_HeightLarge
	HeightLargest   bool // ImGuiComboFlags_HeightLargest
	NoArrowButton   bool // ImGuiComboFlags_NoArrowButton
	NoPreview       bool // ImGuiComboFlags_NoPreview
	WidthFitPreview bool // ImGuiComboFlags_WidthFitPreview
}

ComboOptions are the optional inputs to Combo. A nil *ComboOptions uses Dear ImGui's defaults; each field maps to an ImGuiComboFlags_ bit.

type Cond

type Cond = cimgui.Cond

Cond selects when a state-setting call (such as SetNextWindowPos) applies. It models ImGuiCond.

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context is a Dear ImGui context. Most programs let app.Run own the context and never create one directly.

func CreateContext

func CreateContext() Context

CreateContext creates and activates a new context.

func (Context) Destroy

func (c Context) Destroy()

Destroy destroys the context.

type CustomWidget

type CustomWidget struct {
	Func func()
}

CustomWidget runs an arbitrary function as a widget. It is the escape hatch for behaviour not yet modelled by a dedicated widget; Func may call the lower-level API directly.

func Custom

func Custom(fn func()) *CustomWidget

Custom returns a CustomWidget that runs fn when displayed.

func (*CustomWidget) Display

func (c *CustomWidget) Display()

Display runs the wrapped function.

type DataType

type DataType = cimgui.DataType

DataType identifies the element type for the scalar widgets (InputScalar, SliderScalar, DragScalar and their N variants). It models ImGuiDataType.

type Dir

type Dir = cimgui.Dir

Dir is a cardinal direction, modelling ImGuiDir. It selects the arrow drawn by ArrowButton and the direction of various layout helpers.

type DrawList

type DrawList = cimgui.DrawList

DrawList is an opaque handle to an ImDrawList: the per-window or per-viewport list of draw commands the primitives below append to. Obtain one with GetWindowDrawList, GetForegroundDrawList or GetBackgroundDrawList.

func GetBackgroundDrawList

func GetBackgroundDrawList() DrawList

GetBackgroundDrawList returns the draw list rendered behind every window. It models ImGui::GetBackgroundDrawList.

func GetForegroundDrawList

func GetForegroundDrawList() DrawList

GetForegroundDrawList returns the draw list rendered in front of every window. It models ImGui::GetForegroundDrawList.

func GetWindowDrawList

func GetWindowDrawList() DrawList

GetWindowDrawList returns the draw list of the current window. It models ImGui::GetWindowDrawList.

type DrawOptions

type DrawOptions struct {
	Closed           bool // ImDrawFlags_Closed
	RoundCornersNone bool // ImDrawFlags_RoundCornersNone
	RoundCornersAll  bool // ImDrawFlags_RoundCornersAll
}

DrawOptions are the optional inputs to the draw-list primitives that take draw flags (DrawListAddRect, DrawListAddRectFilled, DrawListAddPolyline). A nil *DrawOptions uses Dear ImGui's defaults; each field maps to an ImDrawFlags_ bit.

type EndFunc

type EndFunc func()

EndFunc ends a scope opened by a scope-returning function such as Window, Child or StyleColor. It is always safe to call, including via defer, and for conditional scopes is a no-op when the scope did not open.

func Child

func Child[T ID](id T, size Vec2, child *ChildOptions, window *WindowOptions) (open bool, end EndFunc)

Child begins a child region identified by id (a string label or a precomputed uint32 id) and models ImGui::BeginChild. A zero size fills the available space. open reports whether the region is visible; the returned EndFunc (ImGui::EndChild) must always be called.

func Combo

func Combo(label, previewValue string, opts *ComboOptions) (open bool, end EndFunc)

Combo begins a combo box showing previewValue, into which arbitrary selectable content is drawn. It models ImGui::BeginCombo. open reports whether the popup is open; the returned EndFunc (ImGui::EndCombo) ends it only when open. For the simple list-selection forms see ComboItems, ComboZeroSep and ComboFunc.

func Disabled

func Disabled(disabled bool) (end EndFunc)

Disabled begins a disabled block when disabled is true. It models ImGui::BeginDisabled. The returned EndFunc (ImGui::EndDisabled) ends the block and must always be called.

func Group

func Group() (end EndFunc)

Group begins a group; layout queries treat the group as one item until the scope ends. It models ImGui::BeginGroup. The returned EndFunc (ImGui::EndGroup) ends the group.

func ItemTooltip

func ItemTooltip() (open bool, end EndFunc)

ItemTooltip begins a tooltip only when the previous item is hovered. It models ImGui::BeginItemTooltip. open reports whether the tooltip is being drawn; the returned EndFunc (ImGui::EndTooltip) ends it only when open.

func ItemWidth

func ItemWidth(itemWidth float32) (pop EndFunc)

ItemWidth pushes the width of common widgets. It models ImGui::PushItemWidth. The returned EndFunc (ImGui::PopItemWidth) restores the previous width.

func ListBox

func ListBox(label string, size Vec2) (open bool, end EndFunc)

ListBox begins a scrolling list box of the given size, into which selectable content is drawn. It models ImGui::BeginListBox. open reports whether the box is visible; the returned EndFunc (ImGui::EndListBox) ends it only when open. For the simple list-selection forms see ListBoxItems and ListBoxFunc.

func MainMenuBar() (open bool, end EndFunc)

MainMenuBar opens a full-screen menu bar at the top of the viewport. It models ImGui::BeginMainMenuBar. open reports whether the bar is visible; the returned EndFunc (ImGui::EndMainMenuBar) ends it only when open.

func Menu(label string, enabled bool) (open bool, end EndFunc)

Menu opens a sub-menu entry labelled label. It models ImGui::BeginMenu. open reports whether the menu is expanded; the returned EndFunc (ImGui::EndMenu) ends it only when open.

func MenuBar() (open bool, end EndFunc)

MenuBar appends to the menu bar of the current window, which must have been opened with WindowOptions.MenuBar set. It models ImGui::BeginMenuBar. open reports whether the bar is visible; the returned EndFunc (ImGui::EndMenuBar) ends it only when open.

func Popup(strID string, opts *WindowOptions) (open bool, end EndFunc)

Popup begins the popup identified by strID if it has been marked open. It models ImGui::BeginPopup. open reports whether the popup is open; the returned EndFunc (ImGui::EndPopup) ends it only when open.

func PopupContextItem

func PopupContextItem(strID string, opts *PopupOptions) (open bool, end EndFunc)

PopupContextItem begins a popup on right-click of the previous item. An empty strID reuses the previous item's ID. It models ImGui::BeginPopupContextItem. open reports whether the popup is open; the returned EndFunc ends it only when open.

func PopupContextVoid

func PopupContextVoid(strID string, opts *PopupOptions) (open bool, end EndFunc)

PopupContextVoid begins a popup on right-click of empty space (no window). It models ImGui::BeginPopupContextVoid. open reports whether the popup is open; the returned EndFunc ends it only when open.

func PopupContextWindow

func PopupContextWindow(strID string, opts *PopupOptions) (open bool, end EndFunc)

PopupContextWindow begins a popup on right-click of the current window. It models ImGui::BeginPopupContextWindow. open reports whether the popup is open; the returned EndFunc ends it only when open.

func PopupModal

func PopupModal(name string, open *bool, opts *WindowOptions) (visible bool, end EndFunc)

PopupModal begins a modal popup named name. It models ImGui::BeginPopupModal. When open is non-nil a close button is shown and *open is updated; visible reports whether the popup is open. The returned EndFunc (ImGui::EndPopup) ends it only when visible.

func StyleColor

func StyleColor(idx Col, col Vec4) (pop EndFunc)

StyleColor pushes col onto the style-color stack for idx. It models ImGui::PushStyleColor. The returned EndFunc pops the single entry (ImGui::PopStyleColor).

func StyleVarScope

func StyleVarScope[T StyleVarValue](idx StyleVar, val T) (pop EndFunc)

StyleVarScope pushes val onto the style-variable stack for idx. val may be a float32 or a Vec2, modelling the overloads of ImGui::PushStyleVar. The returned EndFunc pops the single entry (ImGui::PopStyleVar).

func TabBar

func TabBar(strID string, opts *TabBarOptions) (open bool, end EndFunc)

TabBar begins a tab bar identified by strID. It models ImGui::BeginTabBar. open reports whether the bar is visible; the returned EndFunc (ImGui::EndTabBar) ends it only when open.

func TabItem

func TabItem(label string, open *bool, opts *TabItemOptions) (selected bool, end EndFunc)

TabItem begins a tab within the current tab bar. It models ImGui::BeginTabItem. When open is non-nil a close button is shown and *open is updated; selected reports whether the tab's contents should be drawn. The returned EndFunc (ImGui::EndTabItem) ends it only when selected.

func Table

func Table(strID string, columns int32, outerSize Vec2, innerWidth float32, opts *TableOptions) (open bool, end EndFunc)

Table begins a table with the given number of columns. A zero outerSize auto-fits. It models ImGui::BeginTable. open reports whether the table is visible; the returned EndFunc (ImGui::EndTable) ends it only when open.

func Tooltip

func Tooltip() (open bool, end EndFunc)

Tooltip begins a tooltip window. It models ImGui::BeginTooltip. open reports whether the tooltip is being drawn; the returned EndFunc (ImGui::EndTooltip) ends it only when open.

func TreeNode

func TreeNode(label string) (open bool, end EndFunc)

TreeNode opens a tree node labelled label. It models ImGui::TreeNode. open reports whether the node is expanded; the returned EndFunc (ImGui::TreePop) unindents it and is called only when open.

func TreeNodeEx

func TreeNodeEx(label string, opts *TreeNodeOptions) (open bool, end EndFunc)

TreeNodeEx opens a tree node with options. It models ImGui::TreeNodeEx. open reports whether the node is expanded; the returned EndFunc (ImGui::TreePop) is called only when open and the node pushed onto the tree stack (i.e. unless NoTreePushOnOpen is set).

func Window

func Window(name string, open *bool, opts *WindowOptions) (visible bool, end EndFunc)

Window begins a window and pushes it onto the window stack. It models ImGui::Begin. When open is non-nil a close button is shown and *open is updated; visible reports whether the window's contents should be drawn. The returned EndFunc (ImGui::End) must always be called, regardless of visible.

type HoveredOptions

type HoveredOptions struct {
	ChildWindows                 bool // ImGuiHoveredFlags_ChildWindows
	RootWindow                   bool // ImGuiHoveredFlags_RootWindow
	AnyWindow                    bool // ImGuiHoveredFlags_AnyWindow
	NoPopupHierarchy             bool // ImGuiHoveredFlags_NoPopupHierarchy
	AllowWhenBlockedByPopup      bool // ImGuiHoveredFlags_AllowWhenBlockedByPopup
	AllowWhenBlockedByActiveItem bool // ImGuiHoveredFlags_AllowWhenBlockedByActiveItem
	AllowWhenOverlapped          bool // ImGuiHoveredFlags_AllowWhenOverlapped
	AllowWhenDisabled            bool // ImGuiHoveredFlags_AllowWhenDisabled
	RectOnly                     bool // ImGuiHoveredFlags_RectOnly (composite)
	RootAndChildWindows          bool // ImGuiHoveredFlags_RootAndChildWindows (composite)
	ForTooltip                   bool // ImGuiHoveredFlags_ForTooltip
	Stationary                   bool // ImGuiHoveredFlags_Stationary
	DelayNone                    bool // ImGuiHoveredFlags_DelayNone
	DelayShort                   bool // ImGuiHoveredFlags_DelayShort
	DelayNormal                  bool // ImGuiHoveredFlags_DelayNormal
}

HoveredOptions are the optional inputs to IsItemHovered. A nil *HoveredOptions uses Dear ImGui's defaults; each field maps to an ImGuiHoveredFlags_ bit.

type ID

type ID interface {
	string | uint32
}

ID is a widget identifier accepted by the id-overloaded scope functions (Child, OpenPopup, etc): either a string label or a precomputed uint32 id.

type InputOptions

type InputOptions struct {
	Format              string // numeric display format; empty uses the widget default
	CharsDecimal        bool   // ImGuiInputTextFlags_CharsDecimal
	CharsHexadecimal    bool   // ImGuiInputTextFlags_CharsHexadecimal
	CharsScientific     bool   // ImGuiInputTextFlags_CharsScientific
	CharsUppercase      bool   // ImGuiInputTextFlags_CharsUppercase
	CharsNoBlank        bool   // ImGuiInputTextFlags_CharsNoBlank
	AllowTabInput       bool   // ImGuiInputTextFlags_AllowTabInput
	EnterReturnsTrue    bool   // ImGuiInputTextFlags_EnterReturnsTrue
	EscapeClearsAll     bool   // ImGuiInputTextFlags_EscapeClearsAll
	CtrlEnterForNewLine bool   // ImGuiInputTextFlags_CtrlEnterForNewLine
	ReadOnly            bool   // ImGuiInputTextFlags_ReadOnly
	Password            bool   // ImGuiInputTextFlags_Password
	AlwaysOverwrite     bool   // ImGuiInputTextFlags_AlwaysOverwrite
	AutoSelectAll       bool   // ImGuiInputTextFlags_AutoSelectAll
	ParseEmptyRefVal    bool   // ImGuiInputTextFlags_ParseEmptyRefVal
	DisplayEmptyRefVal  bool   // ImGuiInputTextFlags_DisplayEmptyRefVal
	NoHorizontalScroll  bool   // ImGuiInputTextFlags_NoHorizontalScroll
	NoUndoRedo          bool   // ImGuiInputTextFlags_NoUndoRedo
	ElideLeft           bool   // ImGuiInputTextFlags_ElideLeft
	CallbackCompletion  bool   // ImGuiInputTextFlags_CallbackCompletion
	CallbackHistory     bool   // ImGuiInputTextFlags_CallbackHistory
	CallbackAlways      bool   // ImGuiInputTextFlags_CallbackAlways
	CallbackCharFilter  bool   // ImGuiInputTextFlags_CallbackCharFilter
	CallbackResize      bool   // ImGuiInputTextFlags_CallbackResize
	CallbackEdit        bool   // ImGuiInputTextFlags_CallbackEdit
}

InputOptions are the optional inputs to the Input* widgets. A nil *InputOptions uses Dear ImGui's defaults. Format overrides the printf-style display format of the numeric inputs (empty selects each widget's default) and is ignored by the text inputs. The remaining fields map to ImGuiInputTextFlags_ bits.

type InputTextCallback

type InputTextCallback = cimgui.InputTextCallback

InputTextCallback receives an event during an input-text widget, modelling the C ImGuiInputTextCallback. It returns 0 in the common case.

type InputTextCallbackData

type InputTextCallbackData = cimgui.InputTextCallbackData

InputTextCallbackData is a view over the live ImGuiInputTextCallbackData passed to an InputTextCallback. It is valid only for the duration of the callback.

type Key

type Key = cimgui.Key

Key identifies a keyboard key, modelling ImGuiKey.

type MouseButton

type MouseButton = cimgui.MouseButton

MouseButton identifies a mouse button, modelling ImGuiMouseButton. It selects the button queried by IsItemClicked.

type PopupOptions

type PopupOptions struct {
	MouseButtonLeft         bool // ImGuiPopupFlags_MouseButtonLeft
	MouseButtonRight        bool // ImGuiPopupFlags_MouseButtonRight
	MouseButtonMiddle       bool // ImGuiPopupFlags_MouseButtonMiddle
	NoReopen                bool // ImGuiPopupFlags_NoReopen
	NoOpenOverExistingPopup bool // ImGuiPopupFlags_NoOpenOverExistingPopup
	NoOpenOverItems         bool // ImGuiPopupFlags_NoOpenOverItems
	AnyPopupID              bool // ImGuiPopupFlags_AnyPopupId
	AnyPopupLevel           bool // ImGuiPopupFlags_AnyPopupLevel
	AnyPopup                bool // ImGuiPopupFlags_AnyPopup (composite)
}

PopupOptions are the optional inputs to OpenPopup, the context-menu helpers and IsPopupOpen. A nil *PopupOptions uses Dear ImGui's defaults; each field maps to an ImGuiPopupFlags_ bit.

type SelectableOptions

type SelectableOptions struct {
	NoAutoClosePopups bool // ImGuiSelectableFlags_NoAutoClosePopups
	SpanAllColumns    bool // ImGuiSelectableFlags_SpanAllColumns
	AllowDoubleClick  bool // ImGuiSelectableFlags_AllowDoubleClick
	Disabled          bool // ImGuiSelectableFlags_Disabled
	AllowOverlap      bool // ImGuiSelectableFlags_AllowOverlap
	Highlight         bool // ImGuiSelectableFlags_Highlight
}

SelectableOptions are the optional inputs to Selectable. A nil *SelectableOptions uses Dear ImGui's defaults; each field maps to an ImGuiSelectableFlags_ bit.

type SignedOrUnsigned32

type SignedOrUnsigned32 interface {
	int32 | uint32
}

SignedOrUnsigned32 is a 32-bit signed or unsigned integer, the bitset value type edited by CheckboxFlags.

type SliderOptions

type SliderOptions struct {
	Format          string // display format; empty uses the widget default
	FormatMax       string // upper-bound format for range widgets
	Logarithmic     bool   // ImGuiSliderFlags_Logarithmic
	NoRoundToFormat bool   // ImGuiSliderFlags_NoRoundToFormat
	NoInput         bool   // ImGuiSliderFlags_NoInput
	WrapAround      bool   // ImGuiSliderFlags_WrapAround
	ClampOnInput    bool   // ImGuiSliderFlags_ClampOnInput
	ClampZeroRange  bool   // ImGuiSliderFlags_ClampZeroRange
	NoSpeedTweaks   bool   // ImGuiSliderFlags_NoSpeedTweaks
	AlwaysClamp     bool   // ImGuiSliderFlags_AlwaysClamp
}

SliderOptions are the optional inputs to the slider and drag widgets. A nil *SliderOptions uses Dear ImGui's defaults. Format overrides the printf-style display format (empty selects each widget's default); FormatMax does the same for the upper bound of the range widgets (DragFloatRange2, DragIntRange2). The remaining fields map to ImGuiSliderFlags_ bits.

type Style

type Style = cimgui.Style

Style is a view over the live ImGuiStyle. Mutating it changes the global style in place. It models ImGuiStyle.

func GetStyle

func GetStyle() *Style

GetStyle returns the current global Style. It models ImGui::GetStyle.

type StyleVar

type StyleVar = cimgui.StyleVar

StyleVar identifies a styleable layout variable, modelling ImGuiStyleVar. It indexes the style-variable stack used by PushStyleVar and StyleVarScope.

type StyleVarValue

type StyleVarValue interface {
	float32 | Vec2
}

StyleVarValue is a style-variable value accepted by PushStyleVar and StyleVarScope: a float32 or a Vec2.

type TabBarOptions

type TabBarOptions struct {
	Reorderable                  bool // ImGuiTabBarFlags_Reorderable
	AutoSelectNewTabs            bool // ImGuiTabBarFlags_AutoSelectNewTabs
	TabListPopupButton           bool // ImGuiTabBarFlags_TabListPopupButton
	NoCloseWithMiddleMouseButton bool // ImGuiTabBarFlags_NoCloseWithMiddleMouseButton
	NoTabListScrollingButtons    bool // ImGuiTabBarFlags_NoTabListScrollingButtons
	NoTooltip                    bool // ImGuiTabBarFlags_NoTooltip
	DrawSelectedOverline         bool // ImGuiTabBarFlags_DrawSelectedOverline
	FittingPolicyShrink          bool // ImGuiTabBarFlags_FittingPolicyShrink
	FittingPolicyScroll          bool // ImGuiTabBarFlags_FittingPolicyScroll
	FittingPolicyMixed           bool // ImGuiTabBarFlags_FittingPolicyMixed
}

TabBarOptions are the optional inputs to TabBar. A nil *TabBarOptions uses Dear ImGui's defaults; each field maps to an ImGuiTabBarFlags_ bit.

type TabItemOptions

type TabItemOptions struct {
	UnsavedDocument              bool // ImGuiTabItemFlags_UnsavedDocument
	SetSelected                  bool // ImGuiTabItemFlags_SetSelected
	NoCloseWithMiddleMouseButton bool // ImGuiTabItemFlags_NoCloseWithMiddleMouseButton
	NoPushID                     bool // ImGuiTabItemFlags_NoPushId
	NoTooltip                    bool // ImGuiTabItemFlags_NoTooltip
	NoReorder                    bool // ImGuiTabItemFlags_NoReorder
	Leading                      bool // ImGuiTabItemFlags_Leading
	Trailing                     bool // ImGuiTabItemFlags_Trailing
	NoAssumedClosure             bool // ImGuiTabItemFlags_NoAssumedClosure
}

TabItemOptions are the optional inputs to TabItem and TabItemButton. A nil *TabItemOptions uses Dear ImGui's defaults; each field maps to an ImGuiTabItemFlags_ bit.

type TableColumnOptions

type TableColumnOptions struct {
	Disabled             bool // ImGuiTableColumnFlags_Disabled
	DefaultHide          bool // ImGuiTableColumnFlags_DefaultHide
	DefaultSort          bool // ImGuiTableColumnFlags_DefaultSort
	WidthStretch         bool // ImGuiTableColumnFlags_WidthStretch
	WidthFixed           bool // ImGuiTableColumnFlags_WidthFixed
	NoResize             bool // ImGuiTableColumnFlags_NoResize
	NoReorder            bool // ImGuiTableColumnFlags_NoReorder
	NoHide               bool // ImGuiTableColumnFlags_NoHide
	NoClip               bool // ImGuiTableColumnFlags_NoClip
	NoSort               bool // ImGuiTableColumnFlags_NoSort
	NoSortAscending      bool // ImGuiTableColumnFlags_NoSortAscending
	NoSortDescending     bool // ImGuiTableColumnFlags_NoSortDescending
	NoHeaderLabel        bool // ImGuiTableColumnFlags_NoHeaderLabel
	NoHeaderWidth        bool // ImGuiTableColumnFlags_NoHeaderWidth
	PreferSortAscending  bool // ImGuiTableColumnFlags_PreferSortAscending
	PreferSortDescending bool // ImGuiTableColumnFlags_PreferSortDescending
	IndentEnable         bool // ImGuiTableColumnFlags_IndentEnable
	IndentDisable        bool // ImGuiTableColumnFlags_IndentDisable
	AngledHeader         bool // ImGuiTableColumnFlags_AngledHeader
	IsEnabled            bool // ImGuiTableColumnFlags_IsEnabled (status)
	IsVisible            bool // ImGuiTableColumnFlags_IsVisible (status)
	IsSorted             bool // ImGuiTableColumnFlags_IsSorted (status)
	IsHovered            bool // ImGuiTableColumnFlags_IsHovered (status)
}

TableColumnOptions are the optional inputs to TableSetupColumn. A nil pointer uses Dear ImGui's defaults; each field maps to an ImGuiTableColumnFlags_ bit. The Is* fields are status flags reported by Dear ImGui and have no effect when set as input.

type TableOptions

type TableOptions struct {
	Resizable                  bool // ImGuiTableFlags_Resizable
	Reorderable                bool // ImGuiTableFlags_Reorderable
	Hideable                   bool // ImGuiTableFlags_Hideable
	Sortable                   bool // ImGuiTableFlags_Sortable
	NoSavedSettings            bool // ImGuiTableFlags_NoSavedSettings
	ContextMenuInBody          bool // ImGuiTableFlags_ContextMenuInBody
	RowBg                      bool // ImGuiTableFlags_RowBg
	BordersInnerH              bool // ImGuiTableFlags_BordersInnerH
	BordersOuterH              bool // ImGuiTableFlags_BordersOuterH
	BordersInnerV              bool // ImGuiTableFlags_BordersInnerV
	BordersOuterV              bool // ImGuiTableFlags_BordersOuterV
	BordersH                   bool // ImGuiTableFlags_BordersH (composite)
	BordersV                   bool // ImGuiTableFlags_BordersV (composite)
	BordersInner               bool // ImGuiTableFlags_BordersInner (composite)
	BordersOuter               bool // ImGuiTableFlags_BordersOuter (composite)
	Borders                    bool // ImGuiTableFlags_Borders (composite)
	NoBordersInBody            bool // ImGuiTableFlags_NoBordersInBody
	NoBordersInBodyUntilResize bool // ImGuiTableFlags_NoBordersInBodyUntilResize
	SizingFixedFit             bool // ImGuiTableFlags_SizingFixedFit
	SizingFixedSame            bool // ImGuiTableFlags_SizingFixedSame
	SizingStretchProp          bool // ImGuiTableFlags_SizingStretchProp
	SizingStretchSame          bool // ImGuiTableFlags_SizingStretchSame
	NoHostExtendX              bool // ImGuiTableFlags_NoHostExtendX
	NoHostExtendY              bool // ImGuiTableFlags_NoHostExtendY
	NoKeepColumnsVisible       bool // ImGuiTableFlags_NoKeepColumnsVisible
	PreciseWidths              bool // ImGuiTableFlags_PreciseWidths
	NoClip                     bool // ImGuiTableFlags_NoClip
	PadOuterX                  bool // ImGuiTableFlags_PadOuterX
	NoPadOuterX                bool // ImGuiTableFlags_NoPadOuterX
	NoPadInnerX                bool // ImGuiTableFlags_NoPadInnerX
	ScrollX                    bool // ImGuiTableFlags_ScrollX
	ScrollY                    bool // ImGuiTableFlags_ScrollY
	SortMulti                  bool // ImGuiTableFlags_SortMulti
	SortTristate               bool // ImGuiTableFlags_SortTristate
	HighlightHoveredColumn     bool // ImGuiTableFlags_HighlightHoveredColumn
}

TableOptions are the optional inputs to Table. A nil *TableOptions uses Dear ImGui's defaults; each field maps to an ImGuiTableFlags_ bit.

type TableRowOptions

type TableRowOptions struct {
	Headers bool // ImGuiTableRowFlags_Headers
}

TableRowOptions are the optional inputs to TableNextRow. A nil pointer uses Dear ImGui's defaults.

type TextBuffer

type TextBuffer = cimgui.TextBuffer

TextBuffer is a growable, NUL-terminated C-backed text buffer used by the resizable input-text wrappers (InputTextResizable and friends). Build one with NewTextBuffer; its memory is released by a finalizer or eagerly via [TextBuffer.Free].

func NewTextBuffer

func NewTextBuffer(s string) *TextBuffer

NewTextBuffer returns a TextBuffer seeded with s.

type TextureRef

type TextureRef = cimgui.TextureRef

TextureRef refers to a texture the renderer backend can draw, wrapping Dear ImGui's ImTextureRef. It is the texture identifier accepted by Image, ImageWithBg and ImageButton.

func FontAtlasTexRef

func FontAtlasTexRef() TextureRef

FontAtlasTexRef returns the TextureRef of the current context's font atlas, valid once the backend has uploaded the atlas. It models reading ImGui::GetIO().Fonts->TexRef.

func TextureRefFromID

func TextureRefFromID(id uint64) TextureRef

TextureRefFromID builds a TextureRef from a backend texture identifier. It models constructing an ImTextureRef from an ImTextureID.

type TreeNodeOptions

type TreeNodeOptions struct {
	Selected             bool // ImGuiTreeNodeFlags_Selected
	Framed               bool // ImGuiTreeNodeFlags_Framed
	AllowOverlap         bool // ImGuiTreeNodeFlags_AllowOverlap
	NoTreePushOnOpen     bool // ImGuiTreeNodeFlags_NoTreePushOnOpen
	NoAutoOpenOnLog      bool // ImGuiTreeNodeFlags_NoAutoOpenOnLog
	DefaultOpen          bool // ImGuiTreeNodeFlags_DefaultOpen
	OpenOnDoubleClick    bool // ImGuiTreeNodeFlags_OpenOnDoubleClick
	OpenOnArrow          bool // ImGuiTreeNodeFlags_OpenOnArrow
	Leaf                 bool // ImGuiTreeNodeFlags_Leaf
	Bullet               bool // ImGuiTreeNodeFlags_Bullet
	FramePadding         bool // ImGuiTreeNodeFlags_FramePadding
	SpanAvailWidth       bool // ImGuiTreeNodeFlags_SpanAvailWidth
	SpanFullWidth        bool // ImGuiTreeNodeFlags_SpanFullWidth
	SpanLabelWidth       bool // ImGuiTreeNodeFlags_SpanLabelWidth
	SpanAllColumns       bool // ImGuiTreeNodeFlags_SpanAllColumns
	LabelSpanAllColumns  bool // ImGuiTreeNodeFlags_LabelSpanAllColumns
	NavLeftJumpsToParent bool // ImGuiTreeNodeFlags_NavLeftJumpsToParent
	CollapsingHeader     bool // ImGuiTreeNodeFlags_CollapsingHeader (composite)
}

TreeNodeOptions are the optional inputs to TreeNodeEx, CollapsingHeader and CollapsingHeaderClosable. A nil *TreeNodeOptions uses Dear ImGui's defaults; each field maps to an ImGuiTreeNodeFlags_ bit.

type U32

type U32 = cimgui.U32

U32 is a packed 32-bit RGBA color, the form the custom-drawing primitives consume.

func ColorConvertFloat4ToU32

func ColorConvertFloat4ToU32(col Vec4) U32

ColorConvertFloat4ToU32 packs an RGBA Vec4 (components in 0..1) into a U32. It models ImGui::ColorConvertFloat4ToU32.

func GetColorU32

func GetColorU32(idx Col, alphaMul float32) U32

GetColorU32 returns the current style color for idx, scaled by alphaMul, as a U32. It models ImGui::GetColorU32 (the ImGuiCol overload).

type Vec2

type Vec2 = cimgui.Vec2

Vec2 is a 2D vector of 32-bit floats, mirroring Dear ImGui's ImVec2. It is an alias of the binding type so it can be passed straight through with no copy.

func GetContentRegionAvail

func GetContentRegionAvail() Vec2

GetContentRegionAvail returns the space remaining from the cursor to the edge of the current content region. It models ImGui::GetContentRegionAvail.

func GetCursorPos

func GetCursorPos() Vec2

GetCursorPos returns the cursor position in window-local coordinates. It models ImGui::GetCursorPos.

func GetCursorScreenPos

func GetCursorScreenPos() Vec2

GetCursorScreenPos returns the cursor position in absolute screen coordinates, the origin used by the draw-list primitives. It models ImGui::GetCursorScreenPos.

type Vec4

type Vec4 = cimgui.Vec4

Vec4 is a 4D vector of 32-bit floats, mirroring Dear ImGui's ImVec4.

func GetStyleColorVec4

func GetStyleColorVec4(idx Col) Vec4

GetStyleColorVec4 returns the current style color for idx. It models ImGui::GetStyleColorVec4.

type Widget

type Widget interface {
	// Display draws the widget for the current frame. It must be called between
	// [NewFrame] and [Render] (app.Run handles that).
	Display()
}

Widget is anything that can draw itself for the current frame. The high-level API is a retained tree of Widgets rebuilt each frame: containers hold child Widgets and own their begin/end pairing, so widgets can never be issued in the wrong order.

type WindowOptions

type WindowOptions struct {
	NoTitleBar                bool // ImGuiWindowFlags_NoTitleBar
	NoResize                  bool // ImGuiWindowFlags_NoResize
	NoMove                    bool // ImGuiWindowFlags_NoMove
	NoScrollbar               bool // ImGuiWindowFlags_NoScrollbar
	NoScrollWithMouse         bool // ImGuiWindowFlags_NoScrollWithMouse
	NoCollapse                bool // ImGuiWindowFlags_NoCollapse
	AlwaysAutoResize          bool // ImGuiWindowFlags_AlwaysAutoResize
	NoBackground              bool // ImGuiWindowFlags_NoBackground
	NoSavedSettings           bool // ImGuiWindowFlags_NoSavedSettings
	NoMouseInputs             bool // ImGuiWindowFlags_NoMouseInputs
	MenuBar                   bool // ImGuiWindowFlags_MenuBar
	HorizontalScrollbar       bool // ImGuiWindowFlags_HorizontalScrollbar
	NoFocusOnAppearing        bool // ImGuiWindowFlags_NoFocusOnAppearing
	NoBringToFrontOnFocus     bool // ImGuiWindowFlags_NoBringToFrontOnFocus
	AlwaysVerticalScrollbar   bool // ImGuiWindowFlags_AlwaysVerticalScrollbar
	AlwaysHorizontalScrollbar bool // ImGuiWindowFlags_AlwaysHorizontalScrollbar
	NoNavInputs               bool // ImGuiWindowFlags_NoNavInputs
	NoNavFocus                bool // ImGuiWindowFlags_NoNavFocus
	UnsavedDocument           bool // ImGuiWindowFlags_UnsavedDocument
	NoNav                     bool // ImGuiWindowFlags_NoNav (composite)
	NoDecoration              bool // ImGuiWindowFlags_NoDecoration (composite)
	NoInputs                  bool // ImGuiWindowFlags_NoInputs (composite)
}

WindowOptions are the optional inputs to Window. A nil *WindowOptions uses Dear ImGui's defaults; each field maps to an ImGuiWindowFlags_ bit.

Directories

Path Synopsis
package app runs a Dear ImGui application: it owns the GLFW window, the OpenGL3 + GLFW backends, the Dear ImGui context, and the per-frame loop, so callers only write per-frame UI code.
package app runs a Dear ImGui application: it owns the GLFW window, the OpenGL3 + GLFW backends, the Dear ImGui context, and the per-frame loop, so callers only write per-frame UI code.
Package button provides button widgets.
Package button provides button widgets.
Package canvas provides custom-drawing widgets backed by Dear ImGui's draw lists.
Package canvas provides custom-drawing widgets backed by Dear ImGui's draw lists.
Package color provides color-editing widgets bound to an imgui.Color.
Package color provides color-editing widgets bound to an imgui.Color.
Package combo provides combo boxes, list boxes and selectable items.
Package combo provides combo boxes, list boxes and selectable items.
Package debug provides Dear ImGui's built-in demo and diagnostic windows as widgets.
Package debug provides Dear ImGui's built-in demo and diagnostic windows as widgets.
example
demo command
Command demo opens a window and exercises the high-level widget packages.
Command demo opens a window and exercises the high-level widget packages.
Package input provides value-editing widgets: checkboxes (including flag checkboxes), radio buttons, sliders and drags (scalar, multi-component and vertical), numeric and vector inputs, text inputs, and generic widgets over any numeric type (see Scalar).
Package input provides value-editing widgets: checkboxes (including flag checkboxes), radio buttons, sliders and drags (scalar, multi-component and vertical), numeric and vector inputs, text inputs, and generic widgets over any numeric type (see Scalar).
internal
cimgui
package cimgui is the single cgo boundary for the Dear ImGui wrapper.
package cimgui is the single cgo boundary for the Dear ImGui wrapper.
handle
package handle hands out opaque tokens that carry a Go value across the cgo boundary.
package handle hands out opaque tokens that carry a Go value across the cgo boundary.
Package layout provides spacing and grouping widgets.
Package layout provides spacing and grouping widgets.
Package menu provides menu bars, menus and menu items.
Package menu provides menu bars, menus and menu items.
Package plot provides simple line and histogram plots.
Package plot provides simple line and histogram plots.
Package popup provides popups, modal dialogs and context menus.
Package popup provides popups, modal dialogs and context menus.
package style configures the global Dear ImGui visual style and provides scoped style overrides.
package style configures the global Dear ImGui visual style and provides scoped style overrides.
Package tab provides tab bars and tab items.
Package tab provides tab bars and tab items.
Package table provides tabular layout.
Package table provides tabular layout.
Package text provides text-display widgets (labels, colored/disabled/wrapped text, bullets, separators and links).
Package text provides text-display widgets (labels, colored/disabled/wrapped text, bullets, separators and links).
Package texture uploads images to the GPU and draws them.
Package texture uploads images to the GPU and draws them.
Package tooltip attaches hover tooltips to other widgets.
Package tooltip attaches hover tooltips to other widgets.
Package tree provides collapsible tree nodes and headers.
Package tree provides collapsible tree nodes and headers.
Package window provides top-level windows and child regions.
Package window provides top-level windows and child regions.

Jump to

Keyboard shortcuts

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