Documentation ¶
Overview ¶
Package imgui contains all the functions to create an immediate mode graphical user interface based on Dear ImGui.
Setup ¶
For integration, please refer to the dedicated repository https://github.com/inkyblackness/imgui-go-examples , which contains ported examples of the C++ version, available to Go.
Conventions ¶
The exported functions and constants are named closely to that of the wrapped library. If a function has optional parameters, it will be available in two versions: A verbose one, which has all optional parameters listed, and a terse one, with only the mandatory parameters in its signature. The verbose variant will have the suffix V in its name. For example, there are
func Button(id string) bool
and
func ButtonV(id string, size Vec2) bool
The terse variant will list the default parameters it uses to call the verbose variant.
There are several types which are based on uintptr. These are references to the wrapped instances in C++. You will always get to such a reference via some function - you never "instantiate" such an instance on your own.
Index ¶
- Constants
- Variables
- func AcceptDragDropPayload(dataType string, flags int) []byte
- func AlignTextToFramePadding()
- func Begin(id string) bool
- func BeginChild(id string) bool
- func BeginChildV(id string, size Vec2, border bool, flags int) bool
- func BeginCombo(label, previewValue string) bool
- func BeginComboV(label, previewValue string, flags int) bool
- func BeginDragDropSource(flags int) bool
- func BeginDragDropTarget() bool
- func BeginGroup()
- func BeginMainMenuBar() bool
- func BeginMenu(label string) bool
- func BeginMenuBar() bool
- func BeginMenuV(label string, enabled bool) bool
- func BeginPopup(name string) bool
- func BeginPopupContextItem() bool
- func BeginPopupContextItemV(label string, mouseButton int) bool
- func BeginPopupModal(name string) bool
- func BeginPopupModalV(name string, open *bool, flags int) bool
- func BeginPopupV(name string, flags int) bool
- func BeginTabBar(strID string) bool
- func BeginTabBarV(strID string, flags int) bool
- func BeginTabItem(label string) bool
- func BeginTabItemV(label string, open *bool, flags int) bool
- func BeginTooltip()
- func BeginV(id string, open *bool, flags int) bool
- func Bullet()
- func Button(id string) bool
- func ButtonV(id string, size Vec2) bool
- func CalcItemWidth() float32
- func Checkbox(id string, selected *bool) bool
- func ClearActiveID()
- func CloseCurrentPopup()
- func CollapsingHeader(label string) bool
- func ColorEdit3(label string, col *[3]float32) bool
- func ColorEdit3V(label string, col *[3]float32, flags int) bool
- func ColorEdit4(label string, col *[4]float32) bool
- func ColorEdit4V(label string, col *[4]float32, flags int) bool
- func ColorPicker3(label string, col *[3]float32) bool
- func ColorPicker3V(label string, col *[3]float32, flags int) bool
- func ColorPicker4(label string, col *[4]float32) bool
- func ColorPicker4V(label string, col *[4]float32, flags int) bool
- func ColumnIndex() int
- func ColumnOffset() float32
- func ColumnOffsetV(index int) float32
- func ColumnWidth() int
- func ColumnWidthV(index int) int
- func Columns()
- func ColumnsCount() int
- func ColumnsV(count int, label string, border bool)
- func CursorPosX() float32
- func CursorPosY() float32
- func DragFloat(label string, value *float32) bool
- func DragFloatV(label string, value *float32, speed, min, max float32, format string, ...) bool
- func DragInt(label string, value *int32) bool
- func DragIntV(label string, value *int32, speed float32, min, max int32, format string) bool
- func Dummy(size Vec2)
- func End()
- func EndChild()
- func EndCombo()
- func EndDragDropSource()
- func EndDragDropTarget()
- func EndFrame()
- func EndGroup()
- func EndMainMenuBar()
- func EndMenu()
- func EndMenuBar()
- func EndPopup()
- func EndTabBar()
- func EndTabItem()
- func EndTooltip()
- func FontSize() float32
- func FrameHeight() float32
- func FrameHeightWithSpacing() float32
- func GetScrollMaxX() float32
- func GetScrollMaxY() float32
- func GetScrollX() float32
- func GetScrollY() float32
- func Image(id TextureID, size Vec2)
- func ImageButton(id TextureID, size Vec2) bool
- func ImageButtonV(id TextureID, size Vec2, uv0, uv1 Vec2, framePadding int, bgCol Vec4, ...) bool
- func ImageV(id TextureID, size Vec2, uv0, uv1 Vec2, tintCol, borderCol Vec4)
- func Indent()
- func IndentV(indentW float32)
- func IndexBufferLayout() (entrySize int)
- func InputInt(label string, value *int32) bool
- func InputIntV(label string, value *int32, step int, stepFast int, flags int) bool
- func InputText(label string, text *string) bool
- func InputTextMultiline(label string, text *string) bool
- func InputTextMultilineV(label string, text *string, size Vec2, flags int, cb InputTextCallback) bool
- func InputTextV(label string, text *string, flags int, cb InputTextCallback) bool
- func InputTextWithHint(label string, hint string, text *string) bool
- func InputTextWithHintV(label string, hint string, text *string, flags int, cb InputTextCallback) bool
- func InvisibleButton(id string) bool
- func InvisibleButtonV(id string, size Vec2) bool
- func IsAnyItemActive() bool
- func IsAnyItemFocused() bool
- func IsAnyMouseDown() bool
- func IsItemActivated() bool
- func IsItemActive() bool
- func IsItemClicked() bool
- func IsItemDeactivated() bool
- func IsItemDeactivatedAfterEdit() bool
- func IsItemEdited() bool
- func IsItemFocused() bool
- func IsItemHovered() bool
- func IsItemHoveredV(flags int) bool
- func IsItemToggledOpen() bool
- func IsItemVisible() bool
- func IsKeyDown(key int) bool
- func IsKeyPressed(key int) bool
- func IsKeyPressedV(key int, repeat bool) bool
- func IsKeyReleased(key int) bool
- func IsMouseClicked(button int) bool
- func IsMouseClickedV(button int, repeat bool) bool
- func IsMouseDoubleClicked(button int) bool
- func IsMouseDown(button int) bool
- func IsMouseDragging(button int, threshold float64) bool
- func IsMouseReleased(button int) bool
- func IsWindowAppearing() bool
- func IsWindowCollapsed() bool
- func IsWindowFocused() bool
- func IsWindowFocusedV(flags int) bool
- func IsWindowHovered() bool
- func IsWindowHoveredV(flags int) bool
- func LabelText(label, text string)
- func ListBox(label string, currentItem *int32, items []string) bool
- func ListBoxV(label string, currentItem *int32, items []string, heightItems int) bool
- func MenuItem(label string) bool
- func MenuItemV(label string, shortcut string, selected bool, enabled bool) bool
- func MouseCursor() int
- func NewFrame()
- func NextColumn()
- func OpenPopup(id string)
- func PlotHistogram(label string, values []float32)
- func PlotHistogramV(label string, values []float32, valuesOffset int, overlayText string, ...)
- func PlotLines(label string, values []float32)
- func PlotLinesV(label string, values []float32, valuesOffset int, overlayText string, ...)
- func PopButtonRepeat()
- func PopFont()
- func PopID()
- func PopItemWidth()
- func PopStyleColor()
- func PopStyleColorV(count int)
- func PopStyleVar()
- func PopStyleVarV(count int)
- func PopTextWrapPos()
- func ProgressBar(fraction float32)
- func ProgressBarV(fraction float32, size Vec2, overlay string)
- func PushButtonRepeat(repeat bool)
- func PushFont(font Font)
- func PushID(id string)
- func PushIDInt(id int)
- func PushItemWidth(width float32)
- func PushStyleColor(id StyleColorID, color Vec4)
- func PushStyleVarFloat(id StyleVarID, value float32)
- func PushStyleVarVec2(id StyleVarID, value Vec2)
- func PushTextWrapPos()
- func PushTextWrapPosV(wrapPosX float32)
- func RadioButton(id string, active bool) bool
- func Render()
- func SameLine()
- func SameLineV(posX float32, spacingW float32)
- func ScrollMaxX() float32
- func ScrollMaxY() float32
- func ScrollX() float32
- func ScrollY() float32
- func Selectable(label string) bool
- func SelectableV(label string, selected bool, flags int, size Vec2) bool
- func Separator()
- func SetAssertHandler(handler AssertHandler)
- func SetColumnOffset(index int, offsetX float32)
- func SetColumnWidth(index int, width float32)
- func SetCursorPos(localPos Vec2)
- func SetCursorScreenPos(absPos Vec2)
- func SetDragDropPayload(dataType string, data []byte, cond Condition) bool
- func SetItemDefaultFocus()
- func SetKeyboardFocusHere()
- func SetKeyboardFocusHereV(offset int)
- func SetMouseCursor(cursor int)
- func SetNextItemOpen(open bool, cond Condition)
- func SetNextWindowBgAlpha(value float32)
- func SetNextWindowCollapsed(collapsed bool, cond Condition)
- func SetNextWindowContentSize(size Vec2)
- func SetNextWindowFocus()
- func SetNextWindowPos(pos Vec2)
- func SetNextWindowPosV(pos Vec2, cond Condition, pivot Vec2)
- func SetNextWindowSize(size Vec2)
- func SetNextWindowSizeConstraints(sizeMin Vec2, sizeMax Vec2)
- func SetNextWindowSizeV(size Vec2, cond Condition)
- func SetScrollHereX(ratio float32)
- func SetScrollHereY(ratio float32)
- func SetScrollX(scrollX float32)
- func SetScrollY(scrollY float32)
- func SetTabItemClosed(tabOrDockedWindowLabel string)
- func SetTooltip(text string)
- func ShowDemoWindow(open *bool)
- func ShowUserGuide()
- func SliderFloat(label string, value *float32, min, max float32) bool
- func SliderFloat3(label string, values *[3]float32, min, max float32) bool
- func SliderFloat3V(label string, values *[3]float32, min, max float32, format string, ...) bool
- func SliderFloatV(label string, value *float32, min, max float32, format string, power float32) bool
- func SliderInt(label string, value *int32, min, max int32) bool
- func SliderIntV(label string, value *int32, min, max int32, format string) bool
- func Spacing()
- func StyleColorsClassic()
- func StyleColorsDark()
- func StyleColorsLight()
- func Text(text string)
- func TextLineHeight() float32
- func TextLineHeightWithSpacing() float32
- func Time() float64
- func TreeNode(label string) bool
- func TreeNodeToLabelSpacing() float32
- func TreeNodeV(label string, flags int) bool
- func TreePop()
- func Unindent()
- func UnindentV(indentW float32)
- func VSliderFloat(label string, size Vec2, value *float32, min, max float32) bool
- func VSliderFloatV(label string, size Vec2, value *float32, min, max float32, format string, ...) bool
- func VSliderInt(label string, size Vec2, value *int32, min, max int32) bool
- func VSliderIntV(label string, size Vec2, value *int32, min, max int32, format string) bool
- func Version() string
- func VertexBufferLayout() (entrySize int, posOffset int, uvOffset int, colOffset int)
- func WindowContentRegionWidth() float32
- func WindowHeight() float32
- func WindowWidth() float32
- type AllocatedGlyphRanges
- type Alpha8Image
- type AssertHandler
- type AssertionError
- type Clipboard
- type Condition
- type Context
- type DrawCommand
- type DrawData
- type DrawList
- func (list DrawList) AddCircle(center Vec2, radius float32, col PackedColor)
- func (list DrawList) AddCircleFilled(center Vec2, radius float32, col PackedColor)
- func (list DrawList) AddCircleFilledV(center Vec2, radius float32, col PackedColor, numSegments int)
- func (list DrawList) AddCircleV(center Vec2, radius float32, col PackedColor, numSegments int, ...)
- func (list DrawList) AddLine(p1 Vec2, p2 Vec2, col PackedColor)
- func (list DrawList) AddLineV(p1 Vec2, p2 Vec2, col PackedColor, thickness float32)
- func (list DrawList) AddRect(min Vec2, max Vec2, col PackedColor)
- func (list DrawList) AddRectFilled(min Vec2, max Vec2, col PackedColor)
- func (list DrawList) AddRectFilledV(min Vec2, max Vec2, col PackedColor, rounding float32, drawCornerFlags int)
- func (list DrawList) AddRectV(min Vec2, max Vec2, col PackedColor, rounding float32, drawCornerFlags int, ...)
- func (list DrawList) AddTriangle(p1 Vec2, p2 Vec2, p3 Vec2, col PackedColor)
- func (list DrawList) AddTriangleFilled(p1 Vec2, p2 Vec2, p3 Vec2, col PackedColor)
- func (list DrawList) AddTriangleV(p1 Vec2, p2 Vec2, p3 Vec2, col PackedColor, thickness float32)
- func (list DrawList) Commands() []DrawCommand
- func (list DrawList) IndexBuffer() (unsafe.Pointer, int)
- func (list DrawList) VertexBuffer() (unsafe.Pointer, int)
- type Font
- type FontAtlas
- func (atlas FontAtlas) AddFontDefault() Font
- func (atlas FontAtlas) AddFontDefaultV(cfg FontConfig) Font
- func (atlas FontAtlas) AddFontFromFileTTF(filename string, sizePixels float32) Font
- func (atlas FontAtlas) AddFontFromFileTTFV(filename string, sizePixels float32, config FontConfig, glyphRange GlyphRanges) Font
- func (atlas FontAtlas) AddFontFromMemoryTTF(fontData []byte, sizePixels float32) Font
- func (atlas FontAtlas) AddFontFromMemoryTTFV(fontData []byte, sizePixels float32, config FontConfig, glyphRange GlyphRanges) Font
- func (atlas FontAtlas) BuildWithFreeType() error
- func (atlas FontAtlas) BuildWithFreeTypeV(flags int) error
- func (atlas FontAtlas) GlyphRangesChineseFull() GlyphRanges
- func (atlas FontAtlas) GlyphRangesChineseSimplifiedCommon() GlyphRanges
- func (atlas FontAtlas) GlyphRangesCyrillic() GlyphRanges
- func (atlas FontAtlas) GlyphRangesDefault() GlyphRanges
- func (atlas FontAtlas) GlyphRangesJapanese() GlyphRanges
- func (atlas FontAtlas) GlyphRangesKorean() GlyphRanges
- func (atlas FontAtlas) GlyphRangesThai() GlyphRanges
- func (atlas FontAtlas) SetTexDesiredWidth(value int)
- func (atlas FontAtlas) SetTextureID(id TextureID)
- func (atlas FontAtlas) TextureDataAlpha8() *Alpha8Image
- func (atlas FontAtlas) TextureDataRGBA32() *RGBA32Image
- type FontConfig
- func (config *FontConfig) Delete()
- func (config FontConfig) SetGlyphMaxAdvanceX(value float32)
- func (config FontConfig) SetGlyphMinAdvanceX(value float32)
- func (config FontConfig) SetMergeMode(value bool)
- func (config FontConfig) SetName(name string)
- func (config FontConfig) SetOversampleH(value int)
- func (config FontConfig) SetOversampleV(value int)
- func (config FontConfig) SetPixelSnapH(value bool)
- func (config FontConfig) SetSize(sizePixels float32)
- type FreeTypeError
- type GlyphRanges
- type GlyphRangesBuilder
- type IO
- func (io IO) AddInputCharacters(chars string)
- func (io IO) AddMouseWheelDelta(horizontal, vertical float32)
- func (io IO) Fonts() FontAtlas
- func (io IO) Framerate() float32
- func (io IO) KeyAlt(leftAlt int, rightAlt int)
- func (io IO) KeyCtrl(leftCtrl int, rightCtrl int)
- func (io IO) KeyMap(imguiKey int, nativeKey int)
- func (io IO) KeyPress(key int)
- func (io IO) KeyRelease(key int)
- func (io IO) KeyShift(leftShift int, rightShift int)
- func (io IO) KeySuper(leftSuper int, rightSuper int)
- func (io IO) MetricsActiveAllocations() int
- func (io IO) MetricsActiveWindows() int
- func (io IO) MetricsRenderIndices() int
- func (io IO) MetricsRenderVertices() int
- func (io IO) MetricsRenderWindows() int
- func (io IO) MouseDelta() Vec2
- func (io IO) MouseWheel() (float32, float32)
- func (io IO) SetBackendFlags(flags int)
- func (io IO) SetClipboard(board Clipboard)
- func (io IO) SetConfigFlags(flags int)
- func (io IO) SetDeltaTime(value float32)
- func (io IO) SetDisplaySize(value Vec2)
- func (io IO) SetFontGlobalScale(value float32)
- func (io IO) SetIniFilename(value string)
- func (io IO) SetMouseButtonDown(index int, down bool)
- func (io IO) SetMousePosition(value Vec2)
- func (io IO) WantCaptureKeyboard() bool
- func (io IO) WantCaptureMouse() bool
- func (io IO) WantTextInput() bool
- type InputTextCallback
- type InputTextCallbackData
- func (data InputTextCallbackData) Buffer() []byte
- func (data InputTextCallbackData) CursorPos() int
- func (data InputTextCallbackData) DeleteBytes(offset, count int)
- func (data InputTextCallbackData) EventChar() rune
- func (data InputTextCallbackData) EventFlag() int
- func (data InputTextCallbackData) EventKey() int
- func (data InputTextCallbackData) Flags() int
- func (data InputTextCallbackData) InsertBytes(offset int, bytes []byte)
- func (data InputTextCallbackData) MarkBufferModified()
- func (data InputTextCallbackData) SelectionEnd() int
- func (data InputTextCallbackData) SelectionStart() int
- func (data InputTextCallbackData) SetCursorPos(value int)
- func (data InputTextCallbackData) SetEventChar(value rune)
- func (data InputTextCallbackData) SetSelectionEnd(value int)
- func (data InputTextCallbackData) SetSelectionStart(value int)
- type ListClipper
- type PackedColor
- type RGBA32Image
- type Style
- type StyleColorID
- type StyleVarID
- type TextureID
- type Vec2
- func CalcTextSize(text string, hideTextAfterDoubleHash bool, wrapWidth float32) Vec2
- func ContentRegionAvail() Vec2
- func ContentRegionMax() Vec2
- func CursorPos() Vec2
- func CursorScreenPos() Vec2
- func CursorStartPos() Vec2
- func ItemRectMax() Vec2
- func ItemRectMin() Vec2
- func MousePos() Vec2
- func WindowContentRegionMax() Vec2
- func WindowContentRegionMin() Vec2
- func WindowPos() Vec2
- func WindowSize() Vec2
- type Vec4
Constants ¶
const ( // ConditionAlways sets the variable. ConditionAlways Condition = 1 << 0 // ConditionOnce sets the variable once per runtime session (only the first call with succeed). ConditionOnce = 1 << 1 // ConditionFirstUseEver sets the variable if the object/window has no persistently saved data (no entry in .ini file). ConditionFirstUseEver = 1 << 2 // ConditionAppearing sets the variable if the object/window is appearing after being hidden/inactive (or the first time). ConditionAppearing = 1 << 3 )
const ( // DragDropFlagsNone specifies the default behaviour. DragDropFlagsNone = 0 // DragDropFlagsSourceNoPreviewTooltip hides the tooltip that is open so you can display a preview or description of the source contents. DragDropFlagsSourceNoPreviewTooltip = 1 << 0 // DragDropFlagsSourceNoDisableHover preserves the behaviour of IsItemHovered. By default, when dragging we clear data so that IsItemHovered() will return true, to avoid subsequent user code submitting tooltips. DragDropFlagsSourceNoDisableHover = 1 << 1 // DragDropFlagsSourceNoHoldToOpenOthers disables the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item. DragDropFlagsSourceNoHoldToOpenOthers = 1 << 2 // DragDropFlagsSourceAllowNullID allows items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear ecosystem and so we made it explicit. DragDropFlagsSourceAllowNullID = 1 << 3 // DragDropFlagsSourceExtern specifies external source (from outside of), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously. DragDropFlagsSourceExtern = 1 << 4 )
This is a list of BeginDragDropSource flags.
const ( // DragDropFlagsAcceptBeforeDelivery makes AcceptDragDropPayload() return true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered. DragDropFlagsAcceptBeforeDelivery = 1 << 10 // DragDropFlagsAcceptNoDrawDefaultRect does not draw the default highlight rectangle when hovering over target. DragDropFlagsAcceptNoDrawDefaultRect = 1 << 11 // DragDropFlagsAcceptPeekOnly is for peeking ahead and inspecting the payload before delivery. DragDropFlagsAcceptPeekOnly = DragDropFlagsAcceptBeforeDelivery | DragDropFlagsAcceptNoDrawDefaultRect )
This is a list of AcceptDragDropPayload flags.
const ( DrawCornerFlagsNone = 0x0 DrawCornerFlagsTopLeft = 0x1 DrawCornerFlagsTopRight = 0x2 DrawCornerFlagsBotLeft = 0x4 DrawCornerFlagsBotRight = 0x8 DrawCornerFlagsTop = DrawCornerFlagsTopLeft | DrawCornerFlagsTopRight DrawCornerFlagsBot = DrawCornerFlagsBotLeft | DrawCornerFlagsBotRight DrawCornerFlagsLeft = DrawCornerFlagsTopLeft | DrawCornerFlagsBotLeft DrawCornerFlagsRight = DrawCornerFlagsTopRight | DrawCornerFlagsBotRight DrawCornerFlagsAll = 0xF )
This is a list of DrawCornerFlags.
const ( // ErrFreeTypeNotAvailable is used if the implementation of freetype is not available in this build. ErrFreeTypeNotAvailable = FreeTypeError("Not available for this build") // ErrFreeTypeFailed is used if building a font atlas was not possible. ErrFreeTypeFailed = FreeTypeError("Failed to build FontAtlas with FreeType") )
const ( // FreeTypeRasterizerFlagsNoHinting disables hinting. // This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes. FreeTypeRasterizerFlagsNoHinting = 1 << 0 // FreeTypeRasterizerFlagsNoAutoHint disables auto-hinter. FreeTypeRasterizerFlagsNoAutoHint = 1 << 1 // FreeTypeRasterizerFlagsForceAutoHint indicates that the auto-hinter is preferred over the font's native hinter. FreeTypeRasterizerFlagsForceAutoHint = 1 << 2 // FreeTypeRasterizerFlagsLightHinting is a lighter hinting algorithm for gray-level modes. // Many generated glyphs are fuzzier but better resemble their original shape. // This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), // as is done by Microsoft's ClearType and Adobe's proprietary font renderer. // This preserves inter-glyph spacing in horizontal text. FreeTypeRasterizerFlagsLightHinting = 1 << 3 // FreeTypeRasterizerFlagsMonoHinting is a strong hinting algorithm that should only be used for monochrome output. FreeTypeRasterizerFlagsMonoHinting = 1 << 4 // FreeTypeRasterizerFlagsBold is for styling: Should we artificially embolden the font? FreeTypeRasterizerFlagsBold = 1 << 5 // FreeTypeRasterizerFlagsOblique is for styling: Should we slant the font, emulating italic style? FreeTypeRasterizerFlagsOblique = 1 << 6 // FreeTypeRasterizerFlagsMonochrome disables anti-aliasing. Combine this with MonoHinting for best results! FreeTypeRasterizerFlagsMonochrome = 1 << 7 )
Flags for FreeType rasterizer. By default, hinting is enabled and the font's native hinter is preferred over the auto-hinter.
const ( KeyTab = 0 KeyLeftArrow = 1 KeyRightArrow = 2 KeyUpArrow = 3 KeyDownArrow = 4 KeyPageUp = 5 KeyPageDown = 6 KeyHome = 7 KeyEnd = 8 KeyInsert = 9 KeyDelete = 10 KeyBackspace = 11 KeySpace = 12 KeyEnter = 13 KeyEscape = 14 KeyKeyPadEnter = 15 KeyA = 16 // for text edit CTRL+A: select all KeyC = 17 // for text edit CTRL+C: copy KeyV = 18 // for text edit CTRL+V: paste KeyX = 19 // for text edit CTRL+X: cut KeyY = 20 // for text edit CTRL+Y: redo KeyZ = 21 // for text edit CTRL+Z: undo )
Constants to fill IO.KeyMap() lookup with indices into the IO.KeysDown[512] array. The mapped indices are then the ones reported to IO.KeyPress() and IO.KeyRelease().
const ( // ConfigFlagNone default = 0 ConfigFlagNone = 0 // io.NavInputs[] based on io.KeysDown[]. ConfigFlagNavEnableKeyboard = 1 << 0 // This is mostly to instruct your imgui back-end to fill io.NavInputs[]. Back-end also needs to set // BackendFlagHasGamepad. ConfigFlagNavEnableGamepad = 1 << 1 // where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you // MUST honor io.WantSetMousePos requests in your binding, otherwise ImGui will react as if the mouse is jumping // around back and forth. ConfigFlagNavEnableSetMousePos = 1 << 2 // is set. ConfigFlagNavNoCaptureKeyboard = 1 << 3 // ConfigFlagNoMouse instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse // information set by the back-end. ConfigFlagNoMouse = 1 << 4 // ConfigFlagNoMouseCursorChange instruct back-end to not alter mouse cursor shape and visibility. Use if the // back-end cursor changes are interfering with yours and you don't want to use SetMouseCursor() to change mouse // cursor. You may want to honor requests from imgui by reading GetMouseCursor() yourself instead. ConfigFlagNoMouseCursorChange = 1 << 5 // ConfigFlagIsSRGB application is SRGB-aware. ConfigFlagIsSRGB = 1 << 20 // ConfigFlagIsTouchScreen application is using a touch screen instead of a mouse. ConfigFlagIsTouchScreen = 1 << 21 )
const ( // BackendFlagNone default = 0 BackendFlagNone = 0 // BackendFlagHasGamepad back-end Platform supports gamepad and currently has one connected. BackendFlagHasGamepad = 1 << 0 // BackendFlagHasMouseCursors back-end Platform supports honoring GetMouseCursor() value to change the OS cursor // shape. BackendFlagHasMouseCursors = 1 << 1 // BackendFlagHasSetMousePos back-end Platform supports io.WantSetMousePos requests to reposition the OS mouse // position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set). BackendFlagHasSetMousePos = 1 << 2 // BackendFlagsRendererHasVtxOffset back-end Renderer supports ImDrawCmd::VtxOffset. This enables output of large // meshes (64K+ vertices) while still using 16-bits indices. BackendFlagsRendererHasVtxOffset = 1 << 3 )
const ( // FocusedFlagsNone Return true if directly over the item/window, not obstructed by another window, // not obstructed by an active popup or modal blocking inputs under them. FocusedFlagsNone = 0 // FocusedFlagsChildWindows returns true if any children of the window is focused FocusedFlagsChildWindows = 1 << 0 // FocusedFlagsRootWindow tests from root window (top most parent of the current hierarchy) FocusedFlagsRootWindow = 1 << 1 // FocusedFlagsAnyWindow returns true if any window is focused. // Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. // Use WantCaptureMouse instead. FocusedFlagsAnyWindow = 1 << 2 FocusedFlagsRootAndChildWindows = FocusedFlagsRootWindow | FocusedFlagsChildWindows )
This is a list of FocusedFlags combinations.
const ( // HoveredFlagsNone Return true if directly over the item/window, not obstructed by another window, // not obstructed by an active popup or modal blocking inputs under them. HoveredFlagsNone = 0 // HoveredFlagsChildWindows IsWindowHovered() only: Return true if any children of the window is hovered. HoveredFlagsChildWindows = 1 << 0 // HoveredFlagsRootWindow IsWindowHovered() only: Test from root window (top most parent of the current hierarchy). HoveredFlagsRootWindow = 1 << 1 // HoveredFlagsAnyWindow IsWindowHovered() only: Return true if any window is hovered. HoveredFlagsAnyWindow = 1 << 2 // HoveredFlagsAllowWhenBlockedByPopup Return true even if a popup window is normally blocking access to this item/window. HoveredFlagsAllowWhenBlockedByPopup = 1 << 3 // HoveredFlagsAllowWhenBlockedByActiveItem Return true even if an active item is blocking access to this item/window. // Useful for Drag and Drop patterns. HoveredFlagsAllowWhenBlockedByActiveItem = 1 << 5 // HoveredFlagsAllowWhenOverlapped Return true even if the position is overlapped by another window HoveredFlagsAllowWhenOverlapped = 1 << 6 // HoveredFlagsAllowWhenDisabled Return true even if the item is disabled HoveredFlagsAllowWhenDisabled = 1 << 7 HoveredFlagsRectOnly = HoveredFlagsAllowWhenBlockedByPopup | HoveredFlagsAllowWhenBlockedByActiveItem | HoveredFlagsAllowWhenOverlapped HoveredFlagsRootAndChildWindows = HoveredFlagsRootWindow | HoveredFlagsChildWindows )
This is a list of HoveredFlags combinations.
const ( // MouseCursorNone no mouse cursor MouseCursorNone = -1 // MouseCursorArrow standard arrow mouse cursor MouseCursorArrow = 0 // MouseCursorTextInput when hovering over InputText, etc. MouseCursorTextInput = 1 // MouseCursorResizeAll (Unused by imgui functions) MouseCursorResizeAll = 2 // MouseCursorResizeNS when hovering over an horizontal border MouseCursorResizeNS = 3 // MouseCursorResizeEW when hovering over a vertical border or a column MouseCursorResizeEW = 4 // MouseCursorResizeNESW when hovering over the bottom-left corner of a window MouseCursorResizeNESW = 5 // MouseCursorResizeNWSE when hovering over the bottom-right corner of a window MouseCursorResizeNWSE = 6 // MouseCursorHand (Unused by imgui functions. Use for e.g. hyperlinks) MouseCursorHand = 7 MouseCursorCount = 8 )
Enumeration for MouseCursor() User code may request binding to display given cursor by calling SetMouseCursor(), which is why we have some cursors that are marked unused here.
const ( // ComboFlagNone default = 0 ComboFlagNone = 0 // ComboFlagPopupAlignLeft aligns the popup toward the left by default. ComboFlagPopupAlignLeft = 1 << 0 // ComboFlagHeightSmall has max ~4 items visible. // Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo(). ComboFlagHeightSmall = 1 << 1 // ComboFlagHeightRegular has max ~8 items visible (default). ComboFlagHeightRegular = 1 << 2 // ComboFlagHeightLarge has max ~20 items visible. ComboFlagHeightLarge = 1 << 3 // ComboFlagHeightLargest has as many fitting items as possible. ComboFlagHeightLargest = 1 << 4 // ComboFlagNoArrowButton displays on the preview box without the square arrow button. ComboFlagNoArrowButton = 1 << 5 // ComboFlagNoPreview displays only a square arrow button. ComboFlagNoPreview = 1 << 6 )
const ( // InputTextFlagsNone sets everything default. InputTextFlagsNone = 0 // InputTextFlagsCharsDecimal allows 0123456789.+- InputTextFlagsCharsDecimal = 1 << 0 // InputTextFlagsCharsHexadecimal allow 0123456789ABCDEFabcdef InputTextFlagsCharsHexadecimal = 1 << 1 // InputTextFlagsCharsUppercase turns a..z into A..Z. InputTextFlagsCharsUppercase = 1 << 2 // InputTextFlagsCharsNoBlank filters out spaces, tabs. InputTextFlagsCharsNoBlank = 1 << 3 // InputTextFlagsAutoSelectAll selects entire text when first taking mouse focus. InputTextFlagsAutoSelectAll = 1 << 4 // InputTextFlagsEnterReturnsTrue returns 'true' when Enter is pressed (as opposed to when the value was modified). InputTextFlagsEnterReturnsTrue = 1 << 5 // InputTextFlagsCallbackCompletion for callback on pressing TAB (for completion handling). InputTextFlagsCallbackCompletion = 1 << 6 // InputTextFlagsCallbackHistory for callback on pressing Up/Down arrows (for history handling). InputTextFlagsCallbackHistory = 1 << 7 // InputTextFlagsCallbackAlways for callback on each iteration. User code may query cursor position, modify text buffer. InputTextFlagsCallbackAlways = 1 << 8 // InputTextFlagsCallbackCharFilter for callback on character inputs to replace or discard them. // Modify 'EventChar' to replace or discard, or return 1 in callback to discard. InputTextFlagsCallbackCharFilter = 1 << 9 // InputTextFlagsAllowTabInput when pressing TAB to input a '\t' character into the text field. InputTextFlagsAllowTabInput = 1 << 10 // InputTextFlagsCtrlEnterForNewLine in multi-line mode, unfocus with Enter, add new line with Ctrl+Enter // (default is opposite: unfocus with Ctrl+Enter, add line with Enter). InputTextFlagsCtrlEnterForNewLine = 1 << 11 // InputTextFlagsNoHorizontalScroll disables following the cursor horizontally. InputTextFlagsNoHorizontalScroll = 1 << 12 // InputTextFlagsAlwaysInsertMode sets insert mode. InputTextFlagsAlwaysInsertMode = 1 << 13 // InputTextFlagsReadOnly sets read-only mode. InputTextFlagsReadOnly = 1 << 14 // InputTextFlagsPassword sets password mode, display all characters as '*'. InputTextFlagsPassword = 1 << 15 // InputTextFlagsNoUndoRedo disables undo/redo. Note that input text owns the text data while active, // if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID(). InputTextFlagsNoUndoRedo = 1 << 16 // InputTextFlagsCharsScientific allows 0123456789.+-*/eE (Scientific notation input). InputTextFlagsCharsScientific = 1 << 17 )
const ( // ColorEditFlagsNone default = 0 ColorEditFlagsNone = 0 // ColorEditFlagsNoAlpha ignores Alpha component (read 3 components from the input pointer). ColorEditFlagsNoAlpha = 1 << 1 // ColorEditFlagsNoPicker disables picker when clicking on colored square. ColorEditFlagsNoPicker = 1 << 2 // ColorEditFlagsNoOptions disables toggling options menu when right-clicking on inputs/small preview. ColorEditFlagsNoOptions = 1 << 3 // ColorEditFlagsNoSmallPreview disables colored square preview next to the inputs. (e.g. to show only the inputs) ColorEditFlagsNoSmallPreview = 1 << 4 // ColorEditFlagsNoInputs disables inputs sliders/text widgets (e.g. to show only the small preview colored square). ColorEditFlagsNoInputs = 1 << 5 // ColorEditFlagsNoTooltip disables tooltip when hovering the preview. ColorEditFlagsNoTooltip = 1 << 6 // ColorEditFlagsNoLabel disables display of inline text label (the label is still forwarded to the tooltip and picker). ColorEditFlagsNoLabel = 1 << 7 // ColorEditFlagsNoSidePreview disables bigger color preview on right side of the picker, use small colored square preview instead. ColorEditFlagsNoSidePreview = 1 << 8 // ColorEditFlagsNoDragDrop disables drag and drop target. ColorButton: disable drag and drop source. ColorEditFlagsNoDragDrop = 1 << 9 // ColorEditFlagsNoBorder disables border (which is enforced by default) ColorEditFlagsNoBorder = 1 << 10 // ColorEditFlagsAlphaBar shows vertical alpha bar/gradient in picker. ColorEditFlagsAlphaBar = 1 << 16 // ColorEditFlagsAlphaPreview displays preview as a transparent color over a checkerboard, instead of opaque. ColorEditFlagsAlphaPreview = 1 << 17 // ColorEditFlagsAlphaPreviewHalf displays half opaque / half checkerboard, instead of opaque. ColorEditFlagsAlphaPreviewHalf = 1 << 18 // ColorEditFlagsHDR = (WIP) surrently only disable 0.0f..1.0f limits in RGBA edition. // Note: you probably want to use ImGuiColorEditFlags_Float flag as well. ColorEditFlagsHDR = 1 << 19 // ColorEditFlagsRGB sets the format as RGB ColorEditFlagsRGB = 1 << 20 // ColorEditFlagsHSV sets the format as HSV ColorEditFlagsHSV = 1 << 21 // ColorEditFlagsHEX sets the format as HEX ColorEditFlagsHEX = 1 << 22 // ColorEditFlagsUint8 _display_ values formatted as 0..255. ColorEditFlagsUint8 = 1 << 23 // ColorEditFlagsFloat _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. ColorEditFlagsFloat = 1 << 24 // ColorEditFlagsPickerHueBar shows bar for Hue, rectangle for Sat/Value. ColorEditFlagsPickerHueBar = 1 << 25 // ColorEditFlagsPickerHueWheel shows wheel for Hue, triangle for Sat/Value. ColorEditFlagsPickerHueWheel = 1 << 26 // ColorEditFlagsInputRGB enables input and output data in RGB format. ColorEditFlagsInputRGB = 1 << 27 // ColorEditFlagsInputHSV enables input and output data in HSV format. ColorEditFlagsInputHSV = 1 << 28 )
const ( // ColorPickerFlagsNone default = 0 ColorPickerFlagsNone = 0 // ColorPickerFlagsNoPicker disables picker when clicking on colored square. ColorPickerFlagsNoPicker = 1 << 2 // ColorPickerFlagsNoOptions disables toggling options menu when right-clicking on inputs/small preview. ColorPickerFlagsNoOptions = 1 << 3 // ColorPickerFlagsNoAlpha ignoreс Alpha component (read 3 components from the input pointer). ColorPickerFlagsNoAlpha = 1 << 1 // ColorPickerFlagsNoSmallPreview disables colored square preview next to the inputs. (e.g. to show only the inputs) ColorPickerFlagsNoSmallPreview = 1 << 4 // ColorPickerFlagsNoInputs disables inputs sliders/text widgets (e.g. to show only the small preview colored square). ColorPickerFlagsNoInputs = 1 << 5 // ColorPickerFlagsNoTooltip disables tooltip when hovering the preview. ColorPickerFlagsNoTooltip = 1 << 6 // ColorPickerFlagsNoLabel disables display of inline text label (the label is still forwarded to the tooltip and picker). ColorPickerFlagsNoLabel = 1 << 7 // ColorPickerFlagsNoSidePreview disables bigger color preview on right side of the picker, use small colored square preview instead. ColorPickerFlagsNoSidePreview = 1 << 8 // ColorPickerFlagsAlphaBar shows vertical alpha bar/gradient in picker. ColorPickerFlagsAlphaBar = 1 << 16 // ColorPickerFlagsAlphaPreview displays preview as a transparent color over a checkerboard, instead of opaque. ColorPickerFlagsAlphaPreview = 1 << 17 // ColorPickerFlagsAlphaPreviewHalf displays half opaque / half checkerboard, instead of opaque. ColorPickerFlagsAlphaPreviewHalf = 1 << 18 // ColorPickerFlagsRGB sets the format as RGB ColorPickerFlagsRGB = 1 << 20 // ColorPickerFlagsHSV sets the format as HSV ColorPickerFlagsHSV = 1 << 21 // ColorPickerFlagsHEX sets the format as HEX ColorPickerFlagsHEX = 1 << 22 // ColorPickerFlagsUint8 _display_ values formatted as 0..255. ColorPickerFlagsUint8 = 1 << 23 // ColorPickerFlagsFloat _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. ColorPickerFlagsFloat = 1 << 24 // ColorPickerFlagsPickerHueBar bar for Hue, rectangle for Sat/Value. ColorPickerFlagsPickerHueBar = 1 << 25 // ColorPickerFlagsPickerHueWheel wheel for Hue, triangle for Sat/Value. ColorPickerFlagsPickerHueWheel = 1 << 26 // ColorPickerFlagsInputRGB enables input and output data in RGB format. ColorPickerFlagsInputRGB = 1 << 27 // ColorPickerFlagsInputHSV enables input and output data in HSV format. ColorPickerFlagsInputHSV = 1 << 28 )
const ( // TreeNodeFlagsNone default = 0 TreeNodeFlagsNone = 0 // TreeNodeFlagsSelected draws as selected. TreeNodeFlagsSelected = 1 << 0 // TreeNodeFlagsFramed draws full colored frame (e.g. for CollapsingHeader). TreeNodeFlagsFramed = 1 << 1 // TreeNodeFlagsAllowItemOverlap hit testing to allow subsequent widgets to overlap this one. TreeNodeFlagsAllowItemOverlap = 1 << 2 // TreeNodeFlagsNoTreePushOnOpen doesn't do a TreePush() when open // (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack. TreeNodeFlagsNoTreePushOnOpen = 1 << 3 // TreeNodeFlagsNoAutoOpenOnLog doesn't automatically and temporarily open node when Logging is active // (by default logging will automatically open tree nodes). TreeNodeFlagsNoAutoOpenOnLog = 1 << 4 // TreeNodeFlagsDefaultOpen defaults node to be open. TreeNodeFlagsDefaultOpen = 1 << 5 // TreeNodeFlagsOpenOnDoubleClick needs double-click to open node. TreeNodeFlagsOpenOnDoubleClick = 1 << 6 // TreeNodeFlagsOpenOnArrow opens only when clicking on the arrow part. // If TreeNodeFlagsOpenOnDoubleClick is also set, single-click arrow or double-click all box to open. TreeNodeFlagsOpenOnArrow = 1 << 7 // TreeNodeFlagsLeaf allows no collapsing, no arrow (use as a convenience for leaf nodes). TreeNodeFlagsLeaf = 1 << 8 // TreeNodeFlagsBullet displays a bullet instead of an arrow. TreeNodeFlagsBullet = 1 << 9 // TreeNodeFlagsFramePadding uses FramePadding (even for an unframed text node) to // vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding(). TreeNodeFlagsFramePadding = 1 << 10 // TreeNodeFlagsSpanAvailWidth extends hit box to the right-most edge, even if not framed. // This is not the default in order to allow adding other items on the same line. // In the future we may refactor the hit system to be front-to-back, allowing natural overlaps // and then this can become the default. TreeNodeFlagsSpanAvailWidth = 1 << 11 // TreeNodeFlagsSpanFullWidth extends hit box to the left-most and right-most edges (bypass the indented area). TreeNodeFlagsSpanFullWidth = 1 << 12 // (items submitted between TreeNode and TreePop) TreeNodeFlagsNavLeftJumpsBackHere = 1 << 13 // TreeNodeFlagsCollapsingHeader combines TreeNodeFlagsFramed and TreeNodeFlagsNoAutoOpenOnLog. TreeNodeFlagsCollapsingHeader = TreeNodeFlagsFramed | TreeNodeFlagsNoTreePushOnOpen | TreeNodeFlagsNoAutoOpenOnLog )
const ( // SelectableFlagsNone default = 0 SelectableFlagsNone = 0 // SelectableFlagsDontClosePopups makes clicking the selectable not close any parent popup windows. SelectableFlagsDontClosePopups = 1 << 0 // SelectableFlagsSpanAllColumns allows the selectable frame to span all columns (text will still fit in current column). SelectableFlagsSpanAllColumns = 1 << 1 // SelectableFlagsAllowDoubleClick generates press events on double clicks too. SelectableFlagsAllowDoubleClick = 1 << 2 // SelectableFlagsDisabled disallows selection and displays text in a greyed out color. SelectableFlagsDisabled = 1 << 3 )
const ( // TabBarFlagsNone default = 0. TabBarFlagsNone = 0 // TabBarFlagsReorderable Allow manually dragging tabs to re-order them + New tabs are appended at the end of list TabBarFlagsReorderable = 1 << 0 // TabBarFlagsAutoSelectNewTabs Automatically select new tabs when they appear TabBarFlagsAutoSelectNewTabs = 1 << 1 // TabBarFlagsTabListPopupButton Disable buttons to open the tab list popup TabBarFlagsTabListPopupButton = 1 << 2 // TabBarFlagsNoCloseWithMiddleMouseButton Disable behavior of closing tabs (that are submitted with p_open != NULL) // with middle mouse button. You can still repro this behavior on user's side with if // (IsItemHovered() && IsMouseClicked(2)) *p_open = false. TabBarFlagsNoCloseWithMiddleMouseButton = 1 << 3 // TabBarFlagsNoTabListScrollingButtons Disable scrolling buttons (apply when fitting policy is // TabBarFlagsFittingPolicyScroll) TabBarFlagsNoTabListScrollingButtons = 1 << 4 // TabBarFlagsNoTooltip Disable tooltips when hovering a tab TabBarFlagsNoTooltip = 1 << 5 // TabBarFlagsFittingPolicyResizeDown Resize tabs when they don't fit TabBarFlagsFittingPolicyResizeDown = 1 << 6 // TabBarFlagsFittingPolicyScroll Add scroll buttons when tabs don't fit TabBarFlagsFittingPolicyScroll = 1 << 7 // TabBarFlagsFittingPolicyMask combines // TabBarFlagsFittingPolicyResizeDown and TabBarFlagsFittingPolicyScroll TabBarFlagsFittingPolicyMask = TabBarFlagsFittingPolicyResizeDown | TabBarFlagsFittingPolicyScroll // TabBarFlagsFittingPolicyDefault alias for TabBarFlagsFittingPolicyResizeDown TabBarFlagsFittingPolicyDefault = TabBarFlagsFittingPolicyResizeDown )
const ( // TabItemFlagsNone default = 0 TabItemFlagsNone = 0 // TabItemFlagsUnsavedDocument Append '*' to title without affecting the ID, as a convenience to avoid using the // ### operator. Also: tab is selected on closure and closure is deferred by one frame to allow code to undo it // without flicker. TabItemFlagsUnsavedDocument = 1 << 0 // TabItemFlagsSetSelected Trigger flag to programmatically make the tab selected when calling BeginTabItem() TabItemFlagsSetSelected = 1 << 1 // TabItemFlagsNoCloseWithMiddleMouseButton Disable behavior of closing tabs (that are submitted with // p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if // (IsItemHovered() && IsMouseClicked(2)) *p_open = false. TabItemFlagsNoCloseWithMiddleMouseButton = 1 << 2 // TabItemFlagsNoPushID Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem() TabItemFlagsNoPushID = 1 << 3 )
const ( // WindowFlagsNone default = 0 WindowFlagsNone = 0 // WindowFlagsNoTitleBar disables title-bar. WindowFlagsNoTitleBar = 1 << 0 // WindowFlagsNoResize disables user resizing with the lower-right grip. WindowFlagsNoResize = 1 << 1 // WindowFlagsNoMove disables user moving the window. WindowFlagsNoMove = 1 << 2 // WindowFlagsNoScrollbar disables scrollbars. Window can still scroll with mouse or programmatically. WindowFlagsNoScrollbar = 1 << 3 // WindowFlagsNoScrollWithMouse disables user vertically scrolling with mouse wheel. On child window, mouse wheel // will be forwarded to the parent unless NoScrollbar is also set. WindowFlagsNoScrollWithMouse = 1 << 4 // WindowFlagsNoCollapse disables user collapsing window by double-clicking on it. WindowFlagsNoCollapse = 1 << 5 // WindowFlagsAlwaysAutoResize resizes every window to its content every frame. WindowFlagsAlwaysAutoResize = 1 << 6 // WindowFlagsNoBackground disables drawing background color (WindowBg, etc.) and outside border. Similar as using // SetNextWindowBgAlpha(0.0f). WindowFlagsNoBackground = 1 << 7 // WindowFlagsNoSavedSettings will never load/save settings in .ini file. WindowFlagsNoSavedSettings = 1 << 8 // WindowFlagsNoMouseInputs disables catching mouse, hovering test with pass through. WindowFlagsNoMouseInputs = 1 << 9 // WindowFlagsMenuBar has a menu-bar. WindowFlagsMenuBar = 1 << 10 // WindowFlagsHorizontalScrollbar allows horizontal scrollbar to appear (off by default). You may use // SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo // in the "Horizontal Scrolling" section. WindowFlagsHorizontalScrollbar = 1 << 11 // WindowFlagsNoFocusOnAppearing disables taking focus when transitioning from hidden to visible state. WindowFlagsNoFocusOnAppearing = 1 << 12 // WindowFlagsNoBringToFrontOnFocus disables bringing window to front when taking focus. e.g. clicking on it or // programmatically giving it focus. WindowFlagsNoBringToFrontOnFocus = 1 << 13 // WindowFlagsAlwaysVerticalScrollbar always shows vertical scrollbar, even if ContentSize.y < Size.y . WindowFlagsAlwaysVerticalScrollbar = 1 << 14 // WindowFlagsAlwaysHorizontalScrollbar always shows horizontal scrollbar, even if ContentSize.x < Size.x . WindowFlagsAlwaysHorizontalScrollbar = 1 << 15 // WindowFlagsAlwaysUseWindowPadding ensures child windows without border uses style.WindowPadding (ignored by // default for non-bordered child windows, because more convenient). WindowFlagsAlwaysUseWindowPadding = 1 << 16 WindowFlagsNoNavInputs = 1 << 18 // (e.g. skipped by CTRL+TAB) WindowFlagsNoNavFocus = 1 << 19 // WindowFlagsUnsavedDocument appends '*' to title without affecting the ID, as a convenience to avoid using the // ### operator. When used in a tab/docking context, tab is selected on closure and closure is deferred by one // frame to allow code to cancel the closure (with a confirmation popup, etc.) without flicker. WindowFlagsUnsavedDocument = 1 << 20 WindowFlagsNoNav = WindowFlagsNoNavInputs | WindowFlagsNoNavFocus // WindowFlagsNoDecoration combines WindowFlagsNoTitleBar, WindowFlagsNoResize, WindowFlagsNoScrollbar and // WindowFlagsNoCollapse. WindowFlagsNoDecoration = WindowFlagsNoTitleBar | WindowFlagsNoResize | WindowFlagsNoScrollbar | WindowFlagsNoCollapse // WindowFlagsNoInputs combines WindowFlagsNoMouseInputs, WindowFlagsNoNavInputs and WindowFlagsNoNavFocus. WindowFlagsNoInputs = WindowFlagsNoMouseInputs | WindowFlagsNoNavInputs | WindowFlagsNoNavFocus )
Variables ¶
var ErrContextDestroyed = errors.New("context is destroyed")
ErrContextDestroyed is returned when trying to use an already destroyed context.
var ErrNoContext = errors.New("no current context")
ErrNoContext is used when no context is current.
var PackedColorModel = color.ModelFunc(func(in color.Color) color.Color { return Packed(in) })
PackedColorModel converts colors to PackedColor instances.
Functions ¶
func AcceptDragDropPayload ¶ added in v2.3.0
AcceptDragDropPayload accepts contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.
func AlignTextToFramePadding ¶
func AlignTextToFramePadding()
AlignTextToFramePadding vertically aligns upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items. Call if you have text on a line before a framed item.
func BeginChild ¶
BeginChild calls BeginChildV(id, Vec2{0,0}, false, 0).
func BeginChildV ¶
BeginChildV pushes a new child to the stack and starts appending to it. flags are the WindowFlags to apply.
func BeginCombo ¶
BeginCombo calls BeginComboV(label, previewValue, 0).
func BeginComboV ¶
BeginComboV creates a combo box with complete control over the content to the user. Call EndCombo() if this function returns true. flags are the ComboFlags to apply.
func BeginDragDropSource ¶ added in v2.3.0
BeginDragDropSource registers the currently active item as drag'n'drop source. When this returns true you need to: a) call SetDragDropPayload() exactly once, b) you may render the payload visual/description, c) call EndDragDropSource().
func BeginDragDropTarget ¶ added in v2.3.0
func BeginDragDropTarget() bool
BeginDragDropTarget must be called after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() and EndDragDropTarget().
func BeginGroup ¶
func BeginGroup()
BeginGroup locks horizontal starting position + capture group bounding box into one "item"; So you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.
func BeginMainMenuBar ¶
func BeginMainMenuBar() bool
BeginMainMenuBar creates and appends to a full screen menu-bar. If the return value is true, then EndMainMenuBar() must be called!
func BeginMenuBar ¶
func BeginMenuBar() bool
BeginMenuBar appends to menu-bar of current window. This requires WindowFlagsMenuBar flag set on parent window. If the return value is true, then EndMenuBar() must be called!
func BeginMenuV ¶
BeginMenuV creates a sub-menu entry. If the return value is true, then EndMenu() must be called!
func BeginPopup ¶ added in v2.3.0
BeginPopup calls BeginPopupV(name, nil, 0).
func BeginPopupContextItem ¶
func BeginPopupContextItem() bool
BeginPopupContextItem calls BeginPopupContextItemV("", 1).
func BeginPopupContextItemV ¶
BeginPopupContextItemV returns true if the identified mouse button was pressed while hovering over the last item.
func BeginPopupModal ¶
BeginPopupModal calls BeginPopupModalV(name, nil, 0).
func BeginPopupModalV ¶
BeginPopupModalV creates modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside).
func BeginPopupV ¶ added in v2.3.0
BeginPopupV returns true if the popup is open, and you can start outputting to it. Only call EndPopup() if BeginPopup() returns true.
func BeginTabBarV ¶
BeginTabBarV create and append into a TabBar.
func BeginTabItem ¶
BeginTabItem calls BeginTabItemV(label, nil, 0).
func BeginTabItemV ¶
BeginTabItemV create a Tab. Returns true if the Tab is selected.
func BeginTooltip ¶
func BeginTooltip()
BeginTooltip begins/appends to a tooltip window. Used to create full-featured tooltip (with any kind of contents). Requires a call to EndTooltip().
func BeginV ¶
BeginV pushes a new window to the stack and start appending to it. You may append multiple times to the same window during the same frame. If the open argument is provided, the window can be closed, in which case the value will be false after the call.
Returns false if the window is currently not visible. Regardless of the return value, End() must be called for each call to Begin().
func Bullet ¶ added in v2.4.0
func Bullet()
Bullet draws a small circle and keeps the cursor on the same line. Advance cursor x position by TreeNodeToLabelSpacing(), same distance that TreeNode() uses.
func CalcItemWidth ¶
func CalcItemWidth() float32
CalcItemWidth returns the width of items given pushed settings and current cursor position.
func Checkbox ¶
Checkbox creates a checkbox in the selected state. The return value indicates if the selected state has changed.
func ClearActiveID ¶ added in v2.7.0
func ClearActiveID()
ClearActiveID removes focus from a currently item in edit mode. An application that handles its own undo/redo stack needs to call this function before changing the data a widget might currently own, such as a TextEdit().
func CloseCurrentPopup ¶
func CloseCurrentPopup()
CloseCurrentPopup closes the popup we have begin-ed into. Clicking on a MenuItem or Selectable automatically close the current popup.
func CollapsingHeader ¶ added in v2.3.0
CollapsingHeader adds a collapsing header.
func ColorEdit3 ¶ added in v2.1.0
ColorEdit3 calls ColorEdit3V(label, col, 0).
func ColorEdit3V ¶ added in v2.1.0
ColorEdit3V will show a clickable little square which will open a color picker window for 3D vector (rgb format).
func ColorEdit4 ¶ added in v2.1.0
ColorEdit4 calls ColorEdit4V(label, col, 0).
func ColorEdit4V ¶ added in v2.1.0
ColorEdit4V will show a clickable little square which will open a color picker window for 4D vector (rgba format).
func ColorPicker3 ¶ added in v2.1.0
ColorPicker3 calls ColorPicker3V(label, col, 0).
func ColorPicker3V ¶ added in v2.1.0
ColorPicker3V will show directly a color picker control for editing a color in 3D vector (rgb format).
func ColorPicker4 ¶ added in v2.1.0
ColorPicker4 calls ColorPicker4V(label, col, 0).
func ColorPicker4V ¶ added in v2.1.0
ColorPicker4V will show directly a color picker control for editing a color in 4D vector (rgba format).
func ColumnOffsetV ¶
ColumnOffsetV get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetColumnsCount() inclusive. column 0 is typically 0.0.
func ColumnWidthV ¶
ColumnWidthV get column width (in pixels). pass -1 to use current column.
func ColumnsV ¶
ColumnsV creates a column layout of the specified number of columns. The brittle columns API will be superseded by an upcoming 'table' API.
func CursorPosX ¶
func CursorPosX() float32
CursorPosX returns the x-coordinate of the cursor position in window coordinates.
func CursorPosY ¶
func CursorPosY() float32
CursorPosY returns the y-coordinate of the cursor position in window coordinates.
func DragFloatV ¶
func DragFloatV(label string, value *float32, speed, min, max float32, format string, power float32) bool
DragFloatV creates a draggable slider for floats.
func End ¶
func End()
End closes the scope for the previously opened window. Every call to Begin() must be matched with a call to End().
func EndChild ¶
func EndChild()
EndChild closes the scope for the previously opened child. Every call to BeginChild() must be matched with a call to EndChild().
func EndDragDropSource ¶ added in v2.3.0
func EndDragDropSource()
EndDragDropSource closes the scope for current draw and drop source. Only call EndDragDropSource() if BeginDragDropSource() returns true.
func EndDragDropTarget ¶ added in v2.3.0
func EndDragDropTarget()
EndDragDropTarget closed the scope for current drag and drop target. Only call EndDragDropTarget() if BeginDragDropTarget() returns true.
func EndFrame ¶
func EndFrame()
EndFrame ends the ImGui frame. Automatically called by Render(), so most likely don't need to ever call that yourself directly. If you don't need to render you may call EndFrame() but you'll have wasted CPU already. If you don't need to render, better to not create any imgui windows instead!
func EndMainMenuBar ¶
func EndMainMenuBar()
EndMainMenuBar finishes a main menu bar. Only call EndMainMenuBar() if BeginMainMenuBar() returns true!
func EndMenu ¶
func EndMenu()
EndMenu finishes a sub-menu entry. Only call EndMenu() if BeginMenu() returns true!
func EndMenuBar ¶
func EndMenuBar()
EndMenuBar finishes a menu bar. Only call EndMenuBar() if BeginMenuBar() returns true!
func EndPopup ¶
func EndPopup()
EndPopup finshes a popup. Only call EndPopup() if BeginPopupXXX() returns true!
func EndTabItem ¶
func EndTabItem()
EndTabItem finishes a tab item. Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem().
func FontSize ¶
func FontSize() float32
FontSize returns the current font size (= height in pixels) of the current font with the current scale applied.
func FrameHeight ¶ added in v2.2.0
func FrameHeight() float32
FrameHeight returns the height of the current frame. This is equal to the font size plus the padding at the top and bottom.
func FrameHeightWithSpacing ¶ added in v2.2.0
func FrameHeightWithSpacing() float32
FrameHeightWithSpacing returns the height of the current frame with the item spacing added. This is equal to the font size plus the padding at the top and bottom, plus the value of style.ItemSpacing.y.
func GetScrollMaxX ¶ added in v2.3.0
func GetScrollMaxX() float32
GetScrollMaxX is deprecated and will be removed in v3.0.0 . Deprecated: Use ScrollMaxX() instead.
func GetScrollMaxY ¶ added in v2.3.0
func GetScrollMaxY() float32
GetScrollMaxY is deprecated and will be removed in v3.0.0 . Deprecated: Use ScrollMaxY() instead.
func GetScrollX ¶ added in v2.3.0
func GetScrollX() float32
GetScrollX is deprecated and will be removed in v3.0.0 . Deprecated: Use ScrollX() instead.
func GetScrollY ¶ added in v2.3.0
func GetScrollY() float32
GetScrollY is deprecated and will be removed in v3.0.0 . Deprecated: Use ScrollY() instead.
func ImageButton ¶
ImageButton calls ImageButtonV(id, size, Vec2{0,0}, Vec2{1,1}, -1, Vec4{0,0,0,0}, Vec4{1,1,1,1}).
func ImageButtonV ¶
func ImageButtonV(id TextureID, size Vec2, uv0, uv1 Vec2, framePadding int, bgCol Vec4, tintCol Vec4) bool
ImageButtonV adds a button with an image, based on given texture ID. Refer to TextureID what this represents and how it is drawn. <0 framePadding uses default frame padding settings. 0 for no padding.
func ImageV ¶
ImageV adds an image based on given texture ID. Refer to TextureID what this represents and how it is drawn.
func Indent ¶ added in v2.3.0
func Indent()
Indent moves content position toward the right by style.IndentSpacing.
func IndentV ¶ added in v2.3.0
func IndentV(indentW float32)
IndentV moves content position toward the right, by style.IndentSpacing or indentW if not zero.
func IndexBufferLayout ¶
func IndexBufferLayout() (entrySize int)
IndexBufferLayout returns the byte size necessary to select fields in an index buffer of DrawList.
func InputTextMultiline ¶
InputTextMultiline calls InputTextMultilineV(label, text, Vec2{0,0}, 0, nil).
func InputTextMultilineV ¶
func InputTextMultilineV(label string, text *string, size Vec2, flags int, cb InputTextCallback) bool
InputTextMultilineV provides a field for dynamic text input of multiple lines.
Contrary to the original library, this wrapper does not limit the maximum number of possible characters. Dynamic resizing of the internal buffer is handled within the wrapper and the user will never be called for such requests.
The provided callback is called for any of the requested InputTextFlagsCallback* flags.
To implement a character limit, provide a callback that drops input characters when the requested length has been reached.
func InputTextV ¶
func InputTextV(label string, text *string, flags int, cb InputTextCallback) bool
InputTextV creates a text field for dynamic text input.
Contrary to the original library, this wrapper does not limit the maximum number of possible characters. Dynamic resizing of the internal buffer is handled within the wrapper and the user will never be called for such requests.
The provided callback is called for any of the requested InputTextFlagsCallback* flags.
To implement a character limit, provide a callback that drops input characters when the requested length has been reached.
func InputTextWithHint ¶ added in v2.4.0
InputTextWithHint calls InputTextWithHintV(label, hint, text, 0, nil).
func InputTextWithHintV ¶ added in v2.4.0
func InputTextWithHintV(label string, hint string, text *string, flags int, cb InputTextCallback) bool
InputTextWithHintV creates a text field for dynamic text input with a hint.
Contrary to the original library, this wrapper does not limit the maximum number of possible characters. Dynamic resizing of the internal buffer is handled within the wrapper and the user will never be called for such requests.
The provided callback is called for any of the requested InputTextFlagsCallback* flags.
To implement a character limit, provide a callback that drops input characters when the requested length has been reached.
func InvisibleButton ¶ added in v2.2.0
InvisibleButton calls InvisibleButtonV(id, Vec2{0,0}).
func InvisibleButtonV ¶ added in v2.2.0
InvisibleButtonV returning true if it is pressed.
func IsAnyItemActive ¶ added in v2.2.0
func IsAnyItemActive() bool
IsAnyItemActive returns true if the any item is active.
func IsAnyItemFocused ¶
func IsAnyItemFocused() bool
IsAnyItemFocused returns true if any item is focused.
func IsAnyMouseDown ¶
func IsAnyMouseDown() bool
IsAnyMouseDown returns true if any mouse button is currently being held down.
func IsItemActivated ¶ added in v2.6.0
func IsItemActivated() bool
IsItemActivated returns true if the last item was made active (item was previously inactive).
func IsItemActive ¶ added in v2.1.0
func IsItemActive() bool
IsItemActive returns if the last item is active. e.g. button being held, text field being edited.
This will continuously return true while holding mouse button on an item. Items that don't interact will always return false.
func IsItemClicked ¶ added in v2.2.0
func IsItemClicked() bool
IsItemClicked returns true if the current item is clicked with the left mouse button.
func IsItemDeactivated ¶ added in v2.6.0
func IsItemDeactivated() bool
IsItemDeactivated returns true if the last item was made inactive (item was previously active).
func IsItemDeactivatedAfterEdit ¶ added in v2.6.0
func IsItemDeactivatedAfterEdit() bool
IsItemDeactivatedAfterEdit returns true if the last item was made inactive and made a value change when it was active (e.g. Slider/Drag moved).
func IsItemEdited ¶ added in v2.6.0
func IsItemEdited() bool
IsItemEdited return true if the last item was modified or was pressed. This is generally the same as the "bool" return value of many widgets.
func IsItemFocused ¶
func IsItemFocused() bool
IsItemFocused returns true if the last item is focused.
func IsItemHovered ¶
func IsItemHovered() bool
IsItemHovered calls IsItemHoveredV(HoveredFlagsNone).
func IsItemHoveredV ¶
IsItemHoveredV returns true if the last item is hovered. (and usable, aka not blocked by a popup, etc.). See HoveredFlags for more options.
func IsItemToggledOpen ¶ added in v2.6.0
func IsItemToggledOpen() bool
IsItemToggledOpen returns true if the last item's open was toggled open.
func IsItemVisible ¶ added in v2.2.0
func IsItemVisible() bool
IsItemVisible returns true if the last item is visible.
func IsKeyPressedV ¶
IsKeyPressedV returns true if the corresponding key was pressed (went from !Down to Down). If repeat=true and the key is being held down then the press is repeated using io.KeyRepeatDelay and KeyRepeatRate.
func IsKeyReleased ¶
IsKeyReleased returns true if the corresponding key was released (went from Down to !Down).
func IsMouseClicked ¶
IsMouseClicked calls IsMouseClickedV(key, false).
func IsMouseClickedV ¶
IsMouseClickedV returns true if the mouse button was clicked (0=left, 1=right, 2=middle) If repeat=true and the mouse button is being held down then the click is repeated using io.KeyRepeatDelay and KeyRepeatRate.
func IsMouseDoubleClicked ¶
IsMouseDoubleClicked returns true if the mouse button was double-clicked (0=left, 1=right, 2=middle).
func IsMouseDown ¶
IsMouseDown returns true if the corresponding mouse button is currently being held down.
func IsMouseDragging ¶ added in v2.6.0
IsMouseDragging returns true if the mouse button is being dragged.
func IsMouseReleased ¶
IsMouseReleased returns true if the mouse button was released (went from Down to !Down).
func IsWindowAppearing ¶ added in v2.1.0
func IsWindowAppearing() bool
IsWindowAppearing returns whether the current window is appearing.
func IsWindowCollapsed ¶ added in v2.1.0
func IsWindowCollapsed() bool
IsWindowCollapsed returns whether the current window is collapsed.
func IsWindowFocused ¶ added in v2.1.0
func IsWindowFocused() bool
IsWindowFocused calls IsWindowFocusedV(FocusedFlagsNone).
func IsWindowFocusedV ¶ added in v2.1.0
IsWindowFocusedV returns if current window is focused or its root/child, depending on flags. See flags for options.
func IsWindowHovered ¶ added in v2.1.0
func IsWindowHovered() bool
IsWindowHovered calls IsWindowHoveredV(HoveredFlagsNone).
func IsWindowHoveredV ¶ added in v2.1.0
IsWindowHoveredV returns if current window is hovered (and typically: not blocked by a popup/modal). See flags for options. NB: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that!
func LabelText ¶
func LabelText(label, text string)
LabelText adds text+label aligned the same way as value+label widgets.
func ListBox ¶
ListBox calls ListBoxV(label, currentItem, items, -1) The function returns true if the selection was changed. The value of currentItem will indicate the new selected item.
func ListBoxV ¶
ListBoxV creates a list of selectables of given items with equal height, enclosed with header and footer. This version accepts a custom item height. The function returns true if the selection was changed. The value of currentItem will indicate the new selected item.
func MenuItemV ¶
MenuItemV adds a menu item with given label. Returns true if the item is selected. If selected is not nil, it will be toggled when true is returned. Shortcuts are displayed for convenience but not processed by ImGui at the moment.
func MouseCursor ¶
func MouseCursor() int
MouseCursor returns desired cursor type, reset in imgui.NewFrame(), this is updated during the frame. Valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you.
func NewFrame ¶
func NewFrame()
NewFrame starts a new ImGui frame, you can submit any command from this point until Render()/EndFrame().
func NextColumn ¶
func NextColumn()
NextColumn next column, defaults to current row or next row if the current row is finished.
func OpenPopup ¶
func OpenPopup(id string)
OpenPopup marks popup as open (don't call every frame!). Popups are closed when user click outside, or if CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block. By default, Selectable()/MenuItem() are calling CloseCurrentPopup(). Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level).
func PlotHistogram ¶
PlotHistogram draws an array of floats as a bar graph. It calls PlotHistogramV using no overlay text and automatically calculated scale and graph size.
func PlotHistogramV ¶
func PlotHistogramV(label string, values []float32, valuesOffset int, overlayText string, scaleMin float32, scaleMax float32, graphSize Vec2)
PlotHistogramV draws an array of floats as a bar graph with additional options. valuesOffset specifies an offset into the values array at which to start drawing, wrapping around when the end of the values array is reached. overlayText specifies a string to print on top of the graph. scaleMin and scaleMax define the scale of the y axis, if either is math.MaxFloat32 that value is calculated from the input data. graphSize defines the size of the graph, if either coordinate is zero the default size for that direction is used.
func PlotLines ¶
PlotLines draws an array of floats as a line graph. It calls PlotLinesV using no overlay text and automatically calculated scale and graph size.
func PlotLinesV ¶
func PlotLinesV(label string, values []float32, valuesOffset int, overlayText string, scaleMin float32, scaleMax float32, graphSize Vec2)
PlotLinesV draws an array of floats as a line graph with additional options. valuesOffset specifies an offset into the values array at which to start drawing, wrapping around when the end of the values array is reached. overlayText specifies a string to print on top of the graph. scaleMin and scaleMax define the scale of the y axis, if either is math.MaxFloat32 that value is calculated from the input data. graphSize defines the size of the graph, if either coordinate is zero the default size for that direction is used.
func PopButtonRepeat ¶ added in v2.6.0
func PopButtonRepeat()
PopButtonRepeat pops most recent button repeat setting.
func PopItemWidth ¶
func PopItemWidth()
PopItemWidth must be called for each call to PushItemWidth().
func PopStyleColorV ¶
func PopStyleColorV(count int)
PopStyleColorV reverts the given amount of style color changes.
func PopStyleVarV ¶
func PopStyleVarV(count int)
PopStyleVarV reverts the given amount of style variable changes.
func ProgressBar ¶
func ProgressBar(fraction float32)
ProgressBar calls ProgressBarV(fraction, Vec2{X: -1, Y: 0}, "").
func ProgressBarV ¶
ProgressBarV creates a progress bar. size (for each axis) is < 0.0f: align to end, 0.0f: auto, > 0.0f: specified size.
func PushButtonRepeat ¶ added in v2.6.0
func PushButtonRepeat(repeat bool)
PushButtonRepeat enables button to repeat press if held.
func PushFont ¶
func PushFont(font Font)
PushFont adds the given font on the stack. Use DefaultFont to refer to the default font.
func PushID ¶
func PushID(id string)
PushID pushes the given identifier into the ID stack. IDs are hash of the entire stack!
func PushIDInt ¶ added in v2.3.0
func PushIDInt(id int)
PushIDInt pushes the given identifier into the ID stack. IDs are hash of the entire stack!
func PushItemWidth ¶
func PushItemWidth(width float32)
PushItemWidth sets width of items for the common item+label case, in pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side).
func PushStyleColor ¶
func PushStyleColor(id StyleColorID, color Vec4)
PushStyleColor pushes the current style color for given ID on a stack and sets the given one. To revert to the previous color, call PopStyleColor().
func PushStyleVarFloat ¶
func PushStyleVarFloat(id StyleVarID, value float32)
PushStyleVarFloat pushes a float value on the stack to temporarily modify a style variable.
func PushStyleVarVec2 ¶
func PushStyleVarVec2(id StyleVarID, value Vec2)
PushStyleVarVec2 pushes a Vec2 value on the stack to temporarily modify a style variable.
func PushTextWrapPosV ¶
func PushTextWrapPosV(wrapPosX float32)
PushTextWrapPosV defines word-wrapping for Text() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrapPosX' position in window local space. Requires a matching call to PopTextWrapPos().
func RadioButton ¶ added in v2.4.0
RadioButton returning true if it is pressed and active indicates if it is selected.
func Render ¶
func Render()
Render ends the ImGui frame, finalize the draw data. After this method, call RenderedDrawData to retrieve the draw commands and execute them.
func ScrollMaxX ¶ added in v2.3.0
func ScrollMaxX() float32
ScrollMaxX returns the maximum horizontal scrolling amount: ContentSize.X - WindowSize.X .
func ScrollMaxY ¶ added in v2.3.0
func ScrollMaxY() float32
ScrollMaxY returns the maximum vertical scrolling amount: ContentSize.Y - WindowSize.Y .
func ScrollX ¶ added in v2.3.0
func ScrollX() float32
ScrollX returns the horizontal scrolling amount [0..GetScrollMaxX()].
func ScrollY ¶ added in v2.3.0
func ScrollY() float32
ScrollY returns the vertical scrolling amount [0..GetScrollMaxY()].
func Selectable ¶
Selectable calls SelectableV(label, false, 0, Vec2{0, 0}).
func SelectableV ¶
SelectableV returns true if the user clicked it, so you can modify your selection state. flags are the SelectableFlags to apply. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height.
func Separator ¶
func Separator()
Separator is generally horizontal. Inside a menu bar or in horizontal layout mode, this becomes a vertical separator.
func SetAssertHandler ¶
func SetAssertHandler(handler AssertHandler)
SetAssertHandler registers a handler function for all future assertions. Setting nil will disable special handling. The default handler panics.
func SetColumnOffset ¶
SetColumnOffset set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column.
func SetColumnWidth ¶
SetColumnWidth sets column width (in pixels). pass -1 to use current column.
func SetCursorPos ¶
func SetCursorPos(localPos Vec2)
SetCursorPos sets the cursor relative to the current window.
func SetCursorScreenPos ¶
func SetCursorScreenPos(absPos Vec2)
SetCursorScreenPos sets the cursor position in absolute screen coordinates.
func SetDragDropPayload ¶ added in v2.3.0
SetDragDropPayload sets the payload for current draw and drop source. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
func SetItemDefaultFocus ¶
func SetItemDefaultFocus()
SetItemDefaultFocus makes the last item the default focused item of a window.
func SetKeyboardFocusHere ¶ added in v2.2.0
func SetKeyboardFocusHere()
SetKeyboardFocusHere calls SetKeyboardFocusHereV(0).
func SetKeyboardFocusHereV ¶ added in v2.2.0
func SetKeyboardFocusHereV(offset int)
SetKeyboardFocusHereV gives keyboard focus to next item.
func SetNextItemOpen ¶
SetNextItemOpen sets the open/collapsed state of the following tree node.
func SetNextWindowBgAlpha ¶
func SetNextWindowBgAlpha(value float32)
SetNextWindowBgAlpha sets next window background color alpha. Helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg.
func SetNextWindowCollapsed ¶ added in v2.3.0
SetNextWindowCollapsed sets the next window collapsed state.
func SetNextWindowContentSize ¶
func SetNextWindowContentSize(size Vec2)
SetNextWindowContentSize sets next window content size (~ enforce the range of scrollbars). Does not include window decorations (title bar, menu bar, etc.). Set one axis to 0.0 to leave it automatic. This function must be called before Begin() to take effect.
func SetNextWindowFocus ¶
func SetNextWindowFocus()
SetNextWindowFocus sets next window to be focused / front-most. Call before Begin().
func SetNextWindowPos ¶
func SetNextWindowPos(pos Vec2)
SetNextWindowPos calls SetNextWindowPosV(pos, 0, Vec{0,0}).
func SetNextWindowPosV ¶
SetNextWindowPosV sets next window position. Call before Begin(). Use pivot=(0.5,0.5) to center on given point, etc.
func SetNextWindowSize ¶
func SetNextWindowSize(size Vec2)
SetNextWindowSize calls SetNextWindowSizeV(size, 0).
func SetNextWindowSizeConstraints ¶ added in v2.3.0
SetNextWindowSizeConstraints set next window size limits. Use -1,-1 on either X/Y axis to preserve the current size. Use callback to apply non-trivial programmatic constraints.
func SetNextWindowSizeV ¶
SetNextWindowSizeV sets next window size. Set axis to 0.0 to force an auto-fit on this axis. Call before Begin().
func SetScrollHereX ¶ added in v2.3.0
func SetScrollHereX(ratio float32)
SetScrollHereX adjusts horizontal scrolling amount to make current cursor position visible. ratio=0.0: left, 0.5: center, 1.0: right. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
func SetScrollHereY ¶
func SetScrollHereY(ratio float32)
SetScrollHereY adjusts vertical scrolling amount to make current cursor position visible. ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
func SetScrollX ¶ added in v2.3.0
func SetScrollX(scrollX float32)
SetScrollX sets horizontal scrolling amount [0..GetScrollMaxX()].
func SetScrollY ¶ added in v2.3.0
func SetScrollY(scrollY float32)
SetScrollY sets vertical scrolling amount [0..GetScrollMaxY()].
func SetTabItemClosed ¶
func SetTabItemClosed(tabOrDockedWindowLabel string)
SetTabItemClosed notify TabBar or Docking system of a closed tab/window ahead (useful to reduce visual flicker on reorderable tab bars). For tab-bar: call after BeginTabBar() and before Tab submissions. Otherwise call with a window name.
func SetTooltip ¶
func SetTooltip(text string)
SetTooltip sets a text tooltip under the mouse-cursor, typically use with IsItemHovered(). Overrides any previous call to SetTooltip().
func ShowDemoWindow ¶
func ShowDemoWindow(open *bool)
ShowDemoWindow creates a demo/test window. Demonstrates most ImGui features. Call this to learn about the library! Try to make it always available in your application!
func ShowUserGuide ¶
func ShowUserGuide()
ShowUserGuide adds basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).
func SliderFloat ¶
SliderFloat calls SliderIntV(label, value, min, max, "%.3f", 1.0).
func SliderFloat3 ¶
SliderFloat3 calls SliderFloat3V(label, values, min, max, "%.3f", 1,0).
func SliderFloat3V ¶
func SliderFloat3V(label string, values *[3]float32, min, max float32, format string, power float32) bool
SliderFloat3V creates slider for a 3D vector.
func SliderFloatV ¶
func SliderFloatV(label string, value *float32, min, max float32, format string, power float32) bool
SliderFloatV creates a slider for floats.
func SliderIntV ¶
SliderIntV creates a slider for integers.
func StyleColorsClassic ¶ added in v2.3.0
func StyleColorsClassic()
StyleColorsClassic sets the classic style.
func StyleColorsDark ¶ added in v2.3.0
func StyleColorsDark()
StyleColorsDark sets the new, recommended style (default).
func StyleColorsLight ¶ added in v2.3.0
func StyleColorsLight()
StyleColorsLight sets the light style, best used with borders and a custom, thicker font.
func Text ¶
func Text(text string)
Text adds formatted text. See PushTextWrapPosV() or PushStyleColorV() for modifying the output. Without any modified style stack, the text is unformatted.
func TextLineHeightWithSpacing ¶
func TextLineHeightWithSpacing() float32
TextLineHeightWithSpacing returns ~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text).
func Time ¶ added in v2.5.0
func Time() float64
Time returns global imgui time. Incremented by io.DeltaTime every frame.
func TreeNodeToLabelSpacing ¶
func TreeNodeToLabelSpacing() float32
TreeNodeToLabelSpacing returns the horizontal distance preceding label for a regular unframed TreeNode.
func TreeNodeV ¶
TreeNodeV returns true if the tree branch is to be rendered. Call TreePop() in this case.
func TreePop ¶
func TreePop()
TreePop finishes a tree branch. This has to be called for a matching TreeNodeV call returning true.
func Unindent ¶ added in v2.3.0
func Unindent()
Unindent moves content position back to the left by style.IndentSpacing.
func UnindentV ¶ added in v2.3.0
func UnindentV(indentW float32)
UnindentV moves content position back to the left, by style.IndentSpacing or indentW if not zero.
func VSliderFloat ¶ added in v2.2.0
VSliderFloat calls VSliderIntV(label, size, value, min, max, "%.3f", 1.0).
func VSliderFloatV ¶ added in v2.2.0
func VSliderFloatV(label string, size Vec2, value *float32, min, max float32, format string, power float32) bool
VSliderFloatV creates a vertically oriented slider for floats.
func VSliderInt ¶ added in v2.2.0
VSliderInt calls VSliderIntV(label, size, value, min, max, "%d").
func VSliderIntV ¶ added in v2.2.0
VSliderIntV creates a vertically oriented slider for integers.
func VertexBufferLayout ¶
VertexBufferLayout returns the byte sizes necessary to select fields in a vertex buffer of a DrawList.
func WindowContentRegionWidth ¶ added in v2.5.0
func WindowContentRegionWidth() float32
WindowContentRegionWidth returns the width of the content boundary, in window coordinates.
func WindowHeight ¶
func WindowHeight() float32
WindowHeight returns the height of the current window.
Types ¶
type AllocatedGlyphRanges ¶
type AllocatedGlyphRanges struct {
GlyphRanges
}
AllocatedGlyphRanges are GlyphRanges dynamically allocated by the application. Such ranges need to be freed when they are no longer in use to avoid resource leak.
func (*AllocatedGlyphRanges) Free ¶
func (ranges *AllocatedGlyphRanges) Free()
Free releases the underlying memory of the ranges. Call this method when the ranges are no longer in use.
type Alpha8Image ¶
Alpha8Image represents a imgui backed 8-bit alpha value image.
type AssertHandler ¶
AssertHandler is a handler for an assertion that happened in the native part of ImGui.
type AssertionError ¶ added in v2.3.0
AssertionError is the standard error being thrown by the default handler.
func (AssertionError) Error ¶ added in v2.3.0
func (err AssertionError) Error() string
Error returns the string representation.
type Clipboard ¶
type Clipboard interface { // Text returns the current text from the clipboard, if available. Text() (string, error) // SetText sets the text as the current text on the clipboard. SetText(value string) }
Clipboard describes the access to the text clipboard of the window manager.
type Condition ¶
type Condition int
Condition for SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions. Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ConditionAlways.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context specifies a scope of ImGui.
All contexts share a same FontAtlas by default. If you want different font atlas, you can create them and overwrite the CurrentIO.Fonts of an ImGui context.
func CreateContext ¶
CreateContext produces a new internal state scope. Passing nil for the fontAtlas creates a default font.
func CurrentContext ¶
CurrentContext returns the currently active state scope. Returns ErrNoContext if no context is available.
func (*Context) Destroy ¶
func (context *Context) Destroy()
Destroy removes the internal state scope. Trying to destroy an already destroyed context does nothing.
func (Context) SetCurrent ¶
SetCurrent activates this context as the currently active state scope.
type DrawCommand ¶
type DrawCommand uintptr
DrawCommand describes one GPU call (or a callback).
func (DrawCommand) CallUserCallback ¶
func (cmd DrawCommand) CallUserCallback(list DrawList)
CallUserCallback calls the user callback instead of rendering the vertices. ClipRect and TextureID will be set normally.
func (DrawCommand) ClipRect ¶
func (cmd DrawCommand) ClipRect() (rect Vec4)
ClipRect defines the clipping rectangle (x1, y1, x2, y2).
func (DrawCommand) ElementCount ¶
func (cmd DrawCommand) ElementCount() int
ElementCount is the number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee DrawList's VertexBuffer, indices in IndexBuffer.
func (DrawCommand) HasUserCallback ¶
func (cmd DrawCommand) HasUserCallback() bool
HasUserCallback returns true if this handle command should be deferred.
func (DrawCommand) TextureID ¶
func (cmd DrawCommand) TextureID() TextureID
TextureID is the user-provided texture ID. Set by user in FontAtlas.SetTextureID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas.
type DrawData ¶
type DrawData uintptr
DrawData contains all draw data to render an ImGui frame.
func RenderedDrawData ¶
func RenderedDrawData() DrawData
RenderedDrawData returns the created draw commands, which are valid after Render() and until the next call to NewFrame(). This is what you have to render.
func (DrawData) CommandLists ¶
CommandLists is an array of DrawList to render. The DrawList are owned by the context and only pointed to from here.
func (DrawData) ScaleClipRects ¶
ScaleClipRects is a helper to scale the ClipRect field of each DrawCmd. Use if your final output buffer is at a different scale than ImGui expects, or if there is a difference between your window resolution and framebuffer resolution.
type DrawList ¶
type DrawList uintptr
DrawList is a draw-command list. This is the low-level list of polygons that ImGui functions are filling. At the end of the frame, all command lists are passed to your render function for rendering.
Each ImGui window contains its own DrawList. You can use GetWindowDrawList() to access the current window draw list and draw custom primitives.
You can interleave normal ImGui calls and adding primitives to the current draw list.
All positions are generally in pixel coordinates (top-left at (0,0), bottom-right at io.DisplaySize), however you are totally free to apply whatever transformation matrix to want to the data (if you apply such transformation you'll want to apply it to ClipRect as well)
Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui functions), if you use this API a lot consider coarse culling your drawn objects.
func WindowDrawList ¶ added in v2.2.0
func WindowDrawList() DrawList
WindowDrawList returns the DrawList for the current window.
func (DrawList) AddCircle ¶ added in v2.2.0
func (list DrawList) AddCircle(center Vec2, radius float32, col PackedColor)
AddCircle calls AddCircleV(center, radius, col, 12, 1.0).
func (DrawList) AddCircleFilled ¶ added in v2.2.0
func (list DrawList) AddCircleFilled(center Vec2, radius float32, col PackedColor)
AddCircleFilled calls AddCircleFilledV(center, radius, col, 12).
func (DrawList) AddCircleFilledV ¶ added in v2.2.0
func (list DrawList) AddCircleFilledV(center Vec2, radius float32, col PackedColor, numSegments int)
AddCircleFilledV adds a filled circle to the draw list. min is the upper-left corner of the rectangle, and max is the lower right corner.
func (DrawList) AddCircleV ¶ added in v2.2.0
func (list DrawList) AddCircleV(center Vec2, radius float32, col PackedColor, numSegments int, thickness float32)
AddCircleV adds a unfilled circle to the draw list. min is the upper-left corner of the rectangle, and max is the lower right corner.
func (DrawList) AddLine ¶ added in v2.2.0
func (list DrawList) AddLine(p1 Vec2, p2 Vec2, col PackedColor)
AddLine call AddLineV with a thickness value of 1.0.
func (DrawList) AddLineV ¶ added in v2.2.0
func (list DrawList) AddLineV(p1 Vec2, p2 Vec2, col PackedColor, thickness float32)
AddLineV adds a line to draw list, extending from point p1 to p2.
func (DrawList) AddRect ¶ added in v2.2.0
func (list DrawList) AddRect(min Vec2, max Vec2, col PackedColor)
AddRect calls AddRectV with rounding and thickness values of 1.0 and DrawCornerFlagsAll.
func (DrawList) AddRectFilled ¶ added in v2.2.0
func (list DrawList) AddRectFilled(min Vec2, max Vec2, col PackedColor)
AddRectFilled calls AddRectFilledV(min, max, col, 1.0, DrawCornerFlagsAll).
func (DrawList) AddRectFilledV ¶ added in v2.2.0
func (list DrawList) AddRectFilledV(min Vec2, max Vec2, col PackedColor, rounding float32, drawCornerFlags int)
AddRectFilledV adds a filled rectangle to the draw list. min is the upper-left corner of the rectangle, and max is the lower right corner. rectangles with dimensions of 1 pixel are not rendered properly.
func (DrawList) AddRectV ¶ added in v2.2.0
func (list DrawList) AddRectV(min Vec2, max Vec2, col PackedColor, rounding float32, drawCornerFlags int, thickness float32)
AddRectV adds a rectangle to draw list. min is the upper-left corner of the rectangle, and max is the lower right corner. rectangles with dimensions of 1 pixel are not rendered properly.
drawCornerFlags indicate which corners of the rectangle are to be rounded.
func (DrawList) AddTriangle ¶ added in v2.2.0
func (list DrawList) AddTriangle(p1 Vec2, p2 Vec2, p3 Vec2, col PackedColor)
AddTriangle calls AddTriangleV(p1, p2, p3, col, 1.0).
func (DrawList) AddTriangleFilled ¶ added in v2.2.0
func (list DrawList) AddTriangleFilled(p1 Vec2, p2 Vec2, p3 Vec2, col PackedColor)
AddTriangleFilled adds an filled triangle of points p1, p2, p3 to the draw list.
func (DrawList) AddTriangleV ¶ added in v2.2.0
AddTriangleV adds an unfilled triangle of points p1, p2, p3 to the draw list.
func (DrawList) Commands ¶
func (list DrawList) Commands() []DrawCommand
Commands returns the list of draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback.
func (DrawList) IndexBuffer ¶
IndexBuffer returns the handle information of the whole index buffer. Returned are the handle pointer and the total byte size. The buffer is a packed array of index entries, each consisting of an integer offset. To determine the byte size, call IndexBufferLayout.
func (DrawList) VertexBuffer ¶
VertexBuffer returns the handle information of the whole vertex buffer. Returned are the handle pointer and the total byte size. The buffer is a packed array of vertex entries, each consisting of a 2D position vector, a 2D UV vector, and a 4-byte color value. To determine the byte size and offset values, call VertexBufferLayout.
type Font ¶
type Font uintptr
Font describes one loaded font in an atlas.
const DefaultFont Font = 0
DefaultFont can be used to refer to the default font of the current font atlas without having the actual font reference.
type FontAtlas ¶
type FontAtlas uintptr
FontAtlas contains runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader.
func (FontAtlas) AddFontDefault ¶
AddFontDefault adds the default font to the atlas. This is done by default if you do not call any of the AddFont* methods before retrieving the texture data.
func (FontAtlas) AddFontDefaultV ¶
func (atlas FontAtlas) AddFontDefaultV(cfg FontConfig) Font
AddFontDefaultV adds the default font to the atlas using the specified FontConfig.
func (FontAtlas) AddFontFromFileTTF ¶
AddFontFromFileTTF calls AddFontFromFileTTFV(filename, sizePixels, DefaultFontConfig, EmptyGlyphRanges).
func (FontAtlas) AddFontFromFileTTFV ¶
func (atlas FontAtlas) AddFontFromFileTTFV(filename string, sizePixels float32, config FontConfig, glyphRange GlyphRanges) Font
AddFontFromFileTTFV attempts to load a font from given TTF file.
func (FontAtlas) AddFontFromMemoryTTF ¶
AddFontFromMemoryTTF calls AddFontFromMemoryTTFV(fontData, sizePixels, DefaultFontConfig, EmptyGlyphRanges).
func (FontAtlas) AddFontFromMemoryTTFV ¶
func (atlas FontAtlas) AddFontFromMemoryTTFV( fontData []byte, sizePixels float32, config FontConfig, glyphRange GlyphRanges, ) Font
AddFontFromMemoryTTFV attempts to load a font from given TTF byte array.
func (FontAtlas) BuildWithFreeType ¶
BuildWithFreeType calls BuildWithFreeTypeV(0).
func (FontAtlas) BuildWithFreeTypeV ¶
BuildWithFreeTypeV builds the FontAtlas using FreeType instead of the default rasterizer. FreeType renders small fonts better. Call this function instead of FontAtlas.Build() . As with FontAtlas.Build(), this function needs to be called before retrieving the texture data.
FreeType support must be enabled with the build tag "imguifreetype".
func (FontAtlas) GlyphRangesChineseFull ¶
func (atlas FontAtlas) GlyphRangesChineseFull() GlyphRanges
GlyphRangesChineseFull describes Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs.
func (FontAtlas) GlyphRangesChineseSimplifiedCommon ¶
func (atlas FontAtlas) GlyphRangesChineseSimplifiedCommon() GlyphRanges
GlyphRangesChineseSimplifiedCommon describes Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese.
func (FontAtlas) GlyphRangesCyrillic ¶
func (atlas FontAtlas) GlyphRangesCyrillic() GlyphRanges
GlyphRangesCyrillic describes Default + about 400 Cyrillic characters.
func (FontAtlas) GlyphRangesDefault ¶
func (atlas FontAtlas) GlyphRangesDefault() GlyphRanges
GlyphRangesDefault describes Basic Latin, Extended Latin.
func (FontAtlas) GlyphRangesJapanese ¶
func (atlas FontAtlas) GlyphRangesJapanese() GlyphRanges
GlyphRangesJapanese describes Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs.
func (FontAtlas) GlyphRangesKorean ¶
func (atlas FontAtlas) GlyphRangesKorean() GlyphRanges
GlyphRangesKorean describes Default + Korean characters.
func (FontAtlas) GlyphRangesThai ¶
func (atlas FontAtlas) GlyphRangesThai() GlyphRanges
GlyphRangesThai describes Default + Thai characters.
func (FontAtlas) SetTexDesiredWidth ¶
SetTexDesiredWidth registers the width desired by user before building the image. Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height. Set to 0 by default, causing auto-calculation.
func (FontAtlas) SetTextureID ¶
SetTextureID sets user data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the DrawCommand.
func (FontAtlas) TextureDataAlpha8 ¶
func (atlas FontAtlas) TextureDataAlpha8() *Alpha8Image
TextureDataAlpha8 returns the image in 8-bit alpha values for the font atlas. The returned image is valid as long as the font atlas is.
func (FontAtlas) TextureDataRGBA32 ¶
func (atlas FontAtlas) TextureDataRGBA32() *RGBA32Image
TextureDataRGBA32 returns the image in 32-bit RGBA values for the font atlas. The returned image is valid as long as the font atlas is.
type FontConfig ¶
type FontConfig uintptr
FontConfig describes properties of a single font.
const DefaultFontConfig FontConfig = 0
DefaultFontConfig lets ImGui take default properties as per implementation. The properties of the default configuration cannot be changed using the SetXXX functions.
func NewFontConfig ¶
func NewFontConfig() FontConfig
NewFontConfig creates a new font configuration. Delete must be called on the returned config.
func (*FontConfig) Delete ¶
func (config *FontConfig) Delete()
Delete removes the font configuration and resets it to the DefaultFontConfig.
func (FontConfig) SetGlyphMaxAdvanceX ¶
func (config FontConfig) SetGlyphMaxAdvanceX(value float32)
SetGlyphMaxAdvanceX sets the maximum AdvanceX for glyphs. Set both Min/Max to enforce mono-space font.
func (FontConfig) SetGlyphMinAdvanceX ¶
func (config FontConfig) SetGlyphMinAdvanceX(value float32)
SetGlyphMinAdvanceX sets the minimum AdvanceX for glyphs. Set Min to align font icons, set both Min/Max to enforce mono-space font.
func (FontConfig) SetMergeMode ¶
func (config FontConfig) SetMergeMode(value bool)
SetMergeMode merges the new fonts into the previous font if enabled. This way you can combine multiple input fonts into one (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights.
func (FontConfig) SetName ¶ added in v2.5.0
func (config FontConfig) SetName(name string)
SetName sets a short display name for a font, for diagnostic purposes. If the FontConfig does not provide a name, one will be synthesized for fonts which are added from files. When adding fonts from memory, this method can be used to provide a name. The name will be truncated if it is longer than the limit supported by imgui.
func (FontConfig) SetOversampleH ¶
func (config FontConfig) SetOversampleH(value int)
SetOversampleH sets the oversampling amount for the X axis. Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
func (FontConfig) SetOversampleV ¶
func (config FontConfig) SetOversampleV(value int)
SetOversampleV sets the oversampling amount for the Y axis. Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
func (FontConfig) SetPixelSnapH ¶
func (config FontConfig) SetPixelSnapH(value bool)
SetPixelSnapH aligns every glyph to pixel boundary if enabled. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.
func (FontConfig) SetSize ¶
func (config FontConfig) SetSize(sizePixels float32)
SetSize sets the size in pixels for rasterizer (more or less maps to the resulting font height).
type FreeTypeError ¶
type FreeTypeError string
FreeTypeError describes a problem with FreeType font rendering.
func (FreeTypeError) Error ¶
func (err FreeTypeError) Error() string
Error returns the readable text presentation of the error.
type GlyphRanges ¶
type GlyphRanges uintptr
GlyphRanges describes a list of Unicode ranges; 2 value per range, values are inclusive. Standard ranges can be queried from FontAtlas.GlyphRanges*() functions.
const EmptyGlyphRanges GlyphRanges = 0
EmptyGlyphRanges is one that does not contain any ranges.
type GlyphRangesBuilder ¶
type GlyphRangesBuilder struct {
// contains filtered or unexported fields
}
GlyphRangesBuilder can be used to create a new, combined, set of ranges.
func (*GlyphRangesBuilder) Add ¶
func (builder *GlyphRangesBuilder) Add(from, to rune)
Add extends the builder with the given range (inclusive). from must be smaller, or equal to, to - otherwise the range is ignored.
func (*GlyphRangesBuilder) AddExisting ¶
func (builder *GlyphRangesBuilder) AddExisting(ranges ...GlyphRanges)
AddExisting adds the given set of ranges to the builder. The provided ranges are immediately extracted.
func (*GlyphRangesBuilder) Build ¶
func (builder *GlyphRangesBuilder) Build() AllocatedGlyphRanges
Build combines all the currently registered ranges and creates a new instance. The returned ranges object needs to be explicitly freed in order to release resources.
type IO ¶
type IO struct {
// contains filtered or unexported fields
}
IO is where your app communicate with ImGui. Access via CurrentIO(). Read 'Programmer guide' section in imgui.cpp file for general usage.
func CurrentIO ¶
func CurrentIO() IO
CurrentIO returns access to the ImGui communication struct for the currently active context.
func (IO) AddInputCharacters ¶
AddInputCharacters adds a new character into InputCharacters[].
func (IO) AddMouseWheelDelta ¶
AddMouseWheelDelta adds the given offsets to the current mouse wheel values. 1 vertical unit scrolls about 5 lines text. Most users don't have a mouse with an horizontal wheel, may not be provided by all back-ends.
func (IO) Fonts ¶
Fonts returns the font atlas to load and assemble one or more fonts into a single tightly packed texture.
func (IO) Framerate ¶ added in v2.1.0
Framerate application estimation, in frame per second. Solely for convenience. Rolling average estimation based on IO.DeltaTime over 120 frames.
func (IO) KeyMap ¶
KeyMap maps a key into the KeysDown array which represents your "native" keyboard state.
func (IO) MetricsActiveAllocations ¶ added in v2.1.0
MetricsActiveAllocations returns number of active allocations, updated by MemAlloc/MemFree based on current context. May be off if you have multiple imgui contexts.
func (IO) MetricsActiveWindows ¶ added in v2.1.0
MetricsActiveWindows returns number of active windows.
func (IO) MetricsRenderIndices ¶ added in v2.1.0
MetricsRenderIndices returns indices output during last call to Render() = number of triangles * 3.
func (IO) MetricsRenderVertices ¶ added in v2.1.0
MetricsRenderVertices returns vertices output during last call to Render().
func (IO) MetricsRenderWindows ¶ added in v2.1.0
MetricsRenderWindows returns number of visible windows.
func (IO) MouseDelta ¶ added in v2.1.0
MouseDelta returns the mouse delta movement . Note that this is zero if either current or previous position are invalid (-math.MaxFloat32,-math.MaxFloat32), so a disappearing/reappearing mouse won't have a huge delta.
func (IO) MouseWheel ¶ added in v2.6.0
MouseWheel returns the mouse wheel movement.
func (IO) SetBackendFlags ¶
SetBackendFlags sets back-end capabilities.
func (IO) SetClipboard ¶
SetClipboard registers a clipboard for text copy/paste actions. If no clipboard is set, then a fallback implementation may be used, if available for the OS. To disable clipboard handling overall, pass nil as the Clipboard.
Since ImGui queries the clipboard text via a return value, the wrapper has to hold the current clipboard text as a copy in memory. This memory will be freed at the next clipboard operation.
func (IO) SetConfigFlags ¶
SetConfigFlags sets the gamepad/keyboard navigation options, etc.
func (IO) SetDeltaTime ¶
SetDeltaTime sets the time elapsed since last frame, in seconds.
func (IO) SetDisplaySize ¶
SetDisplaySize sets the size in pixels.
func (IO) SetFontGlobalScale ¶
SetFontGlobalScale sets the global scaling factor for all fonts.
func (IO) SetIniFilename ¶
SetIniFilename changes the filename for the settings. Default: "imgui.ini". Use an empty string to disable the ini from being used.
func (IO) SetMouseButtonDown ¶
SetMouseButtonDown sets whether a specific mouse button is currently pressed. Mouse buttons: left, right, middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). Other buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
func (IO) SetMousePosition ¶
SetMousePosition sets the mouse position, in pixels. Set to Vec2(-math.MaxFloat32,-mathMaxFloat32) if mouse is unavailable (on another screen, etc.).
func (IO) WantCaptureKeyboard ¶
WantCaptureKeyboard returns true if imgui will use the keyboard inputs. Do not dispatch them to your main game/application (in both cases, always pass keyboard inputs to imgui).
e.g. InputText active, or an imgui window is focused and navigation is enabled, etc.
func (IO) WantCaptureMouse ¶
WantCaptureMouse returns true if imgui will use the mouse inputs. Do not dispatch them to your main game/application in this case. In either case, always pass on mouse inputs to imgui.
e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.
func (IO) WantTextInput ¶
WantTextInput is true, you may display an on-screen keyboard. This is set by ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active).
type InputTextCallback ¶
type InputTextCallback func(InputTextCallbackData) int32
InputTextCallback is called for sharing state of an input field. By default, the callback should return 0.
type InputTextCallbackData ¶
type InputTextCallbackData struct {
// contains filtered or unexported fields
}
InputTextCallbackData represents the shared state of InputText(), passed as an argument to your callback.
func (InputTextCallbackData) Buffer ¶
func (data InputTextCallbackData) Buffer() []byte
Buffer returns a view into the current UTF-8 buffer. Only during the callbacks of [Completion,History,Always] the current buffer is returned. The returned slice is a temporary view into the underlying raw buffer. Do not keep it! The underlying memory allocation may even change through a call to InsertBytes().
You may change the buffer through the following ways: If the new text has a different (encoded) length, use the functions InsertBytes() and/or DeleteBytes(). Otherwise you may keep the buffer as is and modify the bytes. If you change the buffer this way directly, mark the buffer as modified with MarkBufferModified().
func (InputTextCallbackData) CursorPos ¶
func (data InputTextCallbackData) CursorPos() int
CursorPos returns the byte-offset of the cursor within the buffer. Only valid during [Completion,History,Always] callbacks.
func (InputTextCallbackData) DeleteBytes ¶
func (data InputTextCallbackData) DeleteBytes(offset, count int)
DeleteBytes removes the given count of bytes starting at the specified byte offset within the buffer. This function can be called during the [Completion,History,Always] callbacks. Clears the current selection.
This function ignores the deletion beyond the current buffer length. Calling with negative offset or count arguments will panic.
func (InputTextCallbackData) EventChar ¶
func (data InputTextCallbackData) EventChar() rune
EventChar returns the current character input. Only valid during CharFilter callback.
func (InputTextCallbackData) EventFlag ¶
func (data InputTextCallbackData) EventFlag() int
EventFlag returns one of the InputTextFlagsCallback* constants to indicate the nature of the callback.
func (InputTextCallbackData) EventKey ¶
func (data InputTextCallbackData) EventKey() int
EventKey returns the currently pressed key. Valid for completion and history callbacks.
func (InputTextCallbackData) Flags ¶
func (data InputTextCallbackData) Flags() int
Flags returns the set of flags that the user originally passed to InputText.
func (InputTextCallbackData) InsertBytes ¶
func (data InputTextCallbackData) InsertBytes(offset int, bytes []byte)
InsertBytes inserts the given bytes at given byte offset into the buffer. Calling this function may change the underlying buffer allocation.
This function can be called during the [Completion,History,Always] callbacks. Clears the current selection.
Calling with an offset outside of the range of the buffer will panic.
func (InputTextCallbackData) MarkBufferModified ¶
func (data InputTextCallbackData) MarkBufferModified()
MarkBufferModified indicates that the content of the buffer was modified during a callback. Only considered during [Completion,History,Always] callbacks.
func (InputTextCallbackData) SelectionEnd ¶
func (data InputTextCallbackData) SelectionEnd() int
SelectionEnd returns the byte-offset of the selection end within the buffer. Only valid during [Completion,History,Always] callbacks.
func (InputTextCallbackData) SelectionStart ¶
func (data InputTextCallbackData) SelectionStart() int
SelectionStart returns the byte-offset of the selection start within the buffer. Only valid during [Completion,History,Always] callbacks.
func (InputTextCallbackData) SetCursorPos ¶
func (data InputTextCallbackData) SetCursorPos(value int)
SetCursorPos changes the current byte-offset of the cursor within the buffer. Only valid during [Completion,History,Always] callbacks.
func (InputTextCallbackData) SetEventChar ¶
func (data InputTextCallbackData) SetEventChar(value rune)
SetEventChar overrides what the user entered. Set to zero do drop the current input. Returning 1 from the callback also drops the current input. Only valid during CharFilter callback.
Note: The internal representation of characters is based on uint16, so less than rune would provide.
func (InputTextCallbackData) SetSelectionEnd ¶
func (data InputTextCallbackData) SetSelectionEnd(value int)
SetSelectionEnd changes the current byte-offset of the selection end within the buffer. Only valid during [Completion,History,Always] callbacks.
func (InputTextCallbackData) SetSelectionStart ¶
func (data InputTextCallbackData) SetSelectionStart(value int)
SetSelectionStart changes the current byte-offset of the selection start within the buffer. Only valid during [Completion,History,Always] callbacks.
type ListClipper ¶
type ListClipper struct { StartPosY float32 ItemsHeight float32 ItemsCount int StepNo int DisplayStart int DisplayEnd int }
ListClipper is a helper to manually clip large list of items. If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse clipping based on visibility to save yourself from processing those items at all. The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped. ImGui already clips items based on their bounds but it needs to measure text size to do so. Coarse clipping before submission makes this cost and your own data fetching/submission cost null.
Usage
var clipper imgui.ListClipper clipper.Begin(1000) // we have 1000 elements, evenly spaced. for clipper.Step() for i := clipper.DisplayStart; i < clipper.DisplayEnd; i++ imgui.Text(fmt.Sprintf("line number %d", i))
Step 0: the clipper let you process the first element, regardless of it being visible or not, so it can measure the element height (step skipped if user passed a known height at begin).
Step 1: the clipper infers height from first element, calculates the actual range of elements to display, and positions the cursor before the first element.
Step 2: placeholder step only required if an explicit itemsHeight was passed to Begin() and user call Step(). Does nothing and switch to Step 3.
Step 3: the clipper validates that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop.
func (*ListClipper) Begin ¶
func (clipper *ListClipper) Begin(itemsCount int)
Begin calls BeginV(itemsCount, -1.0) .
func (*ListClipper) BeginV ¶
func (clipper *ListClipper) BeginV(itemsCount int, itemsHeight float32)
BeginV must be called before stepping. Use an itemCount of math.MaxInt if you don't know how many items you have. In this case the cursor won't be advanced in the final step.
For itemsHeight, use -1.0 to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().
func (*ListClipper) End ¶
func (clipper *ListClipper) End()
End resets the clipper. This function is automatically called on the last call of Step() that returns false.
func (*ListClipper) Step ¶
func (clipper *ListClipper) Step() bool
Step must be called in a loop until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items.
type PackedColor ¶ added in v2.2.0
type PackedColor uint32
PackedColor is a 32-bit RGBA color value, with 8 bits per color channel. The bytes are assigned as 0xAABBGGRR.
func Packed ¶ added in v2.2.0
func Packed(c color.Color) PackedColor
Packed converts the given color to a PackedColor instance.
func PackedColorFromVec4 ¶ added in v2.2.0
func PackedColorFromVec4(vec Vec4) PackedColor
PackedColorFromVec4 converts the given four-dimensional vector into a packed color.
func (PackedColor) RGBA ¶ added in v2.2.0
func (clr PackedColor) RGBA() (r, g, b, a uint32)
RGBA implements the color.Color interface.
type RGBA32Image ¶
RGBA32Image represents a imgui backed 32-bit RGBA (8 bits per channel) value image.
type Style ¶
type Style uintptr
Style describes the overall graphical representation of the user interface.
func CurrentStyle ¶
func CurrentStyle() Style
CurrentStyle returns the UI Style for the currently active context.
func (Style) Color ¶ added in v2.6.0
func (style Style) Color(id StyleColorID) Vec4
Color gets a color value from the UI style.
func (Style) FramePadding ¶ added in v2.2.0
FramePadding is the padding within a framed rectangle (used by most widgets).
func (Style) ItemInnerSpacing ¶
ItemInnerSpacing is the horizontal and vertical spacing between elements of a composed widget (e.g. a slider and its label).
func (Style) ItemSpacing ¶ added in v2.3.0
ItemSpacing returns horizontal and vertical spacing between widgets or lines.
func (Style) ScaleAllSizes ¶
ScaleAllSizes applies a scaling factor to all sizes. To scale your entire UI (e.g. if you want your app to use High DPI or generally be DPI aware) you may use this helper function. Scaling the fonts is done separately and is up to you.
Important: This operation is lossy because all sizes are rounded to integer. If you need to change your scale multiples, call this over a freshly initialized style rather than scaling multiple times.
func (Style) SetColor ¶
func (style Style) SetColor(id StyleColorID, value Vec4)
SetColor sets a color value of the UI style.
type StyleColorID ¶
type StyleColorID int
StyleColorID identifies a color in the UI style.
const ( StyleColorText StyleColorID = 0 StyleColorTextDisabled StyleColorID = 1 StyleColorWindowBg StyleColorID = 2 StyleColorChildBg StyleColorID = 3 StyleColorPopupBg StyleColorID = 4 StyleColorBorder StyleColorID = 5 StyleColorBorderShadow StyleColorID = 6 StyleColorFrameBg StyleColorID = 7 StyleColorFrameBgHovered StyleColorID = 8 StyleColorFrameBgActive StyleColorID = 9 StyleColorTitleBg StyleColorID = 10 StyleColorTitleBgActive StyleColorID = 11 StyleColorTitleBgCollapsed StyleColorID = 12 StyleColorMenuBarBg StyleColorID = 13 StyleColorScrollbarBg StyleColorID = 14 StyleColorScrollbarGrab StyleColorID = 15 StyleColorScrollbarGrabHovered StyleColorID = 16 StyleColorScrollbarGrabActive StyleColorID = 17 StyleColorCheckMark StyleColorID = 18 StyleColorSliderGrab StyleColorID = 19 StyleColorSliderGrabActive StyleColorID = 20 StyleColorButton StyleColorID = 21 StyleColorButtonHovered StyleColorID = 22 StyleColorButtonActive StyleColorID = 23 StyleColorHeader StyleColorID = 24 StyleColorHeaderHovered StyleColorID = 25 StyleColorHeaderActive StyleColorID = 26 StyleColorSeparator StyleColorID = 27 StyleColorSeparatorHovered StyleColorID = 28 StyleColorSeparatorActive StyleColorID = 29 StyleColorResizeGrip StyleColorID = 30 StyleColorResizeGripHovered StyleColorID = 31 StyleColorResizeGripActive StyleColorID = 32 StyleColorTab StyleColorID = 33 StyleColorTabHovered StyleColorID = 34 StyleColorTabActive StyleColorID = 35 StyleColorTabUnfocused StyleColorID = 36 StyleColorTabUnfocusedActive StyleColorID = 37 StyleColorPlotLines StyleColorID = 38 StyleColorPlotLinesHovered StyleColorID = 39 StyleColorPlotHistogram StyleColorID = 40 StyleColorPlotHistogramHovered StyleColorID = 41 StyleColorTextSelectedBg StyleColorID = 42 StyleColorDragDropTarget StyleColorID = 43 StyleColorModalWindowDarkening StyleColorID = 47 // Darken/colorize entire screen behind a modal window, when one is active )
This is the list of StyleColor identifier.
type StyleVarID ¶
type StyleVarID int
StyleVarID identifies a style variable in the UI style.
const ( // StyleVarAlpha is a float StyleVarAlpha StyleVarID = 0 // StyleVarWindowPadding is a Vec2 StyleVarWindowPadding StyleVarID = 1 // StyleVarWindowRounding is a float StyleVarWindowRounding StyleVarID = 2 // StyleVarWindowBorderSize is a float StyleVarWindowBorderSize StyleVarID = 3 // StyleVarWindowMinSize is a Vec2 StyleVarWindowMinSize StyleVarID = 4 // StyleVarWindowTitleAlign is a Vec2 StyleVarWindowTitleAlign StyleVarID = 5 // StyleVarChildRounding is a float StyleVarChildRounding StyleVarID = 6 // StyleVarChildBorderSize is a float StyleVarChildBorderSize StyleVarID = 7 // StyleVarPopupRounding is a float StyleVarPopupRounding StyleVarID = 8 // StyleVarPopupBorderSize is a float StyleVarPopupBorderSize StyleVarID = 9 // StyleVarFramePadding is a Vec2 StyleVarFramePadding StyleVarID = 10 // StyleVarFrameRounding is a float StyleVarFrameRounding StyleVarID = 11 // StyleVarFrameBorderSize is a float StyleVarFrameBorderSize StyleVarID = 12 // StyleVarItemSpacing is a Vec2 StyleVarItemSpacing StyleVarID = 13 // StyleVarItemInnerSpacing is a Vec2 StyleVarItemInnerSpacing StyleVarID = 14 // StyleVarIndentSpacing is a float StyleVarIndentSpacing StyleVarID = 15 // StyleVarScrollbarSize is a float StyleVarScrollbarSize StyleVarID = 16 // StyleVarScrollbarRounding is a float StyleVarScrollbarRounding StyleVarID = 17 // StyleVarGrabMinSize is a float StyleVarGrabMinSize StyleVarID = 18 // StyleVarGrabRounding is a float StyleVarGrabRounding StyleVarID = 19 // StyleVarTabRounding is a float StyleVarTabRounding StyleVarID = 20 // StyleVarButtonTextAlign is a Vec2 StyleVarButtonTextAlign StyleVarID = 21 // StyleVarSelectableTextAlign is a Vec2 StyleVarSelectableTextAlign StyleVarID = 22 )
type TextureID ¶
type TextureID uintptr
TextureID is a user data to identify a texture.
TextureID is a uintptr used to pass renderer-agnostic texture references around until it hits your render function. imgui knows nothing about what those bits represent, it just passes them around. It is up to you to decide what you want the value to carry!
It could be an identifier to your OpenGL texture (cast as uint32), a key to your custom engine material, etc. At the end of the chain, your renderer takes this value to cast it back into whatever it needs to select a current texture to render.
To display a custom image/texture within an imgui window, you may use functions such as imgui.Image(). imgui will generate the geometry and draw calls using the TextureID that you passed and which your renderer can use. It is your responsibility to get textures uploaded to your GPU.
Note: Internally, the value is based on a pointer type, so its size is dependent on your architecture. For the most part, this will be 64bits on current systems (in 2018). Beware: This value must never be a Go pointer, because the value escapes the runtime!
type Vec2 ¶
Vec2 represents a two-dimensional vector.
func CalcTextSize ¶
CalcTextSize calculates the size of the text.
func ContentRegionAvail ¶
func ContentRegionAvail() Vec2
ContentRegionAvail returns the size of the content region that is available (based on the current cursor position).
func ContentRegionMax ¶ added in v2.3.0
func ContentRegionMax() Vec2
ContentRegionMax returns current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates.
func CursorPos ¶
func CursorPos() Vec2
CursorPos returns the cursor position in window coordinates (relative to window position).
func CursorScreenPos ¶
func CursorScreenPos() Vec2
CursorScreenPos returns the cursor position in absolute screen coordinates.
func CursorStartPos ¶
func CursorStartPos() Vec2
CursorStartPos returns the initial cursor position in window coordinates.
func ItemRectMax ¶ added in v2.5.0
func ItemRectMax() Vec2
ItemRectMax returns the lower-right bounding rectangle of the last item in screen space.
func ItemRectMin ¶ added in v2.5.0
func ItemRectMin() Vec2
ItemRectMin returns the upper-left bounding rectangle of the last item in screen space.
func MousePos ¶ added in v2.2.0
func MousePos() Vec2
MousePos returns the current window position in screen space.
func WindowContentRegionMax ¶ added in v2.5.0
func WindowContentRegionMax() Vec2
WindowContentRegionMax returns the content boundaries max (roughly (0,0)+Size-Scroll) where Size can be overridden with SetNextWindowContentSize(), in window coordinates.
func WindowContentRegionMin ¶ added in v2.5.0
func WindowContentRegionMin() Vec2
WindowContentRegionMin returns the content boundaries min (roughly (0,0)-Scroll), in window coordinates.
Source Files ¶
- AllocatedGlyphRanges.go
- Assert.go
- Condition.go
- Context.go
- DragDrop.go
- DrawCommand.go
- DrawData.go
- DrawList.go
- Focus.go
- Font.go
- FontAtlas.go
- FontConfig.go
- FreeType.go
- FreeTypeDisabled.go
- GlyphRanges.go
- IO.go
- InputTextCallbackData.go
- Layout.go
- ListClipper.go
- Main.go
- PackedColor.go
- Popup.go
- Scroll.go
- State.go
- Style.go
- TextureID.go
- Vectors.go
- Widgets.go
- Window.go
- WrapperConverter.go
- doc.go
- wrapper.go