Skip to content

Dear ImGui end-user API functions#

(Note that ImGui:: being a namespace, you can add extra ImGui:: functions in your own separate file. Please don't modify imgui source files!)

Context creation and access#

.create_context(shared_font_atlas : ImFontAtlas? = nil) : ImGuiContext#

View source

.destroy_context(ctx : ImGuiContext? = nil) : Void#

View source

NULL = destroy current context

.get_current_context : ImGuiContext#

View source

.set_current_context(ctx : ImGuiContext) : Void#

View source

Main#

.get_io : ImGuiIO#

View source

access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags)

.get_style : ImGuiStyle#

View source

access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame!

.new_frame : Void#

View source

start a new Dear ImGui frame, you can submit any command from this point until ImGui.render/ImGui.end_frame.

.end_frame : Void#

View source

ends the Dear ImGui frame. automatically called by ImGui.render. If you don't need to render data (skipping rendering) you may call ImGui.end_frame without ImGui.render... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call ImGui.new_frame at all!

.render : Void#

View source

ends the Dear ImGui frame, finalize the draw data. You can then get call ImGui.get_draw_data.

.get_draw_data : ImDrawData#

View source

valid after ImGui.render and until the next call to ImGui.new_frame. this is what you have to render.

Demo, Debug, Information#

.show_demo_window(p_open : Pointer(Bool) = Pointer(Bool).null) : Void#

View source

create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!

.show_metrics_window(p_open : Pointer(Bool) = Pointer(Bool).null) : Void#

View source

create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.

.show_debug_log_window(p_open : Pointer(Bool) = Pointer(Bool).null) : Void#

View source

create Debug Log window. display a simplified log of important dear imgui events.

.show_stack_tool_window(p_open : Pointer(Bool) = Pointer(Bool).null) : Void#

View source

create Stack Tool window. hover items with mouse to query information about the source of their unique ID.

.show_about_window(p_open : Pointer(Bool) = Pointer(Bool).null) : Void#

View source

create About window. display Dear ImGui version, credits and build/system information.

.show_style_editor(ref : ImGuiStyle? = nil) : Void#

View source

add style editor block (not a window). you can pass in a reference ImGui::ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)

.show_style_selector(label : String) : Bool#

View source

add style selector block (not a window), essentially a combo listing the default styles.

.show_font_selector(label : String) : Void#

View source

add font selector block (not a window), essentially a combo listing the loaded fonts.

.show_user_guide : Void#

View source

add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).

.get_version : String#

View source

get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp)

Styles#

.style_colors_dark(dst : ImGuiStyle? = nil) : Void#

View source

new, recommended style (default)

.style_colors_light(dst : ImGuiStyle? = nil) : Void#

View source

best used with borders and a custom, thicker font

.style_colors_classic(dst : ImGuiStyle? = nil) : Void#

View source

classic imgui style

Windows#

  • ImGui.begin = push window to the stack and start appending to it. ImGui.end = pop window from the stack.
  • Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window, which clicking will set the boolean to false when clicked.
  • You may append multiple times to the same window during the same frame by calling ImGui.begin/ImGui.end pairs multiple times. Some information such as 'flags' or 'p_open' will only be considered by the first call to ImGui.begin.
  • ImGui.begin return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. Always call a matching ImGui.end for each ImGui.begin call, regardless of its return value! [Important: due to legacy reason, this is inconsistent with most other functions such as ImGui.begin_menu/ImGui.end_menu, ImGui.begin_popup/ImGui.end_popup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true. ImGui.begin and BeginChild are the only odd ones out. Will be fixed in a future update.]
  • Note that the bottom of window stack always contains a window called "Debug".

.begin(name : String, p_open : Pointer(Bool) = Pointer(Bool).null, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool#

View source

.end : Void#

View source

Child Windows#

  • Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child.
  • For each independent axis of 'size': ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. ImGui::ImVec2(0,400).
  • BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. Always call a matching ImGui.end_child for each BeginChild() call, regardless of its return value. [Important: due to legacy reason, this is inconsistent with most other functions such as ImGui.begin_menu/ImGui.end_menu, ImGui.begin_popup/ImGui.end_popup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true. ImGui.begin and BeginChild are the only odd ones out. Will be fixed in a future update.]

.begin_child(str_id : String, size : ImVec2 = ImVec2.new(0, 0), border : Bool = false, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool#

View source

.begin_child(str_id : String, size : ImVec2 = ImVec2.new(0, 0), border : Bool = false, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool#

View source

.end_child : Void#

View source

Windows Utilities#

.is_window_appearing : Bool#

View source

.is_window_collapsed : Bool#

View source

.is_window_focused(flags : ImGuiFocusedFlags = ImGuiFocusedFlags.new(0)) : Bool#

View source

is current window focused? or its root/child, depending on flags. see flags for options.

.is_window_hovered(flags : ImGuiHoveredFlags = ImGuiHoveredFlags.new(0)) : Bool#

View source

is current window 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! Please read the FAQ!

.get_window_draw_list : ImDrawList#

View source

get draw list associated to the current window, to append your own drawing primitives

.get_window_pos : ImGui::ImVec2#

View source

get current window position in screen space (useful if you want to do your own drawing via the DrawList API)

.get_window_size : ImGui::ImVec2#

View source

get current window size

.get_window_width : Float32#

View source

get current window width (shortcut for ImGui.get_window_size.x)

.get_window_height : Float32#

View source

get current window height (shortcut for ImGui.get_window_size.y)

Window manipulation#

.set_next_window_pos(pos : ImVec2, cond : ImGuiCond = ImGuiCond.new(0), pivot : ImVec2 = ImVec2.new(0, 0)) : Void#

View source

set next window position. call before ImGui.begin. use pivot=(0.5f,0.5f) to center on given point, etc.

.set_next_window_size(size : ImVec2, cond : ImGuiCond = ImGuiCond.new(0)) : Void#

View source

set next window size. set axis to 0.0f to force an auto-fit on this axis. call before ImGui.begin

.set_next_window_size_constraints(size_min : ImVec2, size_max : ImVec2, custom_callback : ImGuiSizeCallback? = nil, custom_callback_data : Pointer(Void) = Pointer(Void).null) : Void#

View source

set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints.

.set_next_window_content_size(size : ImVec2) : Void#

View source

set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before ImGui.begin

.set_next_window_collapsed(collapsed : Bool, cond : ImGuiCond = ImGuiCond.new(0)) : Void#

View source

set next window collapsed state. call before ImGui.begin

.set_next_window_focus : Void#

View source

set next window to be focused / top-most. call before ImGui.begin

.set_next_window_bg_alpha(alpha : Float32) : Void#

View source

set next window background color alpha. helper to easily override the Alpha component of ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground.

.set_window_pos(pos : ImVec2, cond : ImGuiCond = ImGuiCond.new(0)) : Void#

View source

(not recommended) set current window position - call within ImGui.begin/ImGui.end. prefer using ImGui.set_next_window_pos, as this may incur tearing and side-effects.

.set_window_size(size : ImVec2, cond : ImGuiCond = ImGuiCond.new(0)) : Void#

View source

(not recommended) set current window size - call within ImGui.begin/ImGui.end. set to ImGui::ImVec2(0, 0) to force an auto-fit. prefer using ImGui.set_next_window_size, as this may incur tearing and minor side-effects.

.set_window_collapsed(collapsed : Bool, cond : ImGuiCond = ImGuiCond.new(0)) : Void#

View source

(not recommended) set current window collapsed state. prefer using ImGui.set_next_window_collapsed.

.set_window_focus(name : String) : Void#

View source

(not recommended) set current window to be focused / top-most. prefer using ImGui.set_next_window_focus.

.set_window_font_scale(scale : Float32) : Void#

View source

[OBSOLETE] set font scale. Adjust IO.FontGlobalScale if you want to scale all windows. This is an old API! For correct scaling, prefer to reload font + rebuild ImGui::ImFontAtlas + call style.ScaleAllSizes().

.set_window_pos(pos : ImVec2, cond : ImGuiCond = ImGuiCond.new(0)) : Void#

View source

set named window position.

.set_window_size(size : ImVec2, cond : ImGuiCond = ImGuiCond.new(0)) : Void#

View source

set named window size. set axis to 0.0f to force an auto-fit on this axis.

.set_window_collapsed(collapsed : Bool, cond : ImGuiCond = ImGuiCond.new(0)) : Void#

View source

set named window collapsed state

.set_window_focus(name : String) : Void#

View source

set named window to be focused / top-most. use NULL to remove focus.

Content region#

  • Retrieve available space from a given point. ImGui.get_content_region_avail is frequently useful.
  • Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)

.get_content_region_avail : ImGui::ImVec2#

View source

== ImGui.get_content_region_max - ImGui.get_cursor_pos

.get_content_region_max : ImGui::ImVec2#

View source

current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates

.get_window_content_region_min : ImGui::ImVec2#

View source

content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates

.get_window_content_region_max : ImGui::ImVec2#

View source

content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be override with ImGui.set_next_window_content_size, in window coordinates

Windows Scrolling#

.get_scroll_x : Float32#

View source

get scrolling amount [0 .. ImGui.get_scroll_max_x]

.get_scroll_y : Float32#

View source

get scrolling amount [0 .. ImGui.get_scroll_max_y]

.set_scroll_x(scroll_x : Float32) : Void#

View source

set scrolling amount [0 .. ImGui.get_scroll_max_x]

.set_scroll_y(scroll_y : Float32) : Void#

View source

set scrolling amount [0 .. ImGui.get_scroll_max_y]

.get_scroll_max_x : Float32#

View source

get maximum scrolling amount ~~ ContentSize.x - WindowSize.x - DecorationsSize.x

.get_scroll_max_y : Float32#

View source

get maximum scrolling amount ~~ ContentSize.y - WindowSize.y - DecorationsSize.y

.set_scroll_here_x(center_x_ratio : Float32 = 0.5) : Void#

View source

adjust scrolling amount to make current cursor position visible. center_x_ratio=0.0: left, 0.5: center, 1.0: right. When using to make a "default/current item" visible, consider using ImGui.set_item_default_focus instead.

.set_scroll_here_y(center_y_ratio : Float32 = 0.5) : Void#

View source

adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using ImGui.set_item_default_focus instead.

.set_scroll_from_pos_x(local_x : Float32, center_x_ratio : Float32 = 0.5) : Void#

View source

adjust scrolling amount to make given position visible. Generally ImGui.get_cursor_start_pos + offset to compute a valid position.

.set_scroll_from_pos_y(local_y : Float32, center_y_ratio : Float32 = 0.5) : Void#

View source

adjust scrolling amount to make given position visible. Generally ImGui.get_cursor_start_pos + offset to compute a valid position.

Parameters stacks (shared)#

.push_font(font : ImFont) : Void#

View source

use NULL as a shortcut to push default font

.pop_font : Void#

View source

.push_style_color(idx : ImGuiCol, col : UInt32) : Void#

View source

modify a style color. always use this if you modify the style after ImGui.new_frame.

.push_style_color(idx : ImGuiCol, col : UInt32) : Void#

View source

.pop_style_color(count : Int32 = 1) : Void#

View source

.push_style_var(idx : ImGuiStyleVar, val : Float32) : Void#

View source

modify a style float variable. always use this if you modify the style after ImGui.new_frame.

.push_style_var(idx : ImGuiStyleVar, val : Float32) : Void#

View source

modify a style ImGui::ImVec2 variable. always use this if you modify the style after ImGui.new_frame.

.pop_style_var(count : Int32 = 1) : Void#

View source

.push_allow_keyboard_focus(allow_keyboard_focus : Bool) : Void#

View source

== tab stop enable. Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets

.pop_allow_keyboard_focus : Void#

View source

.push_button_repeat(repeat : Bool) : Void#

View source

in 'repeat' mode, ImGui.button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call ImGui.is_item_active after any ImGui.button to tell if the button is held in the current frame.

.pop_button_repeat : Void#

View source

Parameters stacks (current window)#

.push_item_width(item_width : Float32) : Void#

View source

push width of items for common large "item+label" widgets. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side).

.pop_item_width : Void#

View source

.set_next_item_width(item_width : Float32) : Void#

View source

set width of the next common large "item+label" widget. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side)

.calc_item_width : Float32#

View source

width of item given pushed settings and current cursor position. NOT necessarily the width of last item unlike most 'Item' functions.

.push_text_wrap_pos(wrap_local_pos_x : Float32 = 0.0) : Void#

View source

push word-wrapping position for ImGui.text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space

.pop_text_wrap_pos : Void#

View source

Style read access#

.get_font : ImFont#

View source

get current font

.get_font_size : Float32#

View source

get current font size (= height in pixels) of current font with current scale applied

.get_font_tex_uv_white_pixel : ImGui::ImVec2#

View source

get UV coordinate for a while pixel, useful to draw custom shapes via the ImGui::ImDrawList API

.get_color_u32(idx : ImGuiCol, alpha_mul : Float32 = 1.0) : UInt32#

View source

retrieve given style color with style alpha applied and optional extra alpha multiplier, packed as a 32-bit value suitable for ImGui::ImDrawList

.get_color_u32(idx : ImGuiCol, alpha_mul : Float32 = 1.0) : UInt32#

View source

retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImGui::ImDrawList

.get_color_u32(idx : ImGuiCol, alpha_mul : Float32 = 1.0) : UInt32#

View source

retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImGui::ImDrawList

.get_style_color_vec4(idx : ImGuiCol) : ImVec4#

View source

retrieve style color as stored in ImGui::ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in.

Cursor / Layout#

.separator : Void#

View source

separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator.

.same_line(offset_from_start_x : Float32 = 0.0, spacing : Float32 = -1.0) : Void#

View source

call between widgets or groups to layout them horizontally. X position given in window coordinates.

.new_line : Void#

View source

undo a ImGui.same_line or force a new line when in an horizontal-layout context.

.spacing : Void#

View source

add vertical spacing.

.dummy(size : ImVec2) : Void#

View source

add a dummy item of given size. unlike ImGui.invisible_button, ImGui.dummy won't take the mouse click or be navigable into.

.indent(indent_w : Float32 = 0.0) : Void#

View source

move content position toward the right, by indent_w, or style.IndentSpacing if indent_w <= 0

.unindent(indent_w : Float32 = 0.0) : Void#

View source

move content position back to the left, by indent_w, or style.IndentSpacing if indent_w <= 0

.begin_group : Void#

View source

lock horizontal starting position

.end_group : Void#

View source

unlock horizontal starting position + capture the whole group bounding box into one "item" (so you can use ImGui.is_item_hovered or layout primitives such as ImGui.same_line on whole group, etc.)

.get_cursor_pos : ImGui::ImVec2#

View source

cursor position in window coordinates (relative to window position)

.get_cursor_pos_x : Float32#

View source

(some functions are using window-relative coordinates, such as: ImGui.get_cursor_pos, ImGui.get_cursor_start_pos, ImGui.get_content_region_max, GetWindowContentRegion* etc.

.get_cursor_pos_y : Float32#

View source
other functions such as [`ImGui.get_cursor_screen_pos`][] or everything in [`ImGui::ImDrawList`][]::

.set_cursor_pos(local_pos : ImVec2) : Void#

View source
are using the main, absolute coordinate system.

.set_cursor_pos_x(local_x : Float32) : Void#

View source
[`ImGui.get_window_pos`][] + [`ImGui.get_cursor_pos`][] == [`ImGui.get_cursor_screen_pos`][] etc.)

.set_cursor_pos_y(local_y : Float32) : Void#

View source

.get_cursor_start_pos : ImGui::ImVec2#

View source

initial cursor position in window coordinates

.get_cursor_screen_pos : ImGui::ImVec2#

View source

cursor position in absolute coordinates (useful to work with ImGui::ImDrawList API). generally top-left == ImGui.get_main_viewport->Pos == (0,0) in single viewport mode, and bottom-right == ImGui.get_main_viewport->Pos+Size == io.DisplaySize in single-viewport mode.

.set_cursor_screen_pos(pos : ImVec2) : Void#

View source

cursor position in absolute coordinates

.align_text_to_frame_padding : Void#

View source

vertically align 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)

.get_text_line_height : Float32#

View source

~ FontSize

.get_text_line_height_with_spacing : Float32#

View source

~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text)

.get_frame_height : Float32#

View source

~ FontSize + style.FramePadding.y * 2

.get_frame_height_with_spacing : Float32#

View source

~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets)

ID stack/scopes#

Read the FAQ (docs/FAQ.md or http://dearimgui.org/faq) for more details about how ID are handled in dear imgui.

  • Those questions are answered and impacted by understanding of the ID stack system:
    • "Q: Why is my widget not reacting when I click on it?"
    • "Q: How can I have widgets with an empty label?"
    • "Q: How can I have multiple widgets with the same label?"
  • Short version: ID are hashes of the entire ID stack. If you are creating widgets in a loop you most likely want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them.
  • You can also use the "Label##foobar" syntax within widget label to distinguish them from each others.
  • In this header file we use the "label"/"name" terminology to denote a string that will be displayed + used as an ID, whereas "str_id" denote a string that is only used as an ID and not normally displayed.

.push_id(str_id : String) : Void#

View source

push string into the ID stack (will hash string).

.push_id(str_id : String) : Void#

View source

push string into the ID stack (will hash string).

.push_id(str_id : String) : Void#

View source

push pointer into the ID stack (will hash pointer).

.push_id(str_id : String) : Void#

View source

push integer into the ID stack (will hash integer).

.pop_id : Void#

View source

pop from the ID stack.

.get_id(str_id : String) : ImGuiID#

View source

calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGui::ImGuiStorage yourself

.get_id(str_id : String) : ImGuiID#

View source

.get_id(str_id : String) : ImGuiID#

View source

Widgets: ImGui.text#

.text_unformatted(text : Bytes | String) : Void#

View source

raw text without formatting. Roughly equivalent to ImGui.text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text.

.text(fmt : String, *args) : Void#

View source

formatted text

.text_colored(col : ImVec4, fmt : String, *args) : Void#

View source

shortcut for PushStyleColor(ImGuiCol_Text, col); ImGui.text(fmt, ...); ImGui.pop_style_color;

.text_disabled(fmt : String, *args) : Void#

View source

shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); ImGui.text(fmt, ...); ImGui.pop_style_color;

.text_wrapped(fmt : String, *args) : Void#

View source

shortcut for ImGui.push_text_wrap_pos(0.0f); ImGui.text(fmt, ...); ImGui.pop_text_wrap_pos;. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using ImGui.set_next_window_size.

.label_text(label : String, fmt : String, *args) : Void#

View source

display text+label aligned the same way as value+label widgets

.bullet_text(fmt : String, *args) : Void#

View source

shortcut for ImGui.bullet+ImGui.text

Widgets: Main#

  • Most widgets return true when the value has been changed or when pressed/selected
  • You may also use one of the many IsItemXXX functions (e.g. ImGui.is_item_active, ImGui.is_item_hovered, etc.) to query widget state.

.button(label : String, size : ImVec2 = ImVec2.new(0, 0)) : Bool#

View source

button

.small_button(label : String) : Bool#

View source

button with FramePadding=(0,0) to easily embed within text

.invisible_button(str_id : String, size : ImVec2, flags : ImGuiButtonFlags = ImGuiButtonFlags.new(0)) : Bool#

View source

flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with ImGui.is_item_active, ImGui.is_item_hovered, etc.)

.arrow_button(str_id : String, dir : ImGuiDir) : Bool#

View source

square button with an arrow shape

.image(user_texture_id : ImTextureID, size : ImVec2, uv0 : ImVec2 = ImVec2.new(0, 0), uv1 : ImVec2 = ImVec2.new(1, 1), tint_col : ImVec4 = ImVec4.new(1, 1, 1, 1), border_col : ImVec4 = ImVec4.new(0, 0, 0, 0)) : Void#

View source

.image_button(user_texture_id : ImTextureID, size : ImVec2, uv0 : ImVec2 = ImVec2.new(0, 0), uv1 : ImVec2 = ImVec2.new(1, 1), frame_padding : Int32 = -1, bg_col : ImVec4 = ImVec4.new(0, 0, 0, 0), tint_col : ImVec4 = ImVec4.new(1, 1, 1, 1)) : Bool#

View source

<0 frame_padding uses default frame padding settings. 0 for no padding

.checkbox(label : String, v : Pointer(Bool)) : Bool#

View source

.checkbox_flags(label : String, flags : Pointer(Int32), flags_value : Int32) : Bool#

View source

.checkbox_flags(label : String, flags : Pointer(Int32), flags_value : Int32) : Bool#

View source

.radio_button(label : String, v : Pointer(Int32), v_button : Int32) : Bool#

View source

use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; }

.radio_button(label : String, v : Pointer(Int32), v_button : Int32) : Bool#

View source

shortcut to handle the above pattern when value is an integer

.progress_bar(fraction : Float32, size_arg : ImVec2 = ImVec2.new(-Float32::MIN_POSITIVE, 0), overlay : String? = nil) : Void#

View source

.bullet : Void#

View source

draw a small circle + keep the cursor on the same line. advance cursor x position by ImGui.get_tree_node_to_label_spacing, same distance that TreeNode() uses

Widgets: Combo Box#

  • The ImGui.begin_combo/ImGui.end_combo api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items.
  • The old Combo() api are helpers over ImGui.begin_combo/ImGui.end_combo which are kept available for convenience purpose. This is analogous to how ListBox are created.

.begin_combo(label : String, preview_value : String, flags : ImGuiComboFlags = ImGuiComboFlags.new(0)) : Bool#

View source

.end_combo : Void#

View source

only call ImGui.end_combo if ImGui.begin_combo returns true!

.combo(label : String, preview_value : String, flags : ImGuiComboFlags = ImGuiComboFlags.new(0), &) : Nil#

Calls begin_combo, conditionally yields to the block, then conditionally calls end_combo.

View source

.combo(label : String, preview_value : String, flags : ImGuiComboFlags = ImGuiComboFlags.new(0), &) : Nil#

Calls begin_combo, conditionally yields to the block, then conditionally calls end_combo.

View source

Separate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Three\0"

.combo(label : String, preview_value : String, flags : ImGuiComboFlags = ImGuiComboFlags.new(0), &) : Nil#

Calls begin_combo, conditionally yields to the block, then conditionally calls end_combo.

View source

Widgets: Drag Sliders#

  • CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
  • For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
  • Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
  • Format string may also be set to NULL or use the default format ("%f" or "%d").
  • Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
  • Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not used.
  • Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
  • We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
  • Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final float power=1.0f' argument instead of theImGui::ImGuiSliderFlags flags=0' argument. If you get a warning converting a float to ImGui::ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361

.drag_float(label : String, v : Pointer(Float32), v_speed : Float32 = 1.0, v_min : Float32 = 0.0, v_max : Float32 = 0.0, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

If v_min >= v_max we have no bound

.drag_float2(label : String, v : Pointer(ImVec2) | Indexable(Float32) | Pointer(Float32), v_speed : Float32 = 1.0, v_min : Float32 = 0.0, v_max : Float32 = 0.0, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.drag_float3(label : String, v : Indexable(Float32) | Pointer(Float32), v_speed : Float32 = 1.0, v_min : Float32 = 0.0, v_max : Float32 = 0.0, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.drag_float4(label : String, v : Pointer(ImVec4) | Indexable(Float32) | Pointer(Float32), v_speed : Float32 = 1.0, v_min : Float32 = 0.0, v_max : Float32 = 0.0, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.drag_float_range2(label : String, v_current_min : Pointer(Float32), v_current_max : Pointer(Float32), v_speed : Float32 = 1.0, v_min : Float32 = 0.0, v_max : Float32 = 0.0, format : String = "%.3f", format_max : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.drag_int(label : String, v : Pointer(Int32), v_speed : Float32 = 1.0, v_min : Int32 = 0, v_max : Int32 = 0, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

If v_min >= v_max we have no bound

.drag_int2(label : String, v : Indexable(Int32) | Pointer(Int32), v_speed : Float32 = 1.0, v_min : Int32 = 0, v_max : Int32 = 0, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.drag_int3(label : String, v : Indexable(Int32) | Pointer(Int32), v_speed : Float32 = 1.0, v_min : Int32 = 0, v_max : Int32 = 0, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.drag_int4(label : String, v : Indexable(Int32) | Pointer(Int32), v_speed : Float32 = 1.0, v_min : Int32 = 0, v_max : Int32 = 0, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.drag_int_range2(label : String, v_current_min : Pointer(Int32), v_current_max : Pointer(Int32), v_speed : Float32 = 1.0, v_min : Int32 = 0, v_max : Int32 = 0, format : String = "%d", format_max : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.drag_scalar(label : String, p_data : Pointer(Int8), v_speed : Float32 = 1.0, p_min : Int8? = nil, p_max : Int8? = nil, format : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

.drag_scalar_n(label : String, p_data : Pointer(Int8), components : Int32, v_speed : Float32 = 1.0, p_min : Pointer(Int8) = Pointer(Int8).null, p_max : Pointer(Int8) = Pointer(Int8).null, format : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

Widgets: Regular Sliders#

  • CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
  • Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
  • Format string may also be set to NULL or use the default format ("%f" or "%d").
  • Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final float power=1.0f' argument instead of theImGui::ImGuiSliderFlags flags=0' argument. If you get a warning converting a float to ImGui::ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361

.slider_float(label : String, v : Pointer(Float32), v_min : Float32, v_max : Float32, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display.

.slider_float2(label : String, v : Pointer(ImVec2) | Indexable(Float32) | Pointer(Float32), v_min : Float32, v_max : Float32, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.slider_float3(label : String, v : Indexable(Float32) | Pointer(Float32), v_min : Float32, v_max : Float32, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.slider_float4(label : String, v : Pointer(ImVec4) | Indexable(Float32) | Pointer(Float32), v_min : Float32, v_max : Float32, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.slider_angle(label : String, v_rad : Pointer(Float32), v_degrees_min : Float32 = -360.0, v_degrees_max : Float32 = +360.0, format : String = "%.0 deg", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.slider_int(label : String, v : Pointer(Int32), v_min : Int32, v_max : Int32, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.slider_int2(label : String, v : Indexable(Int32) | Pointer(Int32), v_min : Int32, v_max : Int32, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.slider_int3(label : String, v : Indexable(Int32) | Pointer(Int32), v_min : Int32, v_max : Int32, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.slider_int4(label : String, v : Indexable(Int32) | Pointer(Int32), v_min : Int32, v_max : Int32, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.slider_scalar(label : String, p_data : Pointer(Int8), p_min : Int8, p_max : Int8, format : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

.slider_scalar_n(label : String, p_data : Pointer(Int8), components : Int32, p_min : Pointer(Int8), p_max : Pointer(Int8), format : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

.v_slider_float(label : String, size : ImVec2, v : Pointer(Float32), v_min : Float32, v_max : Float32, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.v_slider_int(label : String, size : ImVec2, v : Pointer(Int32), v_min : Int32, v_max : Int32, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

View source

.v_slider_scalar(label : String, size : ImVec2, p_data : Pointer(Int8), p_min : Int8, p_max : Int8, format : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool#

Widgets: Input with Keyboard#

.input_text(label : String, buf : Bytes, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0), callback : ImGuiInputTextCallback? = nil, user_data : Pointer(Void) = Pointer(Void).null) : Bool#

View source

.input_text_multiline(label : String, buf : Bytes, size : ImVec2 = ImVec2.new(0, 0), flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0), callback : ImGuiInputTextCallback? = nil, user_data : Pointer(Void) = Pointer(Void).null) : Bool#

View source

.input_text_with_hint(label : String, hint : String, buf : Bytes, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0), callback : ImGuiInputTextCallback? = nil, user_data : Pointer(Void) = Pointer(Void).null) : Bool#

View source

.input_float(label : String, v : Pointer(Float32), step : Float32 = 0.0, step_fast : Float32 = 0.0, format : String = "%.3f", flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

View source

.input_float2(label : String, v : Pointer(ImVec2) | Indexable(Float32) | Pointer(Float32), format : String = "%.3f", flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

View source

.input_float3(label : String, v : Indexable(Float32) | Pointer(Float32), format : String = "%.3f", flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

View source

.input_float4(label : String, v : Pointer(ImVec4) | Indexable(Float32) | Pointer(Float32), format : String = "%.3f", flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

View source

.input_int(label : String, v : Pointer(Int32), step : Int32 = 1, step_fast : Int32 = 100, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

View source

.input_int2(label : String, v : Indexable(Int32) | Pointer(Int32), flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

View source

.input_int3(label : String, v : Indexable(Int32) | Pointer(Int32), flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

View source

.input_int4(label : String, v : Indexable(Int32) | Pointer(Int32), flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

View source

.input_double(label : String, v : Pointer(Float64), step : Float64 = 0.0, step_fast : Float64 = 0.0, format : String = "%.6f", flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

View source

.input_scalar(label : String, p_data : Pointer(Int8), p_step : Int8? = nil, p_step_fast : Int8? = nil, format : String? = nil, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

.input_scalar_n(label : String, p_data : Pointer(Int8), components : Int32, p_step : Pointer(Int8) = Pointer(Int8).null, p_step_fast : Pointer(Int8) = Pointer(Int8).null, format : String? = nil, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool#

Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu.)

  • Note that in C++ a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible.
  • You can pass the address of a first float element out of a contiguous structure, e.g. &myvector.x

.color_edit3(label : String, col : Pointer(ImVec4) | Indexable(Float32) | Pointer(Float32), flags : ImGuiColorEditFlags = ImGuiColorEditFlags.new(0)) : Bool#

View source

.color_edit4(label : String, col : Pointer(ImVec4) | Indexable(Float32) | Pointer(Float32), flags : ImGuiColorEditFlags = ImGuiColorEditFlags.new(0)) : Bool#

View source

.color_picker3(label : String, col : Pointer(ImVec4) | Indexable(Float32) | Pointer(Float32), flags : ImGuiColorEditFlags = ImGuiColorEditFlags.new(0)) : Bool#

View source

.color_picker4(label : String, col : Pointer(ImVec4) | Indexable(Float32) | Pointer(Float32), flags : ImGuiColorEditFlags = ImGuiColorEditFlags.new(0), ref_col : Pointer(Float32) = Pointer(Float32).null) : Bool#

View source

.color_button(desc_id : String, col : ImVec4, flags : ImGuiColorEditFlags = ImGuiColorEditFlags.new(0), size : ImVec2 = ImVec2.new(0, 0)) : Bool#

View source

display a color square/button, hover for details, return true when pressed.

.set_color_edit_options(flags : ImGuiColorEditFlags) : Void#

View source

initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls.

Widgets: Trees#

  • TreeNode functions return true when the node is open, in which case you need to also call ImGui.tree_pop when you are finished displaying the tree node contents.

.tree_node(str_id : String, fmt : String, *args) : Bool#

View source

.tree_node(str_id : String, fmt : String, *args) : Bool#

View source

helper variation to easily decorelate the id from the displayed string. Read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use ImGui.bullet.

.tree_node(str_id : String, fmt : String, *args) : Bool#

View source

"

.tree_node_ex(str_id : String, flags : ImGuiTreeNodeFlags, fmt : String, *args) : Bool#

View source

.tree_node_ex(str_id : String, flags : ImGuiTreeNodeFlags, fmt : String, *args) : Bool#

View source

.tree_node_ex(str_id : String, flags : ImGuiTreeNodeFlags, fmt : String, *args) : Bool#

View source

.tree_push(str_id : String) : Void#

View source

~ ImGui.indent+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/ImGui.tree_pop yourself if desired.

.tree_push(str_id : String) : Void#

View source

"

.tree_pop : Void#

View source

~ ImGui.unindent+PopId()

.get_tree_node_to_label_spacing : Float32#

View source

horizontal distance preceding label when using TreeNode() or ImGui.bullet == (g.FontSize + style.FramePadding.x2) for a regular unframed TreeNode

.collapsing_header(label : String, flags : ImGuiTreeNodeFlags = ImGuiTreeNodeFlags.new(0)) : Bool#

View source

if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call ImGui.tree_pop.

.collapsing_header(label : String, flags : ImGuiTreeNodeFlags = ImGuiTreeNodeFlags.new(0)) : Bool#

View source

when 'p_visible != NULL': if 'p_visible==true' display an additional small close button on upper right of the header which will set the bool to false when clicked, if 'p_visible==false' don't display the header.

.set_next_item_open(is_open : Bool, cond : ImGuiCond = ImGuiCond.new(0)) : Void#

View source

set next TreeNode/CollapsingHeader open state.

Widgets: Selectables#

  • A selectable highlights when hovered, and can display another color when selected.
  • Neighbors selectable extend their highlight bounds in order to leave no gap between them. This is so a series of selected Selectable appear contiguous.

.selectable(label : String, selected : Bool = false, flags : ImGuiSelectableFlags = ImGuiSelectableFlags.new(0), size : ImVec2 = ImVec2.new(0, 0)) : Bool#

View source

"bool selected" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. 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

.selectable(label : String, selected : Bool = false, flags : ImGuiSelectableFlags = ImGuiSelectableFlags.new(0), size : ImVec2 = ImVec2.new(0, 0)) : Bool#

View source

"bool* p_selected" point to the selection state (read-write), as a convenient helper.

Widgets: List Boxes#

  • This is essentially a thin wrapper to using BeginChild/ImGui.end_child with some stylistic changes.
  • The ImGui.begin_list_box/ImGui.end_list_box api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() or any items.
  • The simplified/old ListBox() api are helpers over ImGui.begin_list_box/ImGui.end_list_box which are kept available for convenience purpose. This is analoguous to how Combos are created.
  • Choose frame width: size.x > 0.0f: custom / size.x < 0.0f or -FLT_MIN: right-align / size.x = 0.0f (default): use current ItemWidth
  • Choose frame height: size.y > 0.0f: custom / size.y < 0.0f or -FLT_MIN: bottom-align / size.y = 0.0f (default): arbitrary default height which can fit ~7 items

.begin_list_box(label : String, size : ImVec2 = ImVec2.new(0, 0)) : Bool#

View source

open a framed scrolling region

.end_list_box : Void#

View source

only call ImGui.end_list_box if ImGui.begin_list_box returned true!

.list_box(label : String, current_item : Pointer(Int32) | Pointer, items_count : Int32, height_in_items : Int32 = -1, &block : Int32 -> Slice(UInt8) | String | Nil) : Bool#

.list_box(label : String, current_item : Pointer(Int32) | Pointer, items_count : Int32, height_in_items : Int32 = -1, &block : Int32 -> Slice(UInt8) | String | Nil) : Bool#

Widgets: Data Plotting#

.plot_lines(label : String, values : Indexable(Float32), values_offset : Int32 = 0, overlay_text : String? = nil, scale_min : Float32 = Float32::MAX, scale_max : Float32 = Float32::MAX, graph_size : ImVec2 = ImVec2.new(0, 0), stride : Int32 = sizeof(Float32)) : Void#

View source

.plot_lines(label : String, values : Indexable(Float32), values_offset : Int32 = 0, overlay_text : String? = nil, scale_min : Float32 = Float32::MAX, scale_max : Float32 = Float32::MAX, graph_size : ImVec2 = ImVec2.new(0, 0), stride : Int32 = sizeof(Float32)) : Void#

View source

.plot_histogram(label : String, values : Indexable(Float32), values_offset : Int32 = 0, overlay_text : String? = nil, scale_min : Float32 = Float32::MAX, scale_max : Float32 = Float32::MAX, graph_size : ImVec2 = ImVec2.new(0, 0), stride : Int32 = sizeof(Float32)) : Void#

View source

.plot_histogram(label : String, values : Indexable(Float32), values_offset : Int32 = 0, overlay_text : String? = nil, scale_min : Float32 = Float32::MAX, scale_max : Float32 = Float32::MAX, graph_size : ImVec2 = ImVec2.new(0, 0), stride : Int32 = sizeof(Float32)) : Void#

View source

Widgets: Value() Helpers.

  • Those are merely shortcut to calling ImGui.text with a format string. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace)

.value(prefix : String, b : Bool) : Void#

View source

.value(prefix : String, b : Bool) : Void#

View source

.value(prefix : String, b : Bool) : Void#

View source

.value(prefix : String, b : Bool) : Void#

View source

Widgets: Menus#

  • Use ImGui.begin_menu_bar on a window ImGuiWindowFlags_MenuBar to append to its menu bar.
  • Use ImGui.begin_main_menu_bar to create a menu bar at the top of the screen and append to it.
  • Use ImGui.begin_menu to create a menu. You can call ImGui.begin_menu multiple time with the same identifier to append more items to it.
  • Not that MenuItem() keyboardshortcuts are displayed as a convenience but not processed by Dear ImGui at the moment.

.begin_menu_bar : Bool#

View source

append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window).

.end_menu_bar : Void#

View source

only call ImGui.end_menu_bar if ImGui.begin_menu_bar returns true!

.begin_main_menu_bar : Bool#

View source

create and append to a full screen menu-bar.

.end_main_menu_bar : Void#

View source

only call ImGui.end_main_menu_bar if ImGui.begin_main_menu_bar returns true!

.begin_menu(label : String, enabled : Bool = true) : Bool#

View source

create a sub-menu entry. only call ImGui.end_menu if this returns true!

.end_menu : Void#

View source

only call ImGui.end_menu if ImGui.begin_menu returns true!

.menu_item(label : String, shortcut : String? = nil, selected : Bool = false, enabled : Bool = true) : Bool#

View source

return true when activated.

.menu_item(label : String, shortcut : String? = nil, selected : Bool = false, enabled : Bool = true) : Bool#

View source

return true when activated + toggle (*p_selected) if p_selected != NULL

Tooltips#

  • Tooltip are windows following the mouse. They do not take focus away.

.begin_tooltip : Void#

View source

begin/append a tooltip window. to create full-featured tooltip (with any kind of items).

.end_tooltip : Void#

View source

.set_tooltip(fmt : String, *args) : Void#

View source

set a text-only tooltip, typically use with ImGui.is_item_hovered. override any previous call to ImGui.set_tooltip.

Popups, Modals#

  • They block normal mouse hovering detection (and therefore most mouse interactions) behind them.
  • If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE.
  • Their visibility state (~bool) is held internally instead of being held by the programmer as we are used to with regular ImGui.begin*() calls.
  • The 3 properties above are related: we need to retain popup visibility state in the library because popups may be closed as any time.
  • You can bypass the hovering restriction by using ImGuiHoveredFlags_AllowWhenBlockedByPopup when calling ImGui.is_item_hovered or ImGui.is_window_hovered.
  • Important

    Popup identifiers are relative to the current ID stack, so OpenPopup and ImGui.begin_popup generally needs to be at the same level of the stack. This is sometimes leading to confusing mistakes. May rework this in the future.

Popups: begin/end functions#

.begin_popup(str_id : String, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool#

View source

return true if the popup is open, and you can start outputting to it.

.begin_popup_modal(name : String, p_open : Pointer(Bool) = Pointer(Bool).null, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool#

View source

return true if the modal is open, and you can start outputting to it.

.end_popup : Void#

View source

only call ImGui.end_popup if BeginPopupXXX() returns true!

Popups: open/close functions#

  • OpenPopup(): set popup state to open. ImGui::ImGuiPopupFlags are available for opening options.
  • If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE.
  • ImGui.close_current_popup: use inside the ImGui.begin_popup/ImGui.end_popup scope to close manually.
  • ImGui.close_current_popup is called by default by Selectable()/MenuItem() when activated (FIXME: need some options).
  • Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup if there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup().
  • Use ImGui.is_window_appearing after ImGui.begin_popup to tell if a window just opened.
  • Important

    Notice that for ImGui.open_popup_on_item_click we exceptionally default flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter

.open_popup(str_id : String, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(0)) : Void#

View source

call to mark popup as open (don't call every frame!).

.open_popup(str_id : String, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(0)) : Void#

View source

id overload to facilitate calling from nested stacks

.open_popup_on_item_click(str_id : String? = nil, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(1)) : Void#

View source

helper to open popup when clicked on last item. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse released event to be consistent with popup behaviors)

.close_current_popup : Void#

View source

manually close the popup we have begin-ed into.

Popups: open+begin combined functions helpers#

  • Helpers to do OpenPopup+ImGui.begin_popup where the Open action is triggered by e.g. hovering an item and right-clicking.
  • They are convenient to easily create context menus, hence the name.
  • Important

    Notice that BeginPopupContextXXX takes ImGui::ImGuiPopupFlags just like OpenPopup() and unlike ImGui.begin_popup. For full consistency, we may add ImGui::ImGuiWindowFlags to the BeginPopupContextXXX functions in the future.

  • Important

    Notice that we exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter, so if you add other flags remember to re-add the ImGuiPopupFlags_MouseButtonRight.

.begin_popup_context_item(str_id : String? = nil, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(1)) : Bool#

View source

open+begin popup when clicked on last item. Use str_id==NULL to associate the popup to previous item. If you want to use that on a non-interactive item such as ImGui.text you need to pass in an explicit ID here. read comments in .cpp!

.begin_popup_context_window(str_id : String? = nil, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(1)) : Bool#

View source

.begin_popup_context_void(str_id : String? = nil, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(1)) : Bool#

View source

open+begin popup when clicked in void (where there are no windows).

Popups: query functions#

  • IsPopupOpen(): return true if the popup is open at the current ImGui.begin_popup level of the popup stack.
  • IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popup is open at the current ImGui.begin_popup level of the popup stack.
  • IsPopupOpen() with ImGuiPopupFlags_AnyPopupId + ImGuiPopupFlags_AnyPopupLevel: return true if any popup is open.

.is_popup_open(str_id : String, flags : ImGuiPopupFlags = ImGuiPopupFlags.new(0)) : Bool#

View source

return true if the popup is open.

Tables#

The typical call flow is:

.begin_table(str_id : String, column : Int32, flags : ImGuiTableFlags = ImGuiTableFlags.new(0), outer_size : ImVec2 = ImVec2.new(0.0, 0.0), inner_width : Float32 = 0.0) : Bool#

View source

.end_table : Void#

View source

only call ImGui.end_table if ImGui.begin_table returns true!

.table_next_row(row_flags : ImGuiTableRowFlags = ImGuiTableRowFlags.new(0), min_row_height : Float32 = 0.0) : Void#

View source

append into the first cell of a new row.

.table_next_column : Bool#

View source

append into the next column (or first column of next row if currently in last column). Return true when column is visible.

.table_set_column_index(column_n : Int32) : Bool#

View source

append into the specified column. Return true when column is visible.

Tables: Headers & ImGui.columns declaration#

  • Use ImGui.table_setup_column to specify label, resizing policy, default width/weight, id, various other flags etc.
  • Use ImGui.table_headers_row to create a header row and automatically submit a ImGui.table_header for each column. Headers are required to perform: reordering, sorting, and opening the context menu. The context menu can also be made available in columns body using ImGuiTableFlags_ContextMenuInBody.
  • You may manually submit headers using ImGui.table_next_row + ImGui.table_header calls, but this is only useful in some advanced use cases (e.g. adding custom widgets in header row).
  • Use ImGui.table_setup_scroll_freeze to lock columns/rows so they stay visible when scrolled.

.table_setup_column(label : String, flags : ImGuiTableColumnFlags = ImGuiTableColumnFlags.new(0), init_width_or_weight : Float32 = 0.0, user_id : ImGuiID = 0) : Void#

View source

.table_setup_scroll_freeze(cols : Int32, rows : Int32) : Void#

View source

lock columns/rows so they stay visible when scrolled.

.table_headers_row : Void#

View source

submit all headers cells based on data provided to ImGui.table_setup_column + submit context menu

.table_header(label : String) : Void#

View source

submit one header cell manually (rarely used)

Tables: Sorting & Miscellaneous functions#

  • Sorting: call ImGui.table_get_sort_specs to retrieve latest sort specs for the table. NULL when not sorting. When 'sort_specs->SpecsDirty == true' you should sort your data. It will be true when sorting specs have changed since last call, or the first time. Make sure to set 'SpecsDirty = false' after sorting, else you may wastefully sort your data every frame!
  • Functions args 'int column_n' treat the default value of -1 as the same as passing the current column index.

.table_get_sort_specs : ImGuiTableSortSpecs | ::Nil#

View source

get latest sort specs for the table (NULL if not sorting). Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to ImGui.begin_table.

.table_get_column_count : Int32#

View source

return number of columns (value passed to ImGui.begin_table)

.table_get_column_index : Int32#

View source

return current column index.

.table_get_row_index : Int32#

View source

return current row index.

.table_get_column_name(column_n : Int32 = -1) : String#

View source

return "" if column didn't have a name declared by ImGui.table_setup_column. Pass -1 to use current column.

.table_get_column_flags(column_n : Int32 = -1) : ImGuiTableColumnFlags#

View source

return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column.

.table_set_column_enabled(column_n : Int32, v : Bool) : Void#

View source

.table_set_bg_color(target : ImGuiTableBgTarget, color : UInt32, column_n : Int32 = -1) : Void#

View source

change the color of a cell, row, or column. See ImGui::ImGuiTableBgTarget flags for details.

Legacy ImGui.columns API (prefer using Tables!)#

.columns(count : Int32 = 1, id : String? = nil, border : Bool = true) : Void#

View source

.next_column : Void#

View source

next column, defaults to current row or next row if the current row is finished

.get_column_index : Int32#

View source

get current column index

.get_column_width(column_index : Int32 = -1) : Float32#

View source

get column width (in pixels). pass -1 to use current column

.set_column_width(column_index : Int32, width : Float32) : Void#

View source

set column width (in pixels). pass -1 to use current column

.get_column_offset(column_index : Int32 = -1) : Float32#

View source

get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..ImGui.get_columns_count inclusive. column 0 is typically 0.0f

.set_column_offset(column_index : Int32, offset_x : Float32) : Void#

View source

set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column

.get_columns_count : Int32#

View source

Tab Bars, Tabs#

.begin_tab_bar(str_id : String, flags : ImGuiTabBarFlags = ImGuiTabBarFlags.new(0)) : Bool#

View source

create and append into a TabBar

.end_tab_bar : Void#

View source

only call ImGui.end_tab_bar if ImGui.begin_tab_bar returns true!

.begin_tab_item(label : String, p_open : Pointer(Bool) = Pointer(Bool).null, flags : ImGuiTabItemFlags = ImGuiTabItemFlags.new(0)) : Bool#

View source

create a Tab. Returns true if the Tab is selected.

.end_tab_item : Void#

View source

only call ImGui.end_tab_item if ImGui.begin_tab_item returns true!

.tab_item_button(label : String, flags : ImGuiTabItemFlags = ImGuiTabItemFlags.new(0)) : Bool#

View source

create a Tab behaving like a button. return true when clicked. cannot be selected in the tab bar.

.set_tab_item_closed(tab_or_docked_window_label : String) : Void#

View source

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 ImGui.begin_tab_bar and before Tab submissions. Otherwise call with a window name.

Logging/Capture#

  • All text output from the interface can be captured into tty/file/clipboard. By default, tree nodes are automatically opened during logging.

.log_to_tty(auto_open_depth : Int32 = -1) : Void#

View source

start logging to tty (stdout)

.log_to_file(auto_open_depth : Int32 = -1, filename : String? = nil) : Void#

View source

start logging to file

.log_to_clipboard(auto_open_depth : Int32 = -1) : Void#

View source

start logging to OS clipboard

.log_finish : Void#

View source

stop logging (close file, etc.)

.log_buttons : Void#

View source

helper to display buttons for logging to tty/file/clipboard

.log_text(fmt : String, *args) : Void#

View source

pass text data straight to log (without being displayed)

Drag and Drop#

.begin_drag_drop_source(flags : ImGuiDragDropFlags = ImGuiDragDropFlags.new(0)) : Bool#

View source

call after submitting an item which may be dragged. when this return true, you can call ImGui.set_drag_drop_payload + ImGui.end_drag_drop_source

.set_drag_drop_payload(type : String, data : Pointer(Void), sz : LibC::SizeT, cond : ImGuiCond = ImGuiCond.new(0)) : Bool#

View source

type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui. Return true when payload has been accepted.

.end_drag_drop_source : Void#

View source

only call ImGui.end_drag_drop_source if ImGui.begin_drag_drop_source returns true!

.begin_drag_drop_target : Bool#

View source

call after submitting an item that may receive a payload. If this returns true, you can call ImGui.accept_drag_drop_payload + ImGui.end_drag_drop_target

.accept_drag_drop_payload(type : String, flags : ImGuiDragDropFlags = ImGuiDragDropFlags.new(0)) : ImGuiPayload?#

View source

accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.

.end_drag_drop_target : Void#

View source

only call ImGui.end_drag_drop_target if ImGui.begin_drag_drop_target returns true!

.get_drag_drop_payload : ImGuiPayload | ::Nil#

View source

peek directly into the current payload from anywhere. may return NULL. use ImGui::ImGuiPayload::IsDataType() to test for the payload type.

Disabling [BETA API]#

  • Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors)
  • Those can be nested but it cannot be used to enable an already disabled section (a single ImGui.begin_disabled(true) in the stack is enough to keep everything disabled)
  • ImGui.begin_disabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling ImGui.begin_disabled(False)/ImGui.end_disabled best to avoid it.

.begin_disabled(disabled : Bool = true) : Void#

View source

.end_disabled : Void#

View source

Clipping#

.push_clip_rect(clip_rect_min : ImVec2, clip_rect_max : ImVec2, intersect_with_current_clip_rect : Bool) : Void#

View source

.pop_clip_rect : Void#

View source

Focus, Activation#

.set_item_default_focus : Void#

View source

make last item the default focused item of a window.

.set_keyboard_focus_here(offset : Int32 = 0) : Void#

View source

focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.

Item/Widgets Utilities and Query Functions#

  • Most of the functions are referring to the previous Item that has been submitted.
  • See Demo Window under "Widgets->Querying Status" for an interactive visualization of most of those functions.

.is_item_hovered(flags : ImGuiHoveredFlags = ImGuiHoveredFlags.new(0)) : Bool#

View source

is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGui::ImGuiHoveredFlags for more options.

.is_item_active : Bool#

View source

is the last item 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)

.is_item_focused : Bool#

View source

is the last item focused for keyboard/gamepad navigation?

.is_item_clicked(mouse_button : ImGuiMouseButton = ImGuiMouseButton.new(0)) : Bool#

View source

is the last item hovered and mouse clicked on? () == ImGui.is_mouse_clicked(mouse_button) && ImGui.is_item_hoveredImportant. () this it NOT equivalent to the behavior of e.g. ImGui.button. Read comments in function definition.

.is_item_visible : Bool#

View source

is the last item visible? (items may be out of sight because of clipping/scrolling)

.is_item_edited : Bool#

View source

did the last item modify its underlying value this frame? or was pressed? This is generally the same as the "bool" return value of many widgets.

.is_item_activated : Bool#

View source

was the last item just made active (item was previously inactive).

.is_item_deactivated : Bool#

View source

was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing.

.is_item_deactivated_after_edit : Bool#

View source

was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item).

.is_item_toggled_open : Bool#

View source

was the last item open state toggled? set by TreeNode().

.is_any_item_hovered : Bool#

View source

is any item hovered?

.is_any_item_active : Bool#

View source

is any item active?

.is_any_item_focused : Bool#

View source

is any item focused?

.get_item_rect_min : ImGui::ImVec2#

View source

get upper-left bounding rectangle of the last item (screen space)

.get_item_rect_max : ImGui::ImVec2#

View source

get lower-right bounding rectangle of the last item (screen space)

.get_item_rect_size : ImGui::ImVec2#

View source

get size of last item

.set_item_allow_overlap : Void#

View source

allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.

Viewports#

  • Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows.
  • In 'docking' branch with multi-viewport enabled, we extend this concept to have multiple active viewports.
  • In the future we will extend this concept further to also represent Platform Monitor and support a "no main platform window" operation mode.

.get_main_viewport : ImGuiViewport#

View source

return primary/default viewport. This can never be NULL.

Background/Foreground Draw Lists#

.get_background_draw_list : ImDrawList#

View source

this draw list will be the first rendered one. Useful to quickly draw shapes/text behind dear imgui contents.

.get_foreground_draw_list : ImDrawList#

View source

this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents.

Miscellaneous Utilities#

.is_rect_visible(rect_min : ImVec2, rect_max : ImVec2) : Bool#

View source

test if rectangle (of given size, starting from cursor position) is visible / not clipped.

.is_rect_visible(rect_min : ImVec2, rect_max : ImVec2) : Bool#

View source

test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.

.get_time : Float64#

View source

get global imgui time. incremented by io.DeltaTime every frame.

.get_frame_count : Int32#

View source

get global imgui frame count. incremented by 1 every frame.

.get_draw_list_shared_data : ImDrawListSharedData#

View source

you may use this when creating your own ImGui::ImDrawList instances.

.get_style_color_name(idx : ImGuiCol) : String#

View source

get a string corresponding to the enum value (for display, saving, etc.).

.set_state_storage(storage : Pointer(ImGuiStorage)) : Void#

View source

replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it)

.get_state_storage : ImGuiStorage#

View source

.begin_child_frame(id : ImGuiID, size : ImVec2, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool#

View source

helper to create a child window / scrolling region that looks like a normal widget frame

.end_child_frame : Void#

View source

always call ImGui.end_child_frame regardless of ImGui.begin_child_frame return values (which indicates a collapsed/clipped window)

ImGui.text Utilities#

.calc_text_size(text : Bytes | String, hide_text_after_double_hash : Bool = false, wrap_width : Float32 = -1.0) : ImGui::ImVec2#

View source

Color Utilities#

.color_convert_u32_to_float4(in_ : UInt32) : ImGui::ImVec4#

View source

.color_convert_float4_to_u32(in_ : ImVec4) : UInt32#

View source

.color_convert_rgb_to_hsv(r : Float32, g : Float32, b : Float32) : Tuple(LibC::Float, LibC::Float, LibC::Float)#

View source

.color_convert_hsv_to_rgb(h : Float32, s : Float32, v : Float32) : Tuple(LibC::Float, LibC::Float, LibC::Float)#

View source

Inputs Utilities: Keyboard#

Without IMGUI_DISABLE_OBSOLETE_KEYIO: (legacy support)

- For '[`ImGui::ImGuiKey`][] key' you can still use your legacy native/user indices according to how your backend/engine stored them in io.KeysDown[].

With IMGUI_DISABLE_OBSOLETE_KEYIO: (this is the way forward)

- Any use of '[`ImGui::ImGuiKey`][]' will assert when key < 512 will be passed, previously reserved as native/user keys indices
- [`ImGui.get_key_index`][] is pass-through and therefore deprecated (gone if IMGUI_DISABLE_OBSOLETE_KEYIO is defined)

.is_key_down(key : ImGuiKey) : Bool#

View source

is key being held.

.is_key_pressed(key : ImGuiKey, repeat : Bool = true) : Bool#

View source

was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate

.is_key_released(key : ImGuiKey) : Bool#

View source

was key released (went from Down to !Down)?

.get_key_pressed_amount(key : ImGuiKey, repeat_delay : Float32, rate : Float32) : Int32#

View source

uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate

.get_key_name(key : ImGuiKey) : String#

View source

[DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared.

.set_next_frame_want_capture_keyboard(want_capture_keyboard : Bool) : Void#

View source

Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next ImGui.new_frame call.

Inputs Utilities: Mouse#

  • To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.
  • You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
  • Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')

.is_mouse_down(button : ImGuiMouseButton) : Bool#

View source

is mouse button held?

.is_mouse_clicked(button : ImGuiMouseButton, repeat : Bool = false) : Bool#

View source

did mouse button clicked? (went from !Down to Down). Same as ImGui.get_mouse_clicked_count == 1.

.is_mouse_released(button : ImGuiMouseButton) : Bool#

View source

did mouse button released? (went from Down to !Down)

.is_mouse_double_clicked(button : ImGuiMouseButton) : Bool#

View source

did mouse button double-clicked? Same as ImGui.get_mouse_clicked_count == 2. (note that a double-click will also report ImGui.is_mouse_clicked == true)

.get_mouse_clicked_count(button : ImGuiMouseButton) : Int32#

View source

return the number of successive mouse-clicks at the time where a click happen (otherwise 0).

.is_mouse_hovering_rect(r_min : ImVec2, r_max : ImVec2, clip : Bool = true) : Bool#

View source

.is_mouse_pos_valid(mouse_pos : Pointer(ImVec2) = Pointer(ImVec2).null) : Bool#

View source

by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available

.is_any_mouse_down : Bool#

View source

[WILL OBSOLETE] is any mouse button held? This was designed for backends, but prefer having backend maintain a mask of held mouse buttons, because upcoming input queue system will make this invalid.

.get_mouse_pos : ImGui::ImVec2#

View source

shortcut to ImGui.get_io.MousePos provided by user, to be consistent with other calls

.get_mouse_pos_on_opening_current_popup : ImGui::ImVec2#

View source

retrieve mouse position at the time of opening popup we have ImGui.begin_popup into (helper to avoid user backing that value themselves)

.is_mouse_dragging(button : ImGuiMouseButton, lock_threshold : Float32 = -1.0) : Bool#

View source

is mouse dragging? (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold)

.get_mouse_drag_delta(button : ImGuiMouseButton = ImGuiMouseButton.new(0), lock_threshold : Float32 = -1.0) : ImGui::ImVec2#

View source

return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold)

.reset_mouse_drag_delta(button : ImGuiMouseButton = ImGuiMouseButton.new(0)) : Void#

View source

.get_mouse_cursor : ImGuiMouseCursor#

View source

get desired cursor type, reset in ImGui.new_frame, this is updated during the frame. valid before ImGui.render. If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you

.set_mouse_cursor(cursor_type : ImGuiMouseCursor) : Void#

View source

set desired cursor type

.set_next_frame_want_capture_mouse(want_capture_mouse : Bool) : Void#

View source

Override io.WantCaptureMouse flag next frame (said flag is left for your application to handle, typical when true it instucts your app to ignore inputs). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse;" after the next ImGui.new_frame call.

Clipboard Utilities#

  • Also see the ImGui.log_to_clipboard function to capture GUI into clipboard, or easily output text data to the clipboard.

.get_clipboard_text : String#

View source

.set_clipboard_text(text : String) : Void#

View source

Settings/.Ini Utilities

  • The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini").
  • Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually.
  • Important: default value "imgui.ini" is relative to current working dir! Most apps will want to lock this to an absolute path (e.g. same path as executables).

.load_ini_settings_from_disk(ini_filename : String) : Void#

View source

call after ImGui.create_context and before the first call to ImGui.new_frame. ImGui.new_frame automatically calls ImGui.load_ini_settings_from_disk(io.IniFilename).

.load_ini_settings_from_memory(ini_data : String, ini_size : LibC::SizeT = 0) : Void#

View source

call after ImGui.create_context and before the first call to ImGui.new_frame to provide .ini data from your own data source.

.save_ini_settings_to_disk(ini_filename : String) : Void#

View source

this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by ImGui.destroy_context).

.save_ini_settings_to_memory : ::Tuple(String, LibC::SizeT)#

View source

return a zero-terminated string with the .ini data which you can save by your own mean. call when io.WantSaveIniSettings is set, then save data by your own mean and clear io.WantSaveIniSettings.

Debug Utilities#

.debug_text_encoding(text : String) : Void#

View source

.debug_check_version_and_data_layout(version_str : String, sz_io : LibC::SizeT, sz_style : LibC::SizeT, sz_vec2 : LibC::SizeT, sz_vec4 : LibC::SizeT, sz_drawvert : LibC::SizeT, sz_drawidx : LibC::SizeT) : Bool#

View source

This is called by IMGUI_CHECKVERSION() macro.

Memory Allocators#

  • Those functions are not reliant on the current context.
  • DLL users: heaps and globals are not shared across DLL boundaries! You will need to call ImGui.set_current_context + ImGui.set_allocator_functions for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.

.set_allocator_functions(alloc_func : ImGuiMemAllocFunc, free_func : ImGuiMemFreeFunc, user_data : Pointer(Void) = Pointer(Void).null) : Void#

View source

.get_allocator_functions(p_alloc_func : Pointer(ImGuiMemAllocFunc), p_free_func : Pointer(ImGuiMemFreeFunc), p_user_data : Pointer(Pointer(Void))) : Void#

View source

.mem_alloc(size : LibC::SizeT) : Pointer(Void)#

View source

.mem_free(ptr : Pointer(Void)) : Void#

View source

namespace ImGui