Module: ImGui

Extended by:
FFI::Library
Defined in:
lib/imgui.rb,
lib/imgui_internal.rb,
lib/imgui_impl_glfw.rb,
lib/imgui_impl_sdl2.rb,
lib/imgui_impl_raylib.rb,
lib/imgui_impl_opengl2.rb,
lib/imgui_impl_opengl3.rb,
lib/imgui_impl_sdlrenderer.rb

Defined Under Namespace

Classes: ImGui_ImplGlfw_Data, ImGui_ImplRaylib_Data, ImGui_ImplSDL2_Data, ImGui_ImplSDLRenderer_Data

Constant Summary collapse

KEY_IDS =
TODO

Support ClipboardText

g_ClipboardTextData ImplRaylib_GetClipboardText ImplRaylib_SetClipboardText

[
  # Alphanumeric keys
  Raylib::KEY_APOSTROPHE,    # Key: '
  Raylib::KEY_COMMA,         # Key: ,
  Raylib::KEY_MINUS,         # Key: -
  Raylib::KEY_PERIOD,        # Key: .
  Raylib::KEY_SLASH,         # Key: /
  Raylib::KEY_ZERO,          # Key: 0
  Raylib::KEY_ONE,           # Key: 1
  Raylib::KEY_TWO,           # Key: 2
  Raylib::KEY_THREE,         # Key: 3
  Raylib::KEY_FOUR,          # Key: 4
  Raylib::KEY_FIVE,          # Key: 5
  Raylib::KEY_SIX,           # Key: 6
  Raylib::KEY_SEVEN,         # Key: 7
  Raylib::KEY_EIGHT,         # Key: 8
  Raylib::KEY_NINE,          # Key: 9
  Raylib::KEY_SEMICOLON,     # Key: ;
  Raylib::KEY_EQUAL,         # Key: =
  Raylib::KEY_A,             # Key: A | a
  Raylib::KEY_B,             # Key: B | b
  Raylib::KEY_C,             # Key: C | c
  Raylib::KEY_D,             # Key: D | d
  Raylib::KEY_E,             # Key: E | e
  Raylib::KEY_F,             # Key: F | f
  Raylib::KEY_G,             # Key: G | g
  Raylib::KEY_H,             # Key: H | h
  Raylib::KEY_I,             # Key: I | i
  Raylib::KEY_J,             # Key: J | j
  Raylib::KEY_K,             # Key: K | k
  Raylib::KEY_L,             # Key: L | l
  Raylib::KEY_M,             # Key: M | m
  Raylib::KEY_N,             # Key: N | n
  Raylib::KEY_O,             # Key: O | o
  Raylib::KEY_P,             # Key: P | p
  Raylib::KEY_Q,             # Key: Q | q
  Raylib::KEY_R,             # Key: R | r
  Raylib::KEY_S,             # Key: S | s
  Raylib::KEY_T,             # Key: T | t
  Raylib::KEY_U,             # Key: U | u
  Raylib::KEY_V,             # Key: V | v
  Raylib::KEY_W,             # Key: W | w
  Raylib::KEY_X,             # Key: X | x
  Raylib::KEY_Y,             # Key: Y | y
  Raylib::KEY_Z,             # Key: Z | z
  Raylib::KEY_LEFT_BRACKET,  # Key: [
  Raylib::KEY_BACKSLASH,     # Key: '\'
  Raylib::KEY_RIGHT_BRACKET, # Key: ]
  Raylib::KEY_GRAVE,         # Key: `
  # Function keys
  Raylib::KEY_SPACE,         # Key: Space
  Raylib::KEY_ESCAPE,        # Key: Esc
  Raylib::KEY_ENTER,         # Key: Enter
  Raylib::KEY_TAB,           # Key: Tab
  Raylib::KEY_BACKSPACE,     # Key: Backspace
  Raylib::KEY_INSERT,        # Key: Ins
  Raylib::KEY_DELETE,        # Key: Del
  Raylib::KEY_RIGHT,         # Key: Cursor right
  Raylib::KEY_LEFT,          # Key: Cursor left
  Raylib::KEY_DOWN,          # Key: Cursor down
  Raylib::KEY_UP,            # Key: Cursor up
  Raylib::KEY_PAGE_UP,       # Key: Page up
  Raylib::KEY_PAGE_DOWN,     # Key: Page down
  Raylib::KEY_HOME,          # Key: Home
  Raylib::KEY_END,           # Key: End
  Raylib::KEY_CAPS_LOCK,     # Key: Caps lock
  Raylib::KEY_SCROLL_LOCK,   # Key: Scroll down
  Raylib::KEY_NUM_LOCK,      # Key: Num lock
  Raylib::KEY_PRINT_SCREEN,  # Key: Print screen
  Raylib::KEY_PAUSE,         # Key: Pause
  Raylib::KEY_F1,            # Key: F1
  Raylib::KEY_F2,            # Key: F2
  Raylib::KEY_F3,            # Key: F3
  Raylib::KEY_F4,            # Key: F4
  Raylib::KEY_F5,            # Key: F5
  Raylib::KEY_F6,            # Key: F6
  Raylib::KEY_F7,            # Key: F7
  Raylib::KEY_F8,            # Key: F8
  Raylib::KEY_F9,            # Key: F9
  Raylib::KEY_F10,           # Key: F10
  Raylib::KEY_F11,           # Key: F11
  Raylib::KEY_F12,           # Key: F12
  Raylib::KEY_LEFT_SHIFT,    # Key: Shift left
  Raylib::KEY_LEFT_CONTROL,  # Key: Control left
  Raylib::KEY_LEFT_ALT,      # Key: Alt left
  Raylib::KEY_LEFT_SUPER,    # Key: Super left
  Raylib::KEY_RIGHT_SHIFT,   # Key: Shift right
  Raylib::KEY_RIGHT_CONTROL, # Key: Control right
  Raylib::KEY_RIGHT_ALT,     # Key: Alt right
  Raylib::KEY_RIGHT_SUPER,   # Key: Super right
  Raylib::KEY_KB_MENU,       # Key: KB menu
  # Keypad keys
  Raylib::KEY_KP_0,          # Key: Keypad 0
  Raylib::KEY_KP_1,          # Key: Keypad 1
  Raylib::KEY_KP_2,          # Key: Keypad 2
  Raylib::KEY_KP_3,          # Key: Keypad 3
  Raylib::KEY_KP_4,          # Key: Keypad 4
  Raylib::KEY_KP_5,          # Key: Keypad 5
  Raylib::KEY_KP_6,          # Key: Keypad 6
  Raylib::KEY_KP_7,          # Key: Keypad 7
  Raylib::KEY_KP_8,          # Key: Keypad 8
  Raylib::KEY_KP_9,          # Key: Keypad 9
  Raylib::KEY_KP_DECIMAL,    # Key: Keypad .
  Raylib::KEY_KP_DIVIDE,     # Key: Keypad /
  Raylib::KEY_KP_MULTIPLY,   # Key: Keypad *
  Raylib::KEY_KP_SUBTRACT,   # Key: Keypad -
  Raylib::KEY_KP_ADD,        # Key: Keypad +
  Raylib::KEY_KP_ENTER,      # Key: Keypad Enter
  Raylib::KEY_KP_EQUAL,      # Key: Keypad =
]
@@imgui_import_done =
false
@@imgui_import_internal_done =
false
@@g_BackendPlatformName =
FFI::MemoryPointer.from_string("imgui_impl_raylib")
@@g_BackendData =

ImGui::GetCurrentContext().address => ImGui_ImplRaylib_Data

Hash.new
@@ImplGlfw_MouseButtonCallback =
GLFW::create_callback(:GLFWmousebuttonfun) do |window, button, action, mods|
  bd = ImGui_ImplGlfw_GetBackendData()
  unless bd.prevUserCallbackMousebutton.null?
    userfunc = Fiddle::Function.new(bd.prevUserCallbackMousebutton, GLFW::GLFWmousebuttonfun_cb_args, GLFW::GLFWmousebuttonfun_cb_retval)
    userfunc.call(window, button, action, mods)
  end
   ImGui_ImplGlfw_UpdateKeyModifiers(mods)
   io = ImGuiIO.new(ImGui::GetIO())
  if button >= 0 && button < ImGuiMouseButton_COUNT
    io.AddMouseButtonEvent(button, action == GLFW::PRESS)
  end
end
@@ImplGlfw_ScrollCallback =
GLFW::create_callback(:GLFWscrollfun) do |window, xoffset, yoffset|
  bd = ImGui_ImplGlfw_GetBackendData()
  unless bd.prevUserCallbackScroll.null?
    userfunc = Fiddle::Function.new(bd.prevUserCallbackScroll, GLFW::GLFWscrollfun_cb_args, GLFW::GLFWscrollfun_cb_retval)
    userfunc.call(window, xoffset, yoffset)
  end
   io = ImGuiIO.new(ImGui::GetIO())
  io.AddMouseWheelEvent(xoffset.to_f, yoffset.to_f)
end
@@ImplGlfw_KeyCallback =
GLFW::create_callback(:GLFWkeyfun) do |window, keycode, scancode, action, mods|
  bd = ImGui_ImplGlfw_GetBackendData()
  unless bd.prevUserCallbackKey.null?
    userfunc = Fiddle::Function.new(bd.prevUserCallbackKey, GLFW::GLFWkeyfun_cb_args, GLFW::GLFWkeyfun_cb_retval)
    userfunc.call(window, keycode, scancode, action, mods)
  end
   return if (action != GLFW::PRESS && action != GLFW::RELEASE)
   ImGui_ImplGlfw_UpdateKeyModifiers(mods)
   keycode = ImGui_ImplGlfw_TranslateUntranslatedKey(keycode, scancode)
   io = ImGuiIO.new(ImGui::GetIO())
  imgui_key = ImGui_ImplGlfw_KeyToImGuiKey(keycode)
  io.AddKeyEvent(imgui_key, (action == GLFW::PRESS))
  io.SetKeyEventNativeData(imgui_key, keycode, scancode) # To support legacy indexing (<1.87 user code)
end
@@ImplGlfw_WindowFocusCallback =
GLFW::create_callback(:GLFWwindowfocusfun) do |window, focused|
  bd = ImGui_ImplGlfw_GetBackendData()
  unless bd.prevUserCallbackWindowFocus.null?
    userfunc = Fiddle::Function.new(bd.prevUserCallbackWindowFocus, GLFW::GLFWwindowfocusfun_cb_args, GLFW::GLFWwindowfocusfun_cb_retval)
    userfunc.call(window, focused)
  end
   io = ImGuiIO.new(ImGui::GetIO())
  io.AddFocusEvent(focused != 0)
end
@@ImplGlfw_CursorPosCallback =
GLFW::create_callback(:GLFWcursorposfun) do |window, x, y|
  bd = ImGui_ImplGlfw_GetBackendData()
  unless bd.prevUserCallbackCursorPos.null?
    userfunc = Fiddle::Function.new(bd.prevUserCallbackCursorPos, GLFW::GLFWcursorposfun_cb_args, GLFW::GLFWcursorposfun_cb_retval)
    userfunc.call(window, x, y)
  end
   io = ImGuiIO.new(ImGui::GetIO())
  io.AddMousePosEvent(x.to_f, y.to_f)
  bd.lastValidMousePos[:x] = x.to_f
  bd.lastValidMousePos[:y] = y.to_f
end
@@ImplGlfw_CursorEnterCallback =

Workaround: X11 seems to send spurious Leave/Enter events which would make us lose our position, so we back it up and restore on Leave/Enter (see github.com/ocornut/imgui/issues/4984)

GLFW::create_callback(:GLFWcursorenterfun) do |window, entered|
  bd = ImGui_ImplGlfw_GetBackendData()
  unless bd.prevUserCallbackCursorEnter.null?
    userfunc = Fiddle::Function.new(bd.prevUserCallbackCursorEnter, GLFW::GLFWcursorenterfun_cb_args, GLFW::GLFWcursorenterfun_cb_retval)
    userfunc.call(window, entered)
  end
   io = ImGuiIO.new(ImGui::GetIO())
  if entered
    bd.mouseWindow = window
    io.AddMousePosEvent(bd.lastValidMousePos[:x], bd.lastValidMousePos[:y])
  elsif !entered && bd.mouseWindow == window
    bd.lastValidMousePos[:x] = io[:MousePos][:x]
    bd.lastValidMousePos[:y] = io[:MousePos][:y]
    bd.mouseWindow = nil
    io.AddMousePosEvent(-Float::MAX, -Float::MAX)
  end
end
@@ImplGlfw_CharCallback =
GLFW::create_callback(:GLFWcharfun) do |window, c|
  bd = ImGui_ImplGlfw_GetBackendData()
  unless bd.prevUserCallbackChar.null?
    bd.prevUserCallbackChar.call(window, c)
  end
   io = ImGuiIO.new(ImGui::GetIO())
  io.AddInputCharacter(c);
end
@@ImplGlfw_MonitorCallback =
GLFW::create_callback(:GLFWmonitorfun) do |monitor, event|
  # Unused in 'master' branch but 'docking' branch will use this, so we declare it ahead of it so if you have to install callbacks you can install this one too.
   # bd = ImGui_ImplGlfw_GetBackendData()
  # unless bd.prevUserCallbackMonitor.null?
  #   bd.prevUserCallbackMonitor.call(monitor, event)
  # end
end
@@g_FontTexture =
nil
@@g_BackendRendererName =
FFI::MemoryPointer.from_string("imgui_impl_sdlrenderer")
@@g_GlVersion =

Extracted at runtime using GL::MAJOR_VERSION, GL::MINOR_VERSION queries.

0
@@g_GlslVersionString =

Specified by user or detected based on compile time

""
@@g_ShaderHandle =
0
@@g_AttribLocationTex =
0
@@g_AttribLocationProjMtx =
0
@@g_AttribLocationVtxPos =
0
@@g_AttribLocationVtxUV =
0
@@g_AttribLocationVtxColor =
0
@@g_VboHandle =
0
@@g_ElementsHandle =
0
@@g_BackendRendererUserData =
nil

Class Method Summary collapse

Class Method Details

.AcceptDragDropPayload(type, flags = 0) ⇒ Object

arg: type(const char*), flags(ImGuiDragDropFlags) ret: pointer



3385
3386
3387
# File 'lib/imgui.rb', line 3385

def self.AcceptDragDropPayload(type, flags = 0)  # accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.
  igAcceptDragDropPayload(type, flags)
end

.AlignTextToFramePaddingObject

ret: void



3390
3391
3392
# File 'lib/imgui.rb', line 3390

def self.AlignTextToFramePadding()  # 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)
  igAlignTextToFramePadding()
end

.ArrowButton(str_id, dir) ⇒ Object

arg: str_id(const char*), dir(ImGuiDir) ret: bool



3396
3397
3398
# File 'lib/imgui.rb', line 3396

def self.ArrowButton(str_id, dir)  # square button with an arrow shape
  igArrowButton(str_id, dir)
end

.Begin(name, p_open = nil, flags = 0) ⇒ Object

arg: name(const char*), p_open(bool*), flags(ImGuiWindowFlags) ret: bool

Windows

  • Begin() = push window to the stack and start appending to it. 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 Begin()/End() pairs multiple times. Some information such as ‘flags’ or ‘p_open’ will only be considered by the first call to Begin().

  • 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 End() for each Begin() call, regardless of its return value! [Important: due to legacy reason, Begin/End and BeginChild/EndChild are inconsistent with all other functions

    such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding
    BeginXXX function returned true. 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”.



3415
3416
3417
# File 'lib/imgui.rb', line 3415

def self.Begin(name, p_open = nil, flags = 0)
  igBegin(name, p_open, flags)
end

.BeginChild(*arg) ⇒ Object

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.

  • Before 1.90 (November 2023), the “ImGuiChildFlags child_flags = 0” parameter was “bool border = false”. This API is backward compatible with old code, as we guarantee that ImGuiChildFlags_Borders == true. Consider updating your old code:

    BeginChild("Name", size, false)   -> Begin("Name", size, 0); or Begin("Name", size, ImGuiChildFlags_None);
    BeginChild("Name", size, true)    -> Begin("Name", size, ImGuiChildFlags_Borders);
    
  • Manual sizing (each axis can use a different setting e.g. ImVec2(0.0f, 400.0f)):

    == 0.0f: use remaining parent window size for this axis.
     > 0.0f: use specified size for this axis.
     < 0.0f: right/bottom-align to specified distance from available content boundaries.
    
  • Specifying ImGuiChildFlags_AutoResizeX or ImGuiChildFlags_AutoResizeY makes the sizing automatic based on child contents. Combining both ImGuiChildFlags_AutoResizeX and ImGuiChildFlags_AutoResizeY defeats purpose of a scrolling region and is NOT recommended.

  • 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 EndChild() for each BeginChild() call, regardless of its return value. [Important: due to legacy reason, Begin/End and BeginChild/EndChild are inconsistent with all other functions

    such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding
    BeginXXX function returned true. Begin and BeginChild are the only odd ones out. Will be fixed in a future update.]
    


5877
5878
5879
5880
5881
5882
5883
5884
5885
# File 'lib/imgui.rb', line 5877

def self.BeginChild(*arg)
  # arg: 0:str_id(const char*), 1:size(ImVec2), 2:child_flags(ImGuiChildFlags), 3:window_flags(ImGuiWindowFlags)
  # ret: bool
  return igBeginChild_Str(arg[0], arg[1], arg[2], arg[3]) if arg.length == 4 && (arg[0].kind_of?(String) && arg[1].kind_of?(ImVec2) && arg[2].kind_of?(Integer) && arg[3].kind_of?(Integer))
  # arg: 0:id(ImGuiID), 1:size(ImVec2), 2:child_flags(ImGuiChildFlags), 3:window_flags(ImGuiWindowFlags)
  # ret: bool
  return igBeginChild_ID(arg[0], arg[1], arg[2], arg[3]) if arg.length == 4 && (arg[0].kind_of?(Integer) && arg[1].kind_of?(ImVec2) && arg[2].kind_of?(Integer) && arg[3].kind_of?(Integer))
  $stderr.puts("[Warning] BeginChild : No matching functions found (#{arg})")
end

.BeginChild_ID(id, size = ImVec2.create(0,0), child_flags = 0, window_flags = 0) ⇒ Object

arg: id(ImGuiID), size(ImVec2), child_flags(ImGuiChildFlags), window_flags(ImGuiWindowFlags) ret: bool



3427
3428
3429
# File 'lib/imgui.rb', line 3427

def self.BeginChild_ID(id, size = ImVec2.create(0,0), child_flags = 0, window_flags = 0)
  igBeginChild_ID(id, size, child_flags, window_flags)
end

.BeginChild_Str(str_id, size = ImVec2.create(0,0), child_flags = 0, window_flags = 0) ⇒ Object

arg: str_id(const char*), size(ImVec2), child_flags(ImGuiChildFlags), window_flags(ImGuiWindowFlags) ret: bool



3421
3422
3423
# File 'lib/imgui.rb', line 3421

def self.BeginChild_Str(str_id, size = ImVec2.create(0,0), child_flags = 0, window_flags = 0)
  igBeginChild_Str(str_id, size, child_flags, window_flags)
end

.BeginCombo(label, preview_value, flags = 0) ⇒ Object

arg: label(const char*), preview_value(const char*), flags(ImGuiComboFlags) ret: bool

Widgets: Combo Box (Dropdown)

  • The BeginCombo()/EndCombo() 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 BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created.



3437
3438
3439
# File 'lib/imgui.rb', line 3437

def self.BeginCombo(label, preview_value, flags = 0)
  igBeginCombo(label, preview_value, flags)
end

.BeginDisabled(disabled = true) ⇒ Object

arg: disabled(bool) ret: void

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 BeginDisabled(true) in the stack is enough to keep everything disabled)

  • Tooltips windows by exception are opted out of disabling.

  • BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it.



3449
3450
3451
# File 'lib/imgui.rb', line 3449

def self.BeginDisabled(disabled = true)
  igBeginDisabled(disabled)
end

.BeginDragDropSource(flags = 0) ⇒ Object

arg: flags(ImGuiDragDropFlags) ret: bool

Drag and Drop

  • On source items, call BeginDragDropSource(), if it returns true also call SetDragDropPayload() + EndDragDropSource().

  • On target candidates, call BeginDragDropTarget(), if it returns true also call AcceptDragDropPayload() + EndDragDropTarget().

  • If you stop calling BeginDragDropSource() the payload is preserved however it won’t have a preview tooltip (we currently display a fallback “…” tooltip, see #1725)

  • An item can be both drag source and drop target.



3461
3462
3463
# File 'lib/imgui.rb', line 3461

def self.BeginDragDropSource(flags = 0)  # call after submitting an item which may be dragged. when this return true, you can call SetDragDropPayload() + EndDragDropSource()
  igBeginDragDropSource(flags)
end

.BeginDragDropTargetObject

ret: bool



3466
3467
3468
# File 'lib/imgui.rb', line 3466

def self.BeginDragDropTarget()  # call after submitting an item that may receive a payload. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
  igBeginDragDropTarget()
end

.BeginGroupObject

ret: void



3471
3472
3473
# File 'lib/imgui.rb', line 3471

def self.BeginGroup()  # lock horizontal starting position
  igBeginGroup()
end

.BeginItemTooltipObject

ret: bool

Tooltips: helpers for showing a tooltip when hovering an item

  • BeginItemTooltip() is a shortcut for the ‘if (IsItemHovered(ImGuiHoveredFlags_ForTooltip) && BeginTooltip())’ idiom.

  • SetItemTooltip() is a shortcut for the ‘if (IsItemHovered(ImGuiHoveredFlags_ForTooltip)) { SetTooltip(…); }’ idiom.

  • Where ‘ImGuiHoveredFlags_ForTooltip’ itself is a shortcut to use ‘style.HoverFlagsForTooltipMouse’ or ‘style.HoverFlagsForTooltipNav’ depending on active input type. For mouse it defaults to ‘ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort’.



3481
3482
3483
# File 'lib/imgui.rb', line 3481

def self.BeginItemTooltip()  # begin/append a tooltip window if preceding item was hovered.
  igBeginItemTooltip()
end

.BeginListBox(label, size = ImVec2.create(0,0)) ⇒ Object

arg: label(const char*), size(ImVec2) ret: bool

Widgets: List Boxes

  • This is essentially a thin wrapper to using BeginChild/EndChild with the ImGuiChildFlags_FrameStyle flag for stylistic changes + displaying a label.

  • You can submit contents and manage your selection state however you want it, by creating e.g. Selectable() or any other items.

  • The simplified/old ListBox() api are helpers over BeginListBox()/EndListBox() 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



3494
3495
3496
# File 'lib/imgui.rb', line 3494

def self.BeginListBox(label, size = ImVec2.create(0,0))  # open a framed scrolling region
  igBeginListBox(label, size)
end

.BeginMainMenuBarObject

ret: bool



3499
3500
3501
# File 'lib/imgui.rb', line 3499

def self.BeginMainMenuBar()  # create and append to a full screen menu-bar.
  igBeginMainMenuBar()
end

.BeginMenu(label, enabled = true) ⇒ Object

arg: label(const char*), enabled(bool) ret: bool



3505
3506
3507
# File 'lib/imgui.rb', line 3505

def self.BeginMenu(label, enabled = true)  # Implied enabled = true
  igBeginMenu(label, enabled)
end

.BeginMenuBarObject

ret: bool

Widgets: Menus

  • Use BeginMenuBar() on a window ImGuiWindowFlags_MenuBar to append to its menu bar.

  • Use BeginMainMenuBar() to create a menu bar at the top of the screen and append to it.

  • Use BeginMenu() to create a menu. You can call BeginMenu() 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.



3516
3517
3518
# File 'lib/imgui.rb', line 3516

def self.BeginMenuBar()  # append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window).
  igBeginMenuBar()
end

.BeginMultiSelect(flags, selection_size = -1,, items_count = -1)) ⇒ Object

arg: flags(ImGuiMultiSelectFlags), selection_size(int), items_count(int) ret: pointer

Multi-selection system for Selectable(), Checkbox(), TreeNode() functions [BETA]

  • This enables standard multi-selection/range-selection idioms (CTRL+Mouse/Keyboard, SHIFT+Mouse/Keyboard, etc.) in a way that also allow a clipper to be used.

  • ImGuiSelectionUserData is often used to store your item index within the current view (but may store something else).

  • Read comments near ImGuiMultiSelectIO for instructions/details and see ‘Demo->Widgets->Selection State & Multi-Select’ for demo.

  • TreeNode() is technically supported but… using this correctly is more complicated. You need some sort of linear/random access to your tree, which is suited to advanced trees setups already implementing filters and clipper. We will work simplifying the current demo.

  • ‘selection_size’ and ‘items_count’ parameters are optional and used by a few features. If they are costly for you to compute, you may avoid them.



3530
3531
3532
# File 'lib/imgui.rb', line 3530

def self.BeginMultiSelect(flags, selection_size = -1, items_count = -1)  # Implied selection_size = -1, items_count = -1
  igBeginMultiSelect(flags, selection_size, items_count)
end

.BeginPopup(str_id, flags = 0) ⇒ Object

arg: str_id(const char*), flags(ImGuiWindowFlags) ret: bool

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 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 IsItemHovered() or IsWindowHovered().
- IMPORTANT: Popup identifiers are relative to the current ID stack, so OpenPopup and BeginPopup generally needs to be at the same level of the stack.
  This is sometimes leading to confusing mistakes. May rework this in the future.
- BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards if returned true. ImGuiWindowFlags are forwarded to the window.
- BeginPopupModal(): block every interaction behind the window, cannot be closed by user, add a dimming background, has a title bar.


3547
3548
3549
# File 'lib/imgui.rb', line 3547

def self.BeginPopup(str_id, flags = 0)  # return true if the popup is open, and you can start outputting to it.
  igBeginPopup(str_id, flags)
end

.BeginPopupContextItem(str_id = nil, popup_flags = 1) ⇒ Object

arg: str_id(const char*), popup_flags(ImGuiPopupFlags) ret: bool

Popups: open+begin combined functions helpers

- Helpers to do OpenPopup+BeginPopup 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 ImGuiPopupFlags just like OpenPopup() and unlike BeginPopup(). For full consistency, we may add 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.


3559
3560
3561
# File 'lib/imgui.rb', line 3559

def self.BeginPopupContextItem(str_id = nil, popup_flags = 1)  # Implied str_id = NULL, popup_flags = 1
  igBeginPopupContextItem(str_id, popup_flags)
end

.BeginPopupContextVoid(str_id = nil, popup_flags = 1) ⇒ Object

arg: str_id(const char*), popup_flags(ImGuiPopupFlags) ret: bool



3565
3566
3567
# File 'lib/imgui.rb', line 3565

def self.BeginPopupContextVoid(str_id = nil, popup_flags = 1)  # Implied str_id = NULL, popup_flags = 1
  igBeginPopupContextVoid(str_id, popup_flags)
end

.BeginPopupContextWindow(str_id = nil, popup_flags = 1) ⇒ Object

arg: str_id(const char*), popup_flags(ImGuiPopupFlags) ret: bool



3571
3572
3573
# File 'lib/imgui.rb', line 3571

def self.BeginPopupContextWindow(str_id = nil, popup_flags = 1)  # Implied str_id = NULL, popup_flags = 1
  igBeginPopupContextWindow(str_id, popup_flags)
end

.BeginPopupModal(name, p_open = nil, flags = 0) ⇒ Object

arg: name(const char*), p_open(bool*), flags(ImGuiWindowFlags) ret: bool



3577
3578
3579
# File 'lib/imgui.rb', line 3577

def self.BeginPopupModal(name, p_open = nil, flags = 0)  # return true if the modal is open, and you can start outputting to it.
  igBeginPopupModal(name, p_open, flags)
end

.BeginTabBar(str_id, flags = 0) ⇒ Object

arg: str_id(const char*), flags(ImGuiTabBarFlags) ret: bool

Tab Bars, Tabs

  • Note: Tabs are automatically created by the docking system (when in ‘docking’ branch). Use this to create tab bars/tabs yourself.



3586
3587
3588
# File 'lib/imgui.rb', line 3586

def self.BeginTabBar(str_id, flags = 0)  # create and append into a TabBar
  igBeginTabBar(str_id, flags)
end

.BeginTabItem(label, p_open = nil, flags = 0) ⇒ Object

arg: label(const char*), p_open(bool*), flags(ImGuiTabItemFlags) ret: bool



3592
3593
3594
# File 'lib/imgui.rb', line 3592

def self.BeginTabItem(label, p_open = nil, flags = 0)  # create a Tab. Returns true if the Tab is selected.
  igBeginTabItem(label, p_open, flags)
end

.BeginTable(str_id, columns, flags = 0, outer_size = ImVec2.create(0.0,0.0), inner_width = 0.0) ⇒ Object

arg: str_id(const char*), columns(int), flags(ImGuiTableFlags), outer_size(ImVec2), inner_width(float) ret: bool

Tables

  • Full-featured replacement for old Columns API.

  • See Demo->Tables for demo code. See top of imgui_tables.cpp for general commentary.

  • See ImGuiTableFlags_ and ImGuiTableColumnFlags_ enums for a description of available flags.

The typical call flow is:

    1. Call BeginTable(), early out if returning false.

    1. Optionally call TableSetupColumn() to submit column name/flags/defaults.

    1. Optionally call TableSetupScrollFreeze() to request scroll freezing of columns/rows.

    1. Optionally call TableHeadersRow() to submit a header row. Names are pulled from TableSetupColumn() data.

    1. Populate contents:

    - In most situations you can use TableNextRow() + TableSetColumnIndex(N) to start appending into a column.
    - If you are using tables as a sort of grid, where every column is holding the same type of contents,
      you may prefer using TableNextColumn() instead of TableNextRow() + TableSetColumnIndex().
      TableNextColumn() will automatically wrap-around into the next row if needed.
    - IMPORTANT: Comparatively to the old Columns() API, we need to call TableNextColumn() for the first column!
    - Summary of possible call flow:
        - TableNextRow() -> TableSetColumnIndex(0) -> Text("Hello 0") -> TableSetColumnIndex(1) -> Text("Hello 1")  // OK
        - TableNextRow() -> TableNextColumn()      -> Text("Hello 0") -> TableNextColumn()      -> Text("Hello 1")  // OK
        -                   TableNextColumn()      -> Text("Hello 0") -> TableNextColumn()      -> Text("Hello 1")  // OK: TableNextColumn() automatically gets to next row!
        - TableNextRow()                           -> Text("Hello 0")                                               // Not OK! Missing TableSetColumnIndex() or TableNextColumn()! Text will not appear!
    
    1. Call EndTable()



3620
3621
3622
# File 'lib/imgui.rb', line 3620

def self.BeginTable(str_id, columns, flags = 0, outer_size = ImVec2.create(0.0,0.0), inner_width = 0.0)  # Implied outer_size = ImVec2(0.0f, 0.0f), inner_width = 0.0f
  igBeginTable(str_id, columns, flags, outer_size, inner_width)
end

.BeginTooltipObject

ret: bool

Tooltips

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

  • A tooltip window can contain items of any types.

  • SetTooltip() is more or less a shortcut for the ‘if (BeginTooltip()) { Text(…); EndTooltip(); }’ idiom (with a subtlety that it discard any previously submitted tooltip)



3630
3631
3632
# File 'lib/imgui.rb', line 3630

def self.BeginTooltip()  # begin/append a tooltip window.
  igBeginTooltip()
end

.BulletObject

ret: void



3635
3636
3637
# File 'lib/imgui.rb', line 3635

def self.Bullet()  # draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
  igBullet()
end

.BulletText(fmt, *varargs) ⇒ Object

arg: fmt(const char*), …(…) ret: void



3641
3642
3643
# File 'lib/imgui.rb', line 3641

def self.BulletText(fmt, *varargs)  # shortcut for Bullet()+Text()
  igBulletText(fmt, *varargs)
end

.Button(label, size = ImVec2.create(0,0)) ⇒ Object

arg: label(const char*), size(ImVec2) ret: bool

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. IsItemActive, IsItemHovered, etc.) to query widget state.



3651
3652
3653
# File 'lib/imgui.rb', line 3651

def self.Button(label, size = ImVec2.create(0,0))  # Implied size = ImVec2(0, 0)
  igButton(label, size)
end

.CalcItemWidthObject

ret: float



3656
3657
3658
# File 'lib/imgui.rb', line 3656

def self.CalcItemWidth()  # width of item given pushed settings and current cursor position. NOT necessarily the width of last item unlike most 'Item' functions.
  igCalcItemWidth()
end

.CalcTextSize(text, text_end = nil, hide_text_after_double_hash = false, wrap_width = -1.0)) ⇒ Object

arg: text(const char*), text_end(const char*), hide_text_after_double_hash(bool), wrap_width(float) ret: void

Text Utilities



3664
3665
3666
3667
3668
# File 'lib/imgui.rb', line 3664

def self.CalcTextSize(text, text_end = nil, hide_text_after_double_hash = false, wrap_width = -1.0)  # Implied text_end = NULL, hide_text_after_double_hash = false, wrap_width = -1.0f
  pOut = ImVec2.new
  igCalcTextSize(pOut, text, text_end, hide_text_after_double_hash, wrap_width)
  return pOut
end

.Checkbox(label, v) ⇒ Object

arg: label(const char*), v(bool*) ret: bool



3672
3673
3674
# File 'lib/imgui.rb', line 3672

def self.Checkbox(label, v)
  igCheckbox(label, v)
end

.CheckboxFlags(*arg) ⇒ Object



5887
5888
5889
5890
5891
5892
5893
5894
5895
# File 'lib/imgui.rb', line 5887

def self.CheckboxFlags(*arg)
  # arg: 0:label(const char*), 1:flags(int*), 2:flags_value(int)
  # ret: bool
  return igCheckboxFlags_IntPtr(arg[0], arg[1], arg[2]) if arg.length == 3 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(Integer))
  # arg: 0:label(const char*), 1:flags(unsigned int*), 2:flags_value(unsigned int)
  # ret: bool
  return igCheckboxFlags_UintPtr(arg[0], arg[1], arg[2]) if arg.length == 3 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(Integer))
  $stderr.puts("[Warning] CheckboxFlags : No matching functions found (#{arg})")
end

.CheckboxFlags_IntPtr(label, flags, flags_value) ⇒ Object

arg: label(const char*), flags(int*), flags_value(int) ret: bool



3678
3679
3680
# File 'lib/imgui.rb', line 3678

def self.CheckboxFlags_IntPtr(label, flags, flags_value)
  igCheckboxFlags_IntPtr(label, flags, flags_value)
end

.CheckboxFlags_UintPtr(label, flags, flags_value) ⇒ Object

arg: label(const char*), flags(unsigned int*), flags_value(unsigned int) ret: bool



3684
3685
3686
# File 'lib/imgui.rb', line 3684

def self.CheckboxFlags_UintPtr(label, flags, flags_value)
  igCheckboxFlags_UintPtr(label, flags, flags_value)
end

.CloseCurrentPopupObject

ret: void



3689
3690
3691
# File 'lib/imgui.rb', line 3689

def self.CloseCurrentPopup()  # manually close the popup we have begin-ed into.
  igCloseCurrentPopup()
end

.CollapsingHeader(*arg) ⇒ Object

if returning ‘true’ the header is open. doesn’t indent nor push on ID stack. user doesn’t have to call TreePop().



5897
5898
5899
5900
5901
5902
5903
5904
5905
# File 'lib/imgui.rb', line 5897

def self.CollapsingHeader(*arg)  # if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().
  # arg: 0:label(const char*), 1:flags(ImGuiTreeNodeFlags)
  # ret: bool
  return igCollapsingHeader_TreeNodeFlags(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(String) && arg[1].kind_of?(Integer))
  # arg: 0:label(const char*), 1:p_visible(bool*), 2:flags(ImGuiTreeNodeFlags)
  # ret: bool
  return igCollapsingHeader_BoolPtr(arg[0], arg[1], arg[2]) if arg.length == 3 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(Integer))
  $stderr.puts("[Warning] CollapsingHeader : No matching functions found (#{arg})")
end

.CollapsingHeader_BoolPtr(label, p_visible, flags = 0) ⇒ Object

arg: label(const char*), p_visible(bool*), flags(ImGuiTreeNodeFlags) ret: bool



3701
3702
3703
# File 'lib/imgui.rb', line 3701

def self.CollapsingHeader_BoolPtr(label, p_visible, flags = 0)
  igCollapsingHeader_BoolPtr(label, p_visible, flags)
end

.CollapsingHeader_TreeNodeFlags(label, flags = 0) ⇒ Object

arg: label(const char*), flags(ImGuiTreeNodeFlags) ret: bool



3695
3696
3697
# File 'lib/imgui.rb', line 3695

def self.CollapsingHeader_TreeNodeFlags(label, flags = 0)
  igCollapsingHeader_TreeNodeFlags(label, flags)
end

.ColorButton(desc_id, col, flags = 0, size = ImVec2.create(0,0)) ⇒ Object

arg: desc_id(const char*), col(ImVec4), flags(ImGuiColorEditFlags), size(ImVec2) ret: bool



3707
3708
3709
# File 'lib/imgui.rb', line 3707

def self.ColorButton(desc_id, col, flags = 0, size = ImVec2.create(0,0))  # Implied size = ImVec2(0, 0)
  igColorButton(desc_id, col, flags, size)
end

.ColorConvertFloat4ToU32(_in_) ⇒ Object

arg: in(ImVec4) ret: uint



3713
3714
3715
# File 'lib/imgui.rb', line 3713

def self.ColorConvertFloat4ToU32(_in_)
  igColorConvertFloat4ToU32(_in_)
end

.ColorConvertHSVtoRGB(h, s, v, out_r, out_g, out_b) ⇒ Object

arg: h(float), s(float), v(float), out_r(float*), out_g(float*), out_b(float*) ret: void



3719
3720
3721
# File 'lib/imgui.rb', line 3719

def self.ColorConvertHSVtoRGB(h, s, v, out_r, out_g, out_b)
  igColorConvertHSVtoRGB(h, s, v, out_r, out_g, out_b)
end

.ColorConvertRGBtoHSV(r, g, b, out_h, out_s, out_v) ⇒ Object

arg: r(float), g(float), b(float), out_h(float*), out_s(float*), out_v(float*) ret: void



3725
3726
3727
# File 'lib/imgui.rb', line 3725

def self.ColorConvertRGBtoHSV(r, g, b, out_h, out_s, out_v)
  igColorConvertRGBtoHSV(r, g, b, out_h, out_s, out_v)
end

.ColorConvertU32ToFloat4(_in_) ⇒ Object

arg: in(ImU32) ret: void

Color Utilities



3733
3734
3735
3736
3737
# File 'lib/imgui.rb', line 3733

def self.ColorConvertU32ToFloat4(_in_)
  pOut = ImVec4.new
  igColorConvertU32ToFloat4(pOut, _in_)
  return pOut
end

.ColorEdit3(label, col, flags = 0) ⇒ Object

arg: label(const char*), col(float), flags(ImGuiColorEditFlags) ret: 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’ 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



3745
3746
3747
# File 'lib/imgui.rb', line 3745

def self.ColorEdit3(label, col, flags = 0)
  igColorEdit3(label, col, flags)
end

.ColorEdit4(label, col, flags = 0) ⇒ Object

arg: label(const char*), col(float), flags(ImGuiColorEditFlags) ret: bool



3751
3752
3753
# File 'lib/imgui.rb', line 3751

def self.ColorEdit4(label, col, flags = 0)
  igColorEdit4(label, col, flags)
end

.ColorPicker3(label, col, flags = 0) ⇒ Object

arg: label(const char*), col(float), flags(ImGuiColorEditFlags) ret: bool



3757
3758
3759
# File 'lib/imgui.rb', line 3757

def self.ColorPicker3(label, col, flags = 0)
  igColorPicker3(label, col, flags)
end

.ColorPicker4(label, col, flags = 0, ref_col = nil) ⇒ Object

arg: label(const char*), col(float), flags(ImGuiColorEditFlags), ref_col(const float*) ret: bool



3763
3764
3765
# File 'lib/imgui.rb', line 3763

def self.ColorPicker4(label, col, flags = 0, ref_col = nil)
  igColorPicker4(label, col, flags, ref_col)
end

.Columns(count = 1, id = nil, borders = true) ⇒ Object

arg: count(int), id(const char*), borders(bool) ret: void

Legacy Columns API (prefer using Tables!)

  • You can also use SameLine(pos_x) to mimic simplified columns.



3772
3773
3774
# File 'lib/imgui.rb', line 3772

def self.Columns(count = 1, id = nil, borders = true)  # Implied count = 1, id = NULL, borders = true
  igColumns(count, id, borders)
end

.Combo(*arg) ⇒ Object

Implied popup_max_height_in_items = -1



5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
# File 'lib/imgui.rb', line 5907

def self.Combo(*arg)  # Implied popup_max_height_in_items = -1
  # arg: 0:label(const char*), 1:current_item(int*), 2:items(const char* const[]), 3:items_count(int), 4:popup_max_height_in_items(int)
  # ret: bool
  return igCombo_Str_arr(arg[0], arg[1], arg[2], arg[3], arg[4]) if arg.length == 5 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(FFI::Pointer) && arg[3].kind_of?(Integer) && arg[4].kind_of?(Integer))
  # arg: 0:label(const char*), 1:current_item(int*), 2:items_separated_by_zeros(const char*), 3:popup_max_height_in_items(int)
  # ret: bool
  return igCombo_Str(arg[0], arg[1], arg[2], arg[3]) if arg.length == 4 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(String) && arg[3].kind_of?(Integer))
  # arg: 0:label(const char*), 1:current_item(int*), 2:getter(const char*(*)(void* user_data,int idx)), 3:user_data(void*), 4:items_count(int), 5:popup_max_height_in_items(int)
  # ret: bool
  return igCombo_FnStrPtr(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5]) if arg.length == 6 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(String) && arg[3].kind_of?(FFI::Pointer) && arg[4].kind_of?(Integer) && arg[5].kind_of?(Integer))
  $stderr.puts("[Warning] Combo : No matching functions found (#{arg})")
end

.Combo_FnStrPtr(label, current_item, getter, user_data, items_count, popup_max_height_in_items = -1)) ⇒ Object

arg: label(const char*), current_item(int*), getter(const char*(*)(void* user_data,int idx)), user_data(void*), items_count(int), popup_max_height_in_items(int) ret: bool



3790
3791
3792
# File 'lib/imgui.rb', line 3790

def self.Combo_FnStrPtr(label, current_item, getter, user_data, items_count, popup_max_height_in_items = -1)
  igCombo_FnStrPtr(label, current_item, getter, user_data, items_count, popup_max_height_in_items)
end

.Combo_Str(label, current_item, items_separated_by_zeros, popup_max_height_in_items = -1)) ⇒ Object

arg: label(const char*), current_item(int*), items_separated_by_zeros(const char*), popup_max_height_in_items(int) ret: bool



3784
3785
3786
# File 'lib/imgui.rb', line 3784

def self.Combo_Str(label, current_item, items_separated_by_zeros, popup_max_height_in_items = -1)
  igCombo_Str(label, current_item, items_separated_by_zeros, popup_max_height_in_items)
end

.Combo_Str_arr(label, current_item, items, items_count, popup_max_height_in_items = -1)) ⇒ Object

arg: label(const char*), current_item(int*), items(const char* const[]), items_count(int), popup_max_height_in_items(int) ret: bool



3778
3779
3780
# File 'lib/imgui.rb', line 3778

def self.Combo_Str_arr(label, current_item, items, items_count, popup_max_height_in_items = -1)
  igCombo_Str_arr(label, current_item, items, items_count, popup_max_height_in_items)
end

.CreateContext(shared_font_atlas = nil) ⇒ Object

arg: shared_font_atlas(ImFontAtlas*) ret: pointer

Context creation and access

  • Each context create its own ImFontAtlas by default. You may instance one yourself and pass it to CreateContext() to share a font atlas between contexts.

  • DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions() for each static/DLL boundary you are calling from. Read “Context and Memory Allocators” section of imgui.cpp for details.



3801
3802
3803
# File 'lib/imgui.rb', line 3801

def self.CreateContext(shared_font_atlas = nil)
  igCreateContext(shared_font_atlas)
end

.DebugCheckVersionAndDataLayout(version_str, sz_io, sz_style, sz_vec2, sz_vec4, sz_drawvert, sz_drawidx) ⇒ Object

arg: version_str(const char*), sz_io(size_t), sz_style(size_t), sz_vec2(size_t), sz_vec4(size_t), sz_drawvert(size_t), sz_drawidx(size_t) ret: bool



3807
3808
3809
# File 'lib/imgui.rb', line 3807

def self.DebugCheckVersionAndDataLayout(version_str, sz_io, sz_style, sz_vec2, sz_vec4, sz_drawvert, sz_drawidx)  # This is called by IMGUI_CHECKVERSION() macro.
  igDebugCheckVersionAndDataLayout(version_str, sz_io, sz_style, sz_vec2, sz_vec4, sz_drawvert, sz_drawidx)
end

.DebugFlashStyleColor(idx) ⇒ Object

arg: idx(ImGuiCol) ret: void



3813
3814
3815
# File 'lib/imgui.rb', line 3813

def self.DebugFlashStyleColor(idx)
  igDebugFlashStyleColor(idx)
end

.DebugLog(fmt, *varargs) ⇒ Object

arg: fmt(const char*), …(…) ret: void



3819
3820
3821
# File 'lib/imgui.rb', line 3819

def self.DebugLog(fmt, *varargs)  # Call via IMGUI_DEBUG_LOG() for maximum stripping in caller code!
  igDebugLog(fmt, *varargs)
end

.DebugStartItemPickerObject

ret: void



3824
3825
3826
# File 'lib/imgui.rb', line 3824

def self.DebugStartItemPicker()
  igDebugStartItemPicker()
end

.DebugTextEncoding(text) ⇒ Object

arg: text(const char*) ret: void

Debug Utilities

  • Your main debugging friend is the ShowMetricsWindow() function, which is also accessible from Demo->Tools->Metrics Debugger



3833
3834
3835
# File 'lib/imgui.rb', line 3833

def self.DebugTextEncoding(text)
  igDebugTextEncoding(text)
end

.DestroyContext(ctx = nil) ⇒ Object

arg: ctx(ImGuiContext*) ret: void



3839
3840
3841
# File 'lib/imgui.rb', line 3839

def self.DestroyContext(ctx = nil)  # NULL = destroy current context
  igDestroyContext(ctx)
end

.DragFloat(label, v, v_speed = 1.0, v_min = 0.0, v_max = 0.0, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float*), v_speed(float), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) ret: bool

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 function, note that a ‘float v’ 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 take a final ‘float power=1.0f’ argument instead of the ‘ImGuiSliderFlags flags=0’ argument. If you get a warning converting a float to ImGuiSliderFlags, read github.com/ocornut/imgui/issues/3361



3858
3859
3860
# File 'lib/imgui.rb', line 3858

def self.DragFloat(label, v, v_speed = 1.0, v_min = 0.0, v_max = 0.0, format = "%.3f", flags = 0)  # Implied v_speed = 1.0f, v_min = 0.0f, v_max = 0.0f, format = "%.3f", flags = 0
  igDragFloat(label, v, v_speed, v_min, v_max, format, flags)
end

.DragFloat2(label, v, v_speed = 1.0, v_min = 0.0, v_max = 0.0, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float), v_speed(float), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) ret: bool



3864
3865
3866
# File 'lib/imgui.rb', line 3864

def self.DragFloat2(label, v, v_speed = 1.0, v_min = 0.0, v_max = 0.0, format = "%.3f", flags = 0)  # Implied v_speed = 1.0f, v_min = 0.0f, v_max = 0.0f, format = "%.3f", flags = 0
  igDragFloat2(label, v, v_speed, v_min, v_max, format, flags)
end

.DragFloat3(label, v, v_speed = 1.0, v_min = 0.0, v_max = 0.0, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float), v_speed(float), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) ret: bool



3870
3871
3872
# File 'lib/imgui.rb', line 3870

def self.DragFloat3(label, v, v_speed = 1.0, v_min = 0.0, v_max = 0.0, format = "%.3f", flags = 0)  # Implied v_speed = 1.0f, v_min = 0.0f, v_max = 0.0f, format = "%.3f", flags = 0
  igDragFloat3(label, v, v_speed, v_min, v_max, format, flags)
end

.DragFloat4(label, v, v_speed = 1.0, v_min = 0.0, v_max = 0.0, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float), v_speed(float), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) ret: bool



3876
3877
3878
# File 'lib/imgui.rb', line 3876

def self.DragFloat4(label, v, v_speed = 1.0, v_min = 0.0, v_max = 0.0, format = "%.3f", flags = 0)  # Implied v_speed = 1.0f, v_min = 0.0f, v_max = 0.0f, format = "%.3f", flags = 0
  igDragFloat4(label, v, v_speed, v_min, v_max, format, flags)
end

.DragFloatRange2(label, v_current_min, v_current_max, v_speed = 1.0, v_min = 0.0, v_max = 0.0, format = "%.3f", format_max = nil, flags = 0) ⇒ Object

arg: label(const char*), v_current_min(float*), v_current_max(float*), v_speed(float), v_min(float), v_max(float), format(const char*), format_max(const char*), flags(ImGuiSliderFlags) ret: bool



3882
3883
3884
# File 'lib/imgui.rb', line 3882

def self.DragFloatRange2(label, v_current_min, v_current_max, v_speed = 1.0, v_min = 0.0, v_max = 0.0, format = "%.3f", format_max = nil, flags = 0)  # Implied v_speed = 1.0f, v_min = 0.0f, v_max = 0.0f, format = "%.3f", format_max = NULL, flags = 0
  igDragFloatRange2(label, v_current_min, v_current_max, v_speed, v_min, v_max, format, format_max, flags)
end

.DragInt(label, v, v_speed = 1.0, v_min = 0, v_max = 0, format = "%d", flags = 0) ⇒ Object

arg: label(const char*), v(int*), v_speed(float), v_min(int), v_max(int), format(const char*), flags(ImGuiSliderFlags) ret: bool



3888
3889
3890
# File 'lib/imgui.rb', line 3888

def self.DragInt(label, v, v_speed = 1.0, v_min = 0, v_max = 0, format = "%d", flags = 0)  # Implied v_speed = 1.0f, v_min = 0, v_max = 0, format = "%d", flags = 0
  igDragInt(label, v, v_speed, v_min, v_max, format, flags)
end

.DragInt2(label, v, v_speed = 1.0, v_min = 0, v_max = 0, format = "%d", flags = 0) ⇒ Object

arg: label(const char*), v(int), v_speed(float), v_min(int), v_max(int), format(const char*), flags(ImGuiSliderFlags) ret: bool



3894
3895
3896
# File 'lib/imgui.rb', line 3894

def self.DragInt2(label, v, v_speed = 1.0, v_min = 0, v_max = 0, format = "%d", flags = 0)  # Implied v_speed = 1.0f, v_min = 0, v_max = 0, format = "%d", flags = 0
  igDragInt2(label, v, v_speed, v_min, v_max, format, flags)
end

.DragInt3(label, v, v_speed = 1.0, v_min = 0, v_max = 0, format = "%d", flags = 0) ⇒ Object

arg: label(const char*), v(int), v_speed(float), v_min(int), v_max(int), format(const char*), flags(ImGuiSliderFlags) ret: bool



3900
3901
3902
# File 'lib/imgui.rb', line 3900

def self.DragInt3(label, v, v_speed = 1.0, v_min = 0, v_max = 0, format = "%d", flags = 0)  # Implied v_speed = 1.0f, v_min = 0, v_max = 0, format = "%d", flags = 0
  igDragInt3(label, v, v_speed, v_min, v_max, format, flags)
end

.DragInt4(label, v, v_speed = 1.0, v_min = 0, v_max = 0, format = "%d", flags = 0) ⇒ Object

arg: label(const char*), v(int), v_speed(float), v_min(int), v_max(int), format(const char*), flags(ImGuiSliderFlags) ret: bool



3906
3907
3908
# File 'lib/imgui.rb', line 3906

def self.DragInt4(label, v, v_speed = 1.0, v_min = 0, v_max = 0, format = "%d", flags = 0)  # Implied v_speed = 1.0f, v_min = 0, v_max = 0, format = "%d", flags = 0
  igDragInt4(label, v, v_speed, v_min, v_max, format, flags)
end

.DragIntRange2(label, v_current_min, v_current_max, v_speed = 1.0, v_min = 0, v_max = 0, format = "%d", format_max = nil, flags = 0) ⇒ Object

arg: label(const char*), v_current_min(int*), v_current_max(int*), v_speed(float), v_min(int), v_max(int), format(const char*), format_max(const char*), flags(ImGuiSliderFlags) ret: bool



3912
3913
3914
# File 'lib/imgui.rb', line 3912

def self.DragIntRange2(label, v_current_min, v_current_max, v_speed = 1.0, v_min = 0, v_max = 0, format = "%d", format_max = nil, flags = 0)  # Implied v_speed = 1.0f, v_min = 0, v_max = 0, format = "%d", format_max = NULL, flags = 0
  igDragIntRange2(label, v_current_min, v_current_max, v_speed, v_min, v_max, format, format_max, flags)
end

.DragScalar(label, data_type, p_data, v_speed = 1.0, p_min = nil, p_max = nil, format = nil, flags = 0) ⇒ Object

arg: label(const char*), data_type(ImGuiDataType), p_data(void*), v_speed(float), p_min(const void*), p_max(const void*), format(const char*), flags(ImGuiSliderFlags) ret: bool



3918
3919
3920
# File 'lib/imgui.rb', line 3918

def self.DragScalar(label, data_type, p_data, v_speed = 1.0, p_min = nil, p_max = nil, format = nil, flags = 0)  # Implied v_speed = 1.0f, p_min = NULL, p_max = NULL, format = NULL, flags = 0
  igDragScalar(label, data_type, p_data, v_speed, p_min, p_max, format, flags)
end

.DragScalarN(label, data_type, p_data, components, v_speed = 1.0, p_min = nil, p_max = nil, format = nil, flags = 0) ⇒ Object

arg: label(const char*), data_type(ImGuiDataType), p_data(void*), components(int), v_speed(float), p_min(const void*), p_max(const void*), format(const char*), flags(ImGuiSliderFlags) ret: bool



3924
3925
3926
# File 'lib/imgui.rb', line 3924

def self.DragScalarN(label, data_type, p_data, components, v_speed = 1.0, p_min = nil, p_max = nil, format = nil, flags = 0)  # Implied v_speed = 1.0f, p_min = NULL, p_max = NULL, format = NULL, flags = 0
  igDragScalarN(label, data_type, p_data, components, v_speed, p_min, p_max, format, flags)
end

.Dummy(size) ⇒ Object

arg: size(ImVec2) ret: void



3930
3931
3932
# File 'lib/imgui.rb', line 3930

def self.Dummy(size)  # add a dummy item of given size. unlike InvisibleButton(), Dummy() won't take the mouse click or be navigable into.
  igDummy(size)
end

.EndObject

ret: void



3935
3936
3937
# File 'lib/imgui.rb', line 3935

def self.End()
  igEnd()
end

.EndChildObject

ret: void



3940
3941
3942
# File 'lib/imgui.rb', line 3940

def self.EndChild()
  igEndChild()
end

.EndComboObject

ret: void



3945
3946
3947
# File 'lib/imgui.rb', line 3945

def self.EndCombo()  # only call EndCombo() if BeginCombo() returns true!
  igEndCombo()
end

.EndDisabledObject

ret: void



3950
3951
3952
# File 'lib/imgui.rb', line 3950

def self.EndDisabled()
  igEndDisabled()
end

.EndDragDropSourceObject

ret: void



3955
3956
3957
# File 'lib/imgui.rb', line 3955

def self.EndDragDropSource()  # only call EndDragDropSource() if BeginDragDropSource() returns true!
  igEndDragDropSource()
end

.EndDragDropTargetObject

ret: void



3960
3961
3962
# File 'lib/imgui.rb', line 3960

def self.EndDragDropTarget()  # only call EndDragDropTarget() if BeginDragDropTarget() returns true!
  igEndDragDropTarget()
end

.EndFrameObject

ret: void



3965
3966
3967
# File 'lib/imgui.rb', line 3965

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

.EndGroupObject

ret: void



3970
3971
3972
# File 'lib/imgui.rb', line 3970

def self.EndGroup()  # unlock horizontal starting position + capture the whole group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.)
  igEndGroup()
end

.EndListBoxObject

ret: void



3975
3976
3977
# File 'lib/imgui.rb', line 3975

def self.EndListBox()  # only call EndListBox() if BeginListBox() returned true!
  igEndListBox()
end

.EndMainMenuBarObject

ret: void



3980
3981
3982
# File 'lib/imgui.rb', line 3980

def self.EndMainMenuBar()  # only call EndMainMenuBar() if BeginMainMenuBar() returns true!
  igEndMainMenuBar()
end

.EndMenuObject

ret: void



3985
3986
3987
# File 'lib/imgui.rb', line 3985

def self.EndMenu()  # only call EndMenu() if BeginMenu() returns true!
  igEndMenu()
end

.EndMenuBarObject

ret: void



3990
3991
3992
# File 'lib/imgui.rb', line 3990

def self.EndMenuBar()  # only call EndMenuBar() if BeginMenuBar() returns true!
  igEndMenuBar()
end

.EndMultiSelectObject

ret: pointer



3995
3996
3997
# File 'lib/imgui.rb', line 3995

def self.EndMultiSelect()
  igEndMultiSelect()
end

.EndPopupObject

ret: void



4000
4001
4002
# File 'lib/imgui.rb', line 4000

def self.EndPopup()  # only call EndPopup() if BeginPopupXXX() returns true!
  igEndPopup()
end

.EndTabBarObject

ret: void



4005
4006
4007
# File 'lib/imgui.rb', line 4005

def self.EndTabBar()  # only call EndTabBar() if BeginTabBar() returns true!
  igEndTabBar()
end

.EndTabItemObject

ret: void



4010
4011
4012
# File 'lib/imgui.rb', line 4010

def self.EndTabItem()  # only call EndTabItem() if BeginTabItem() returns true!
  igEndTabItem()
end

.EndTableObject

ret: void



4015
4016
4017
# File 'lib/imgui.rb', line 4015

def self.EndTable()  # only call EndTable() if BeginTable() returns true!
  igEndTable()
end

.EndTooltipObject

ret: void



4020
4021
4022
# File 'lib/imgui.rb', line 4020

def self.EndTooltip()  # only call EndTooltip() if BeginTooltip()/BeginItemTooltip() returns true!
  igEndTooltip()
end

.FocusWindow(window) ⇒ Object



45
46
47
# File 'lib/imgui_internal.rb', line 45

def self.FocusWindow(window)
  igFocusWindow(window)
end

.GetAllocatorFunctions(p_alloc_func, p_free_func, p_user_data) ⇒ Object

arg: p_alloc_func(ImGuiMemAllocFunc*), p_free_func(ImGuiMemFreeFunc*), p_user_data(void**) ret: void



4026
4027
4028
# File 'lib/imgui.rb', line 4026

def self.GetAllocatorFunctions(p_alloc_func, p_free_func, p_user_data)
  igGetAllocatorFunctions(p_alloc_func, p_free_func, p_user_data)
end

.GetBackgroundDrawListObject

ret: pointer

Background/Foreground Draw Lists



4033
4034
4035
# File 'lib/imgui.rb', line 4033

def self.GetBackgroundDrawList()  # Implied viewport = NULL
  igGetBackgroundDrawList()
end

.GetClipboardTextObject

ret: pointer

Clipboard Utilities

  • Also see the LogToClipboard() function to capture GUI into clipboard, or easily output text data to the clipboard.



4041
4042
4043
# File 'lib/imgui.rb', line 4041

def self.GetClipboardText()
  igGetClipboardText()
end

.GetColorU32(*arg) ⇒ Object

Implied alpha_mul = 1.0f



5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
# File 'lib/imgui.rb', line 5920

def self.GetColorU32(*arg)  # Implied alpha_mul = 1.0f
  # arg: 0:idx(ImGuiCol), 1:alpha_mul(float)
  # ret: uint
  return igGetColorU32_Col(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(Integer) && arg[1].kind_of?(Float))
  # arg: 0:col(ImVec4)
  # ret: uint
  return igGetColorU32_Vec4(arg[0]) if arg.length == 1 && (arg[0].kind_of?(ImVec4))
  # arg: 0:col(ImU32), 1:alpha_mul(float)
  # ret: uint
  return igGetColorU32_U32(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(Integer) && arg[1].kind_of?(Float))
  $stderr.puts("[Warning] GetColorU32 : No matching functions found (#{arg})")
end

.GetColorU32_Col(idx, alpha_mul = 1.0) ⇒ Object

arg: idx(ImGuiCol), alpha_mul(float) ret: uint



4047
4048
4049
# File 'lib/imgui.rb', line 4047

def self.GetColorU32_Col(idx, alpha_mul = 1.0)
  igGetColorU32_Col(idx, alpha_mul)
end

.GetColorU32_U32(col, alpha_mul = 1.0) ⇒ Object

arg: col(ImU32), alpha_mul(float) ret: uint



4059
4060
4061
# File 'lib/imgui.rb', line 4059

def self.GetColorU32_U32(col, alpha_mul = 1.0)
  igGetColorU32_U32(col, alpha_mul)
end

.GetColorU32_Vec4(col) ⇒ Object

arg: col(ImVec4) ret: uint



4053
4054
4055
# File 'lib/imgui.rb', line 4053

def self.GetColorU32_Vec4(col)
  igGetColorU32_Vec4(col)
end

.GetColumnIndexObject

ret: int



4064
4065
4066
# File 'lib/imgui.rb', line 4064

def self.GetColumnIndex()  # get current column index
  igGetColumnIndex()
end

.GetColumnOffset(column_index = -1)) ⇒ Object

arg: column_index(int) ret: float



4070
4071
4072
# File 'lib/imgui.rb', line 4070

def self.GetColumnOffset(column_index = -1)  # 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.0f
  igGetColumnOffset(column_index)
end

.GetColumnsCountObject

ret: int



4081
4082
4083
# File 'lib/imgui.rb', line 4081

def self.GetColumnsCount()
  igGetColumnsCount()
end

.GetColumnWidth(column_index = -1)) ⇒ Object

arg: column_index(int) ret: float



4076
4077
4078
# File 'lib/imgui.rb', line 4076

def self.GetColumnWidth(column_index = -1)  # get column width (in pixels). pass -1 to use current column
  igGetColumnWidth(column_index)
end

.GetContentRegionAvailObject

ret: void



4086
4087
4088
4089
4090
# File 'lib/imgui.rb', line 4086

def self.GetContentRegionAvail()  # available space from current position. THIS IS YOUR BEST FRIEND.
  pOut = ImVec2.new
  igGetContentRegionAvail(pOut)
  return pOut
end

.GetCurrentContextObject

ret: pointer



4093
4094
4095
# File 'lib/imgui.rb', line 4093

def self.GetCurrentContext()
  igGetCurrentContext()
end

.GetCurrentWindowObject

self.import_internal_symbols



41
42
43
# File 'lib/imgui_internal.rb', line 41

def self.GetCurrentWindow()
  igGetCurrentWindow()
end

.GetCursorPosObject

ret: void



4098
4099
4100
4101
4102
# File 'lib/imgui.rb', line 4098

def self.GetCursorPos()  # [window-local] cursor position in window-local coordinates. This is not your best friend.
  pOut = ImVec2.new
  igGetCursorPos(pOut)
  return pOut
end

.GetCursorPosXObject

ret: float



4105
4106
4107
# File 'lib/imgui.rb', line 4105

def self.GetCursorPosX()  # [window-local] "
  igGetCursorPosX()
end

.GetCursorPosYObject

ret: float



4110
4111
4112
# File 'lib/imgui.rb', line 4110

def self.GetCursorPosY()  # [window-local] "
  igGetCursorPosY()
end

.GetCursorScreenPosObject

ret: void

Layout cursor positioning

  • By “cursor” we mean the current output position.

  • The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down.

  • You can call SameLine() between widgets to undo the last carriage return and output at the right of the preceding widget.

  • YOU CAN DO 99% OF WHAT YOU NEED WITH ONLY GetCursorScreenPos() and GetContentRegionAvail().

  • Attention! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API:

    - Absolute coordinate:        GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions. -> this is the preferred way forward.
    - Window-local coordinates:   SameLine(offset), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), PushTextWrapPos()
    - Window-local coordinates:   GetContentRegionMax(), GetWindowContentRegionMin(), GetWindowContentRegionMax() --> all obsoleted. YOU DON'T NEED THEM.
    
  • GetCursorScreenPos() = GetCursorPos() + GetWindowPos(). GetWindowPos() is almost only ever useful to convert from window-local to absolute coordinates. Try not to use it.



4126
4127
4128
4129
4130
# File 'lib/imgui.rb', line 4126

def self.GetCursorScreenPos()  # cursor position, absolute coordinates. THIS IS YOUR BEST FRIEND (prefer using this rather than GetCursorPos(), also more useful to work with ImDrawList API).
  pOut = ImVec2.new
  igGetCursorScreenPos(pOut)
  return pOut
end

.GetCursorStartPosObject

ret: void



4133
4134
4135
4136
4137
# File 'lib/imgui.rb', line 4133

def self.GetCursorStartPos()  # [window-local] initial cursor position, in window-local coordinates. Call GetCursorScreenPos() after Begin() to get the absolute coordinates version.
  pOut = ImVec2.new
  igGetCursorStartPos(pOut)
  return pOut
end

.GetDragDropPayloadObject

ret: pointer



4140
4141
4142
# File 'lib/imgui.rb', line 4140

def self.GetDragDropPayload()  # peek directly into the current payload from anywhere. returns NULL when drag and drop is finished or inactive. use ImGuiPayload::IsDataType() to test for the payload type.
  igGetDragDropPayload()
end

.GetDrawDataObject

ret: pointer



4145
4146
4147
# File 'lib/imgui.rb', line 4145

def self.GetDrawData()  # valid after Render() and until the next call to NewFrame(). this is what you have to render.
  igGetDrawData()
end

.GetDrawListSharedDataObject

ret: pointer



4150
4151
4152
# File 'lib/imgui.rb', line 4150

def self.GetDrawListSharedData()  # you may use this when creating your own ImDrawList instances.
  igGetDrawListSharedData()
end

.GetFontObject

ret: pointer

Style read access

  • Use the ShowStyleEditor() function to interactively see/edit the colors.



4158
4159
4160
# File 'lib/imgui.rb', line 4158

def self.GetFont()  # get current font
  igGetFont()
end

.GetFontSizeObject

ret: float



4163
4164
4165
# File 'lib/imgui.rb', line 4163

def self.GetFontSize()  # get current font size (= height in pixels) of current font with current scale applied
  igGetFontSize()
end

.GetFontTexUvWhitePixelObject

ret: void



4168
4169
4170
4171
4172
# File 'lib/imgui.rb', line 4168

def self.GetFontTexUvWhitePixel()  # get UV coordinate for a white pixel, useful to draw custom shapes via the ImDrawList API
  pOut = ImVec2.new
  igGetFontTexUvWhitePixel(pOut)
  return pOut
end

.GetForegroundDrawListObject

ret: pointer



4175
4176
4177
# File 'lib/imgui.rb', line 4175

def self.GetForegroundDrawList()  # Implied viewport = NULL
  igGetForegroundDrawList()
end

.GetFrameCountObject

ret: int



4180
4181
4182
# File 'lib/imgui.rb', line 4180

def self.GetFrameCount()  # get global imgui frame count. incremented by 1 every frame.
  igGetFrameCount()
end

.GetFrameHeightObject

ret: float



4185
4186
4187
# File 'lib/imgui.rb', line 4185

def self.GetFrameHeight()  # ~ FontSize + style.FramePadding.y * 2
  igGetFrameHeight()
end

.GetFrameHeightWithSpacingObject

ret: float



4190
4191
4192
# File 'lib/imgui.rb', line 4190

def self.GetFrameHeightWithSpacing()  # ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets)
  igGetFrameHeightWithSpacing()
end

.GetID(*arg) ⇒ Object

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



5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
# File 'lib/imgui.rb', line 5933

def self.GetID(*arg)  # calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself
  # arg: 0:str_id(const char*)
  # ret: uint
  return igGetID_Str(arg[0]) if arg.length == 1 && (arg[0].kind_of?(String))
  # arg: 0:str_id_begin(const char*), 1:str_id_end(const char*)
  # ret: uint
  return igGetID_StrStr(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(String) && arg[1].kind_of?(String))
  # arg: 0:ptr_id(const void*)
  # ret: uint
  return igGetID_Ptr(arg[0]) if arg.length == 1 && (arg[0].kind_of?(FFI::Pointer))
  # arg: 0:int_id(int)
  # ret: uint
  return igGetID_Int(arg[0]) if arg.length == 1 && (arg[0].kind_of?(Integer))
  $stderr.puts("[Warning] GetID : No matching functions found (#{arg})")
end

.GetID_Int(int_id) ⇒ Object

arg: int_id(int) ret: uint



4214
4215
4216
# File 'lib/imgui.rb', line 4214

def self.GetID_Int(int_id)
  igGetID_Int(int_id)
end

.GetID_Ptr(ptr_id) ⇒ Object

arg: ptr_id(const void*) ret: uint



4208
4209
4210
# File 'lib/imgui.rb', line 4208

def self.GetID_Ptr(ptr_id)
  igGetID_Ptr(ptr_id)
end

.GetID_Str(str_id) ⇒ Object

arg: str_id(const char*) ret: uint



4196
4197
4198
# File 'lib/imgui.rb', line 4196

def self.GetID_Str(str_id)
  igGetID_Str(str_id)
end

.GetID_StrStr(str_id_begin, str_id_end) ⇒ Object

arg: str_id_begin(const char*), str_id_end(const char*) ret: uint



4202
4203
4204
# File 'lib/imgui.rb', line 4202

def self.GetID_StrStr(str_id_begin, str_id_end)
  igGetID_StrStr(str_id_begin, str_id_end)
end

.GetIOObject

ret: pointer

Main



4221
4222
4223
# File 'lib/imgui.rb', line 4221

def self.GetIO()  # access the ImGuiIO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags)
  igGetIO()
end

.GetItemIDObject

ret: uint



4226
4227
4228
# File 'lib/imgui.rb', line 4226

def self.GetItemID()  # get ID of last item (~~ often same ImGui::GetID(label) beforehand)
  igGetItemID()
end

.GetItemRectMaxObject

ret: void



4231
4232
4233
4234
4235
# File 'lib/imgui.rb', line 4231

def self.GetItemRectMax()  # get lower-right bounding rectangle of the last item (screen space)
  pOut = ImVec2.new
  igGetItemRectMax(pOut)
  return pOut
end

.GetItemRectMinObject

ret: void



4238
4239
4240
4241
4242
# File 'lib/imgui.rb', line 4238

def self.GetItemRectMin()  # get upper-left bounding rectangle of the last item (screen space)
  pOut = ImVec2.new
  igGetItemRectMin(pOut)
  return pOut
end

.GetItemRectSizeObject

ret: void



4245
4246
4247
4248
4249
# File 'lib/imgui.rb', line 4245

def self.GetItemRectSize()  # get size of last item
  pOut = ImVec2.new
  igGetItemRectSize(pOut)
  return pOut
end

.GetKeyName(key) ⇒ Object

arg: key(ImGuiKey) ret: pointer



4253
4254
4255
# File 'lib/imgui.rb', line 4253

def self.GetKeyName(key)  # [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared.
  igGetKeyName(key)
end

.GetKeyPressedAmount(key, repeat_delay, rate) ⇒ Object

arg: key(ImGuiKey), repeat_delay(float), rate(float) ret: int



4259
4260
4261
# File 'lib/imgui.rb', line 4259

def self.GetKeyPressedAmount(key, repeat_delay, rate)  # 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
  igGetKeyPressedAmount(key, repeat_delay, rate)
end

.GetMainViewportObject

ret: pointer

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.



4269
4270
4271
# File 'lib/imgui.rb', line 4269

def self.GetMainViewport()  # return primary/default viewport. This can never be NULL.
  igGetMainViewport()
end

.GetMouseClickedCount(button) ⇒ Object

arg: button(ImGuiMouseButton) ret: int



4275
4276
4277
# File 'lib/imgui.rb', line 4275

def self.GetMouseClickedCount(button)  # return the number of successive mouse-clicks at the time where a click happen (otherwise 0).
  igGetMouseClickedCount(button)
end

.GetMouseCursorObject

ret: int



4280
4281
4282
# File 'lib/imgui.rb', line 4280

def self.GetMouseCursor()  # get desired mouse cursor shape. Important: 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
  igGetMouseCursor()
end

.GetMouseDragDelta(button = 0, lock_threshold = -1.0)) ⇒ Object

arg: button(ImGuiMouseButton), lock_threshold(float) ret: void



4286
4287
4288
4289
4290
# File 'lib/imgui.rb', line 4286

def self.GetMouseDragDelta(button = 0, lock_threshold = -1.0)  # 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 (uses io.MouseDraggingThreshold if lock_threshold < 0.0f)
  pOut = ImVec2.new
  igGetMouseDragDelta(pOut, button, lock_threshold)
  return pOut
end

.GetMousePosObject

ret: void



4293
4294
4295
4296
4297
# File 'lib/imgui.rb', line 4293

def self.GetMousePos()  # shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
  pOut = ImVec2.new
  igGetMousePos(pOut)
  return pOut
end

.GetMousePosOnOpeningCurrentPopupObject

ret: void



4300
4301
4302
4303
4304
# File 'lib/imgui.rb', line 4300

def self.GetMousePosOnOpeningCurrentPopup()  # retrieve mouse position at the time of opening popup we have BeginPopup() into (helper to avoid user backing that value themselves)
  pOut = ImVec2.new
  igGetMousePosOnOpeningCurrentPopup(pOut)
  return pOut
end

.GetPlatformIOObject

ret: pointer



4307
4308
4309
# File 'lib/imgui.rb', line 4307

def self.GetPlatformIO()  # access the ImGuiPlatformIO structure (mostly hooks/functions to connect to platform/renderer and OS Clipboard, IME etc.)
  igGetPlatformIO()
end

.GetScrollMaxXObject

ret: float



4312
4313
4314
# File 'lib/imgui.rb', line 4312

def self.GetScrollMaxX()  # get maximum scrolling amount ~~ ContentSize.x - WindowSize.x - DecorationsSize.x
  igGetScrollMaxX()
end

.GetScrollMaxYObject

ret: float



4317
4318
4319
# File 'lib/imgui.rb', line 4317

def self.GetScrollMaxY()  # get maximum scrolling amount ~~ ContentSize.y - WindowSize.y - DecorationsSize.y
  igGetScrollMaxY()
end

.GetScrollXObject

ret: float

Windows Scrolling

  • Any change of Scroll will be applied at the beginning of next frame in the first call to Begin().

  • You may instead use SetNextWindowScroll() prior to calling Begin() to avoid this delay, as an alternative to using SetScrollX()/SetScrollY().



4326
4327
4328
# File 'lib/imgui.rb', line 4326

def self.GetScrollX()  # get scrolling amount [0 .. GetScrollMaxX()]
  igGetScrollX()
end

.GetScrollYObject

ret: float



4331
4332
4333
# File 'lib/imgui.rb', line 4331

def self.GetScrollY()  # get scrolling amount [0 .. GetScrollMaxY()]
  igGetScrollY()
end

.GetStateStorageObject

ret: pointer



4336
4337
4338
# File 'lib/imgui.rb', line 4336

def self.GetStateStorage()
  igGetStateStorage()
end

.GetStyleObject

ret: pointer



4341
4342
4343
# File 'lib/imgui.rb', line 4341

def self.GetStyle()  # access the Style structure (colors, sizes). Always use PushStyleColor(), PushStyleVar() to modify style mid-frame!
  igGetStyle()
end

.GetStyleColorName(idx) ⇒ Object

arg: idx(ImGuiCol) ret: pointer



4347
4348
4349
# File 'lib/imgui.rb', line 4347

def self.GetStyleColorName(idx)  # get a string corresponding to the enum value (for display, saving, etc.).
  igGetStyleColorName(idx)
end

.GetStyleColorVec4(idx) ⇒ Object

arg: idx(ImGuiCol) ret: pointer



4353
4354
4355
# File 'lib/imgui.rb', line 4353

def self.GetStyleColorVec4(idx)  # retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in.
  igGetStyleColorVec4(idx)
end

.GetTextLineHeightObject

ret: float



4358
4359
4360
# File 'lib/imgui.rb', line 4358

def self.GetTextLineHeight()  # ~ FontSize
  igGetTextLineHeight()
end

.GetTextLineHeightWithSpacingObject

ret: float



4363
4364
4365
# File 'lib/imgui.rb', line 4363

def self.GetTextLineHeightWithSpacing()  # ~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text)
  igGetTextLineHeightWithSpacing()
end

.GetTimeObject

ret: double



4368
4369
4370
# File 'lib/imgui.rb', line 4368

def self.GetTime()  # get global imgui time. incremented by io.DeltaTime every frame.
  igGetTime()
end

.GetTreeNodeToLabelSpacingObject

ret: float



4373
4374
4375
# File 'lib/imgui.rb', line 4373

def self.GetTreeNodeToLabelSpacing()  # horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode
  igGetTreeNodeToLabelSpacing()
end

.GetVersionObject

ret: pointer



4378
4379
4380
# File 'lib/imgui.rb', line 4378

def self.GetVersion()  # get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp)
  igGetVersion()
end

.GetWindowDrawListObject

ret: pointer



4383
4384
4385
# File 'lib/imgui.rb', line 4383

def self.GetWindowDrawList()  # get draw list associated to the current window, to append your own drawing primitives
  igGetWindowDrawList()
end

.GetWindowHeightObject

ret: float



4388
4389
4390
# File 'lib/imgui.rb', line 4388

def self.GetWindowHeight()  # get current window height (IT IS UNLIKELY YOU EVER NEED TO USE THIS). Shortcut for GetWindowSize().y.
  igGetWindowHeight()
end

.GetWindowPosObject

ret: void



4393
4394
4395
4396
4397
# File 'lib/imgui.rb', line 4393

def self.GetWindowPos()  # get current window position in screen space (IT IS UNLIKELY YOU EVER NEED TO USE THIS. Consider always using GetCursorScreenPos() and GetContentRegionAvail() instead)
  pOut = ImVec2.new
  igGetWindowPos(pOut)
  return pOut
end

.GetWindowSizeObject

ret: void



4400
4401
4402
4403
4404
# File 'lib/imgui.rb', line 4400

def self.GetWindowSize()  # get current window size (IT IS UNLIKELY YOU EVER NEED TO USE THIS. Consider always using GetCursorScreenPos() and GetContentRegionAvail() instead)
  pOut = ImVec2.new
  igGetWindowSize(pOut)
  return pOut
end

.GetWindowWidthObject

ret: float



4407
4408
4409
# File 'lib/imgui.rb', line 4407

def self.GetWindowWidth()  # get current window width (IT IS UNLIKELY YOU EVER NEED TO USE THIS). Shortcut for GetWindowSize().x.
  igGetWindowWidth()
end

.Image(user_texture_id, image_size, uv0 = ImVec2.create(0,0), uv1 = ImVec2.create(1,1), tint_col = ImVec4.create(1,1,1,1), border_col = ImVec4.create(0,0,0,0)) ⇒ Object

arg: user_texture_id(ImTextureID), image_size(ImVec2), uv0(ImVec2), uv1(ImVec2), tint_col(ImVec4), border_col(ImVec4) ret: void

Widgets: Images



4418
4419
4420
# File 'lib/imgui.rb', line 4418

def self.Image(user_texture_id, image_size, uv0 = ImVec2.create(0,0), uv1 = ImVec2.create(1,1), tint_col = ImVec4.create(1,1,1,1), border_col = ImVec4.create(0,0,0,0))  # Implied uv0 = ImVec2(0, 0), uv1 = ImVec2(1, 1), tint_col = ImVec4(1, 1, 1, 1), border_col = ImVec4(0, 0, 0, 0)
  igImage(user_texture_id, image_size, uv0, uv1, tint_col, border_col)
end

.ImageButton(str_id, user_texture_id, image_size, uv0 = ImVec2.create(0,0), uv1 = ImVec2.create(1,1), bg_col = ImVec4.create(0,0,0,0), tint_col = ImVec4.create(1,1,1,1)) ⇒ Object

arg: str_id(const char*), user_texture_id(ImTextureID), image_size(ImVec2), uv0(ImVec2), uv1(ImVec2), bg_col(ImVec4), tint_col(ImVec4) ret: bool



4424
4425
4426
# File 'lib/imgui.rb', line 4424

def self.ImageButton(str_id, user_texture_id, image_size, uv0 = ImVec2.create(0,0), uv1 = ImVec2.create(1,1), bg_col = ImVec4.create(0,0,0,0), tint_col = ImVec4.create(1,1,1,1))  # Implied uv0 = ImVec2(0, 0), uv1 = ImVec2(1, 1), bg_col = ImVec4(0, 0, 0, 0), tint_col = ImVec4(1, 1, 1, 1)
  igImageButton(str_id, user_texture_id, image_size, uv0, uv1, bg_col, tint_col)
end

.ImGui_ImplGlfw_GetBackendDataObject

Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts

It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
FIXME: multi-context support is not well tested and probably dysfunctional in this backend.
- Because glfwPollEvents() process all windows and some events may be called outside of it, you will need to register your own callbacks
  (passing install_callbacks=false in ImGui_ImplGlfw_InitXXX functions), set the current dear imgui context and then call our callbacks.
- Otherwise we may need to store a GLFWWindow* -> ImGuiContext* map and handle this in the backend, adding a little bit of extra complexity to it.
FIXME: some shared resources (mouse cursor shape, gamepad) are mishandled when using multi-context.


45
46
47
48
49
50
51
52
53
# File 'lib/imgui_impl_glfw.rb', line 45

def self.ImGui_ImplGlfw_GetBackendData()
  if ImGui::GetCurrentContext() != nil
    return @@g_BackendData[ImGui::GetCurrentContext().address]
    # io = ImGuiIO.new(ImGui::GetIO())
    # return ImGui_ImplGlfw_Data.new(io[:BackendPlatformUserData])
  else
    nil
  end
end

.ImGui_ImplGlfw_GetClipboardText(user_data) ⇒ Object



55
56
57
# File 'lib/imgui_impl_glfw.rb', line 55

def self.ImGui_ImplGlfw_GetClipboardText(user_data)
  glfwGetClipboardString(user_data)
end

.ImGui_ImplGlfw_InstallCallbacks(window) ⇒ Object



320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/imgui_impl_glfw.rb', line 320

def self.ImGui_ImplGlfw_InstallCallbacks(window)
  bd = ImGui_ImplGlfw_GetBackendData()

  bd.prevUserCallbackWindowFocus = GLFW.SetWindowFocusCallback(window, @@ImplGlfw_WindowFocusCallback)
  bd.prevUserCallbackCursorEnter = GLFW.SetCursorEnterCallback(window, @@ImplGlfw_CursorEnterCallback)
  bd.prevUserCallbackCursorPos = GLFW.SetCursorPosCallback(window, @@ImplGlfw_CursorPosCallback)
  bd.prevUserCallbackMousebutton = GLFW.SetMouseButtonCallback(window, @@ImplGlfw_MouseButtonCallback)
  bd.prevUserCallbackScroll = GLFW.SetScrollCallback(window, @@ImplGlfw_ScrollCallback)
  bd.prevUserCallbackKey = GLFW.SetKeyCallback(window, @@ImplGlfw_KeyCallback)
  bd.prevUserCallbackChar = GLFW.SetCharCallback(window, @@ImplGlfw_CharCallback)
  bd.prevUserCallbackMonitor = GLFW.SetMonitorCallback(@@ImplGlfw_MonitorCallback)
  bd.installedCallbacks = true
end

.ImGui_ImplGlfw_KeyToImGuiKey(key) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/imgui_impl_glfw.rb', line 63

def self.ImGui_ImplGlfw_KeyToImGuiKey(key)
  case key
  when GLFW::KEY_TAB then ImGuiKey_Tab
  when GLFW::KEY_LEFT then ImGuiKey_LeftArrow
  when GLFW::KEY_RIGHT then ImGuiKey_RightArrow
  when GLFW::KEY_UP then ImGuiKey_UpArrow
  when GLFW::KEY_DOWN then ImGuiKey_DownArrow
  when GLFW::KEY_PAGE_UP then ImGuiKey_PageUp
  when GLFW::KEY_PAGE_DOWN then ImGuiKey_PageDown
  when GLFW::KEY_HOME then ImGuiKey_Home
  when GLFW::KEY_END then ImGuiKey_End
  when GLFW::KEY_INSERT then ImGuiKey_Insert
  when GLFW::KEY_DELETE then ImGuiKey_Delete
  when GLFW::KEY_BACKSPACE then ImGuiKey_Backspace
  when GLFW::KEY_SPACE then ImGuiKey_Space
  when GLFW::KEY_ENTER then ImGuiKey_Enter
  when GLFW::KEY_ESCAPE then ImGuiKey_Escape
  when GLFW::KEY_APOSTROPHE then ImGuiKey_Apostrophe
  when GLFW::KEY_COMMA then ImGuiKey_Comma
  when GLFW::KEY_MINUS then ImGuiKey_Minus
  when GLFW::KEY_PERIOD then ImGuiKey_Period
  when GLFW::KEY_SLASH then ImGuiKey_Slash
  when GLFW::KEY_SEMICOLON then ImGuiKey_Semicolon
  when GLFW::KEY_EQUAL then ImGuiKey_Equal
  when GLFW::KEY_LEFT_BRACKET then ImGuiKey_LeftBracket
  when GLFW::KEY_BACKSLASH then ImGuiKey_Backslash
  when GLFW::KEY_RIGHT_BRACKET then ImGuiKey_RightBracket
  when GLFW::KEY_GRAVE_ACCENT then ImGuiKey_GraveAccent
  when GLFW::KEY_CAPS_LOCK then ImGuiKey_CapsLock
  when GLFW::KEY_SCROLL_LOCK then ImGuiKey_ScrollLock
  when GLFW::KEY_NUM_LOCK then ImGuiKey_NumLock
  when GLFW::KEY_PRINT_SCREEN then ImGuiKey_PrintScreen
  when GLFW::KEY_PAUSE then ImGuiKey_Pause
  when GLFW::KEY_KP_0 then ImGuiKey_Keypad0
  when GLFW::KEY_KP_1 then ImGuiKey_Keypad1
  when GLFW::KEY_KP_2 then ImGuiKey_Keypad2
  when GLFW::KEY_KP_3 then ImGuiKey_Keypad3
  when GLFW::KEY_KP_4 then ImGuiKey_Keypad4
  when GLFW::KEY_KP_5 then ImGuiKey_Keypad5
  when GLFW::KEY_KP_6 then ImGuiKey_Keypad6
  when GLFW::KEY_KP_7 then ImGuiKey_Keypad7
  when GLFW::KEY_KP_8 then ImGuiKey_Keypad8
  when GLFW::KEY_KP_9 then ImGuiKey_Keypad9
  when GLFW::KEY_KP_DECIMAL then ImGuiKey_KeypadDecimal
  when GLFW::KEY_KP_DIVIDE then ImGuiKey_KeypadDivide
  when GLFW::KEY_KP_MULTIPLY then ImGuiKey_KeypadMultiply
  when GLFW::KEY_KP_SUBTRACT then ImGuiKey_KeypadSubtract
  when GLFW::KEY_KP_ADD then ImGuiKey_KeypadAdd
  when GLFW::KEY_KP_ENTER then ImGuiKey_KeypadEnter
  when GLFW::KEY_KP_EQUAL then ImGuiKey_KeypadEqual
  when GLFW::KEY_LEFT_SHIFT then ImGuiKey_LeftShift
  when GLFW::KEY_LEFT_CONTROL then ImGuiKey_LeftCtrl
  when GLFW::KEY_LEFT_ALT then ImGuiKey_LeftAlt
  when GLFW::KEY_LEFT_SUPER then ImGuiKey_LeftSuper
  when GLFW::KEY_RIGHT_SHIFT then ImGuiKey_RightShift
  when GLFW::KEY_RIGHT_CONTROL then ImGuiKey_RightCtrl
  when GLFW::KEY_RIGHT_ALT then ImGuiKey_RightAlt
  when GLFW::KEY_RIGHT_SUPER then ImGuiKey_RightSuper
  when GLFW::KEY_MENU then ImGuiKey_Menu
  when GLFW::KEY_0 then ImGuiKey_0
  when GLFW::KEY_1 then ImGuiKey_1
  when GLFW::KEY_2 then ImGuiKey_2
  when GLFW::KEY_3 then ImGuiKey_3
  when GLFW::KEY_4 then ImGuiKey_4
  when GLFW::KEY_5 then ImGuiKey_5
  when GLFW::KEY_6 then ImGuiKey_6
  when GLFW::KEY_7 then ImGuiKey_7
  when GLFW::KEY_8 then ImGuiKey_8
  when GLFW::KEY_9 then ImGuiKey_9
  when GLFW::KEY_A then ImGuiKey_A
  when GLFW::KEY_B then ImGuiKey_B
  when GLFW::KEY_C then ImGuiKey_C
  when GLFW::KEY_D then ImGuiKey_D
  when GLFW::KEY_E then ImGuiKey_E
  when GLFW::KEY_F then ImGuiKey_F
  when GLFW::KEY_G then ImGuiKey_G
  when GLFW::KEY_H then ImGuiKey_H
  when GLFW::KEY_I then ImGuiKey_I
  when GLFW::KEY_J then ImGuiKey_J
  when GLFW::KEY_K then ImGuiKey_K
  when GLFW::KEY_L then ImGuiKey_L
  when GLFW::KEY_M then ImGuiKey_M
  when GLFW::KEY_N then ImGuiKey_N
  when GLFW::KEY_O then ImGuiKey_O
  when GLFW::KEY_P then ImGuiKey_P
  when GLFW::KEY_Q then ImGuiKey_Q
  when GLFW::KEY_R then ImGuiKey_R
  when GLFW::KEY_S then ImGuiKey_S
  when GLFW::KEY_T then ImGuiKey_T
  when GLFW::KEY_U then ImGuiKey_U
  when GLFW::KEY_V then ImGuiKey_V
  when GLFW::KEY_W then ImGuiKey_W
  when GLFW::KEY_X then ImGuiKey_X
  when GLFW::KEY_Y then ImGuiKey_Y
  when GLFW::KEY_Z then ImGuiKey_Z
  when GLFW::KEY_F1 then ImGuiKey_F1
  when GLFW::KEY_F2 then ImGuiKey_F2
  when GLFW::KEY_F3 then ImGuiKey_F3
  when GLFW::KEY_F4 then ImGuiKey_F4
  when GLFW::KEY_F5 then ImGuiKey_F5
  when GLFW::KEY_F6 then ImGuiKey_F6
  when GLFW::KEY_F7 then ImGuiKey_F7
  when GLFW::KEY_F8 then ImGuiKey_F8
  when GLFW::KEY_F9 then ImGuiKey_F9
  when GLFW::KEY_F10 then ImGuiKey_F10
  when GLFW::KEY_F11 then ImGuiKey_F11
  when GLFW::KEY_F12 then ImGuiKey_F12
  else ImGuiKey_None
  end
end

.ImGui_ImplGlfw_RestoreCallbacks(window) ⇒ Object



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/imgui_impl_glfw.rb', line 334

def self.ImGui_ImplGlfw_RestoreCallbacks(window)
  bd = ImGui_ImplGlfw_GetBackendData()
  GLFW.SetWindowFocusCallback(window, bd.prevUserCallbackWindowFocus)
  GLFW.SetCursorEnterCallback(window, bd.prevUserCallbackCursorEnter)
  GLFW.SetCursorPosCallback(window, bd.prevUserCallbackCursorPos)
  GLFW.SetMouseButtonCallback(window, bd.prevUserCallbackMousebutton)
  GLFW.SetScrollCallback(window, bd.prevUserCallbackScroll)
  GLFW.SetKeyCallback(window, bd.prevUserCallbackKey)
  GLFW.SetCharCallback(window, bd.prevUserCallbackChar)
  GLFW.SetMonitorCallback(bd.prevUserCallbackMonitor)

  bd.installedCallbacks = false
  bd.prevUserCallbackWindowFocus = nil
  bd.prevUserCallbackCursorEnter = nil
  bd.prevUserCallbackCursorPos = nil
  bd.prevUserCallbackMousebutton = nil
  bd.prevUserCallbackScroll = nil
  bd.prevUserCallbackKey = nil
  bd.prevUserCallbackChar = nil
  bd.prevUserCallbackMonitor = nil
end

.ImGui_ImplGlfw_SetClipboardText(user_data, text) ⇒ Object



59
60
61
# File 'lib/imgui_impl_glfw.rb', line 59

def self.ImGui_ImplGlfw_SetClipboardText(user_data, text)
  glfwSetClipboardString(user_data, text)
end

.ImGui_ImplGlfw_TranslateUntranslatedKey(key, scancode) ⇒ Object



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/imgui_impl_glfw.rb', line 208

def self.ImGui_ImplGlfw_TranslateUntranslatedKey(key, scancode)

  # GLFW 3.1+ attempts to "untranslate" keys, which goes the opposite of what every other framework does, making using lettered shortcuts difficult.
  # (It had reasons to do so: namely GLFW is/was more likely to be used for WASD-type game controls rather than lettered shortcuts, but IHMO the 3.1 change could have been done differently)
  # See https://github.com/glfw/glfw/issues/1502 for details.
  # Adding a workaround to undo this (so our keys are translated->untranslated->translated, likely a lossy process).
  # This won't cover edge cases but this is at least going to cover common cases.
  return key if key >= GLFW::KEY_KP_0 && key <= GLFW::KEY_KP_EQUAL

  key_name_ptr = GLFW.GetKeyName(key, scancode)
  unless key_name_ptr.null?
    key_name = key_name_ptr.to_s
    if key_name[0] != 0 && key_name[1] == 0
      char_names = "`-=[]\\,;\'./".chars
      char_keys = [GLFW::KEY_GRAVE_ACCENT, GLFW::KEY_MINUS, GLFW::KEY_EQUAL, GLFW::KEY_LEFT_BRACKET, GLFW::KEY_RIGHT_BRACKET, GLFW::KEY_BACKSLASH, GLFW::KEY_COMMA, GLFW::KEY_SEMICOLON, GLFW::KEY_APOSTROPHE, GLFW::KEY_PERIOD, GLFW::KEY_SLASH]

      if key_name[0] >= '0' && key_name[0] <= '9'
        key = GLFW::KEY_0 + (key_name[0] - '0')
      elsif key_name[0] >= 'A' && key_name[0] <= 'Z'
        key = GLFW::KEY_A + (key_name[0] - 'A')
      elsif char_names.include? key_name[0]
        key = char_keys[char_names.index(key_name[0])]
      end
    end
  end

  return key
end

.ImGui_ImplGlfw_UpdateKeyModifiers(mods) ⇒ Object



174
175
176
177
178
179
180
# File 'lib/imgui_impl_glfw.rb', line 174

def self.ImGui_ImplGlfw_UpdateKeyModifiers(mods)
  io = ImGuiIO.new(ImGui::GetIO())
  io.AddKeyEvent(ImGuiMod_Ctrl, (mods & GLFW::MOD_CONTROL) != 0)
  io.AddKeyEvent(ImGuiMod_Shift, (mods & GLFW::MOD_SHIFT) != 0)
  io.AddKeyEvent(ImGuiMod_Alt, (mods & GLFW::MOD_ALT) != 0)
  io.AddKeyEvent(ImGuiMod_Super, (mods & GLFW::MOD_SUPER) != 0)
end

.ImGui_ImplRaylib_GetBackendDataObject

INTERNAL


23
24
25
26
27
28
29
# File 'lib/imgui_impl_raylib.rb', line 23

def self.ImGui_ImplRaylib_GetBackendData()
  if ImGui::GetCurrentContext() != nil
    @@g_BackendData[ImGui::GetCurrentContext().address]
  else
    nil
  end
end

.ImGui_ImplRaylib_KeyToImGuiKey(key) ⇒ Object

INTERNAL


148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/imgui_impl_raylib.rb', line 148

def self.ImGui_ImplRaylib_KeyToImGuiKey(key)
  case key
  when Raylib::KEY_TAB then ImGuiKey_Tab
  when Raylib::KEY_LEFT then ImGuiKey_LeftArrow
  when Raylib::KEY_RIGHT then ImGuiKey_RightArrow
  when Raylib::KEY_UP then ImGuiKey_UpArrow
  when Raylib::KEY_DOWN then ImGuiKey_DownArrow
  when Raylib::KEY_PAGE_UP then ImGuiKey_PageUp
  when Raylib::KEY_PAGE_DOWN then ImGuiKey_PageDown
  when Raylib::KEY_HOME then ImGuiKey_Home
  when Raylib::KEY_END then ImGuiKey_End
  when Raylib::KEY_INSERT then ImGuiKey_Insert
  when Raylib::KEY_DELETE then ImGuiKey_Delete
  when Raylib::KEY_BACKSPACE then ImGuiKey_Backspace
  when Raylib::KEY_SPACE then ImGuiKey_Space
  when Raylib::KEY_ENTER then ImGuiKey_Enter
  when Raylib::KEY_ESCAPE then ImGuiKey_Escape
  when Raylib::KEY_APOSTROPHE then ImGuiKey_Apostrophe
  when Raylib::KEY_COMMA then ImGuiKey_Comma
  when Raylib::KEY_MINUS then ImGuiKey_Minus
  when Raylib::KEY_PERIOD then ImGuiKey_Period
  when Raylib::KEY_SLASH then ImGuiKey_Slash
  when Raylib::KEY_SEMICOLON then ImGuiKey_Semicolon
  when Raylib::KEY_EQUAL then ImGuiKey_Equal
  when Raylib::KEY_LEFT_BRACKET then ImGuiKey_LeftBracket
  when Raylib::KEY_BACKSLASH then ImGuiKey_Backslash
  when Raylib::KEY_RIGHT_BRACKET then ImGuiKey_RightBracket
  when Raylib::KEY_GRAVE then ImGuiKey_GraveAccent
  when Raylib::KEY_CAPS_LOCK then ImGuiKey_CapsLock
  when Raylib::KEY_SCROLL_LOCK then ImGuiKey_ScrollLock
  when Raylib::KEY_NUM_LOCK then ImGuiKey_NumLock
  when Raylib::KEY_PRINT_SCREEN then ImGuiKey_PrintScreen
  when Raylib::KEY_PAUSE then ImGuiKey_Pause
  when Raylib::KEY_KP_0 then ImGuiKey_Keypad0
  when Raylib::KEY_KP_1 then ImGuiKey_Keypad1
  when Raylib::KEY_KP_2 then ImGuiKey_Keypad2
  when Raylib::KEY_KP_3 then ImGuiKey_Keypad3
  when Raylib::KEY_KP_4 then ImGuiKey_Keypad4
  when Raylib::KEY_KP_5 then ImGuiKey_Keypad5
  when Raylib::KEY_KP_6 then ImGuiKey_Keypad6
  when Raylib::KEY_KP_7 then ImGuiKey_Keypad7
  when Raylib::KEY_KP_8 then ImGuiKey_Keypad8
  when Raylib::KEY_KP_9 then ImGuiKey_Keypad9
  when Raylib::KEY_KP_DECIMAL then ImGuiKey_KeypadDecimal
  when Raylib::KEY_KP_DIVIDE then ImGuiKey_KeypadDivide
  when Raylib::KEY_KP_MULTIPLY then ImGuiKey_KeypadMultiply
  when Raylib::KEY_KP_SUBTRACT then ImGuiKey_KeypadSubtract
  when Raylib::KEY_KP_ADD then ImGuiKey_KeypadAdd
  when Raylib::KEY_KP_ENTER then ImGuiKey_KeypadEnter
  when Raylib::KEY_KP_EQUAL then ImGuiKey_KeypadEqual
  when Raylib::KEY_LEFT_CONTROL then ImGuiKey_LeftCtrl
  when Raylib::KEY_LEFT_SHIFT then ImGuiKey_LeftShift
  when Raylib::KEY_LEFT_ALT then ImGuiKey_LeftAlt
  when Raylib::KEY_LEFT_SUPER then ImGuiKey_LeftSuper
  when Raylib::KEY_RIGHT_CONTROL then ImGuiKey_RightCtrl
  when Raylib::KEY_RIGHT_SHIFT then ImGuiKey_RightShift
  when Raylib::KEY_RIGHT_ALT then ImGuiKey_RightAlt
  when Raylib::KEY_RIGHT_SUPER then ImGuiKey_RightSuper
  when Raylib::KEY_MENU then ImGuiKey_Menu
  when Raylib::KEY_ZERO then ImGuiKey_0
  when Raylib::KEY_ONE then ImGuiKey_1
  when Raylib::KEY_TWO then ImGuiKey_2
  when Raylib::KEY_THREE then ImGuiKey_3
  when Raylib::KEY_FOUR then ImGuiKey_4
  when Raylib::KEY_FIVE then ImGuiKey_5
  when Raylib::KEY_SIX then ImGuiKey_6
  when Raylib::KEY_SEVEN then ImGuiKey_7
  when Raylib::KEY_EIGHT then ImGuiKey_8
  when Raylib::KEY_NINE then ImGuiKey_9
  when Raylib::KEY_A then ImGuiKey_A
  when Raylib::KEY_B then ImGuiKey_B
  when Raylib::KEY_C then ImGuiKey_C
  when Raylib::KEY_D then ImGuiKey_D
  when Raylib::KEY_E then ImGuiKey_E
  when Raylib::KEY_F then ImGuiKey_F
  when Raylib::KEY_G then ImGuiKey_G
  when Raylib::KEY_H then ImGuiKey_H
  when Raylib::KEY_I then ImGuiKey_I
  when Raylib::KEY_J then ImGuiKey_J
  when Raylib::KEY_K then ImGuiKey_K
  when Raylib::KEY_L then ImGuiKey_L
  when Raylib::KEY_M then ImGuiKey_M
  when Raylib::KEY_N then ImGuiKey_N
  when Raylib::KEY_O then ImGuiKey_O
  when Raylib::KEY_P then ImGuiKey_P
  when Raylib::KEY_Q then ImGuiKey_Q
  when Raylib::KEY_R then ImGuiKey_R
  when Raylib::KEY_S then ImGuiKey_S
  when Raylib::KEY_T then ImGuiKey_T
  when Raylib::KEY_U then ImGuiKey_U
  when Raylib::KEY_V then ImGuiKey_V
  when Raylib::KEY_W then ImGuiKey_W
  when Raylib::KEY_X then ImGuiKey_X
  when Raylib::KEY_Y then ImGuiKey_Y
  when Raylib::KEY_Z then ImGuiKey_Z
  when Raylib::KEY_F1 then ImGuiKey_F1
  when Raylib::KEY_F2 then ImGuiKey_F2
  when Raylib::KEY_F3 then ImGuiKey_F3
  when Raylib::KEY_F4 then ImGuiKey_F4
  when Raylib::KEY_F5 then ImGuiKey_F5
  when Raylib::KEY_F6 then ImGuiKey_F6
  when Raylib::KEY_F7 then ImGuiKey_F7
  when Raylib::KEY_F8 then ImGuiKey_F8
  when Raylib::KEY_F9 then ImGuiKey_F9
  when Raylib::KEY_F10 then ImGuiKey_F10
  when Raylib::KEY_F11 then ImGuiKey_F11
  when Raylib::KEY_F12 then ImGuiKey_F12
  else ImGuiKey_None
  end
end

.ImGui_ImplRaylib_UpdateKeyModifiersObject

INTERNAL


260
261
262
263
264
265
266
# File 'lib/imgui_impl_raylib.rb', line 260

def self.ImGui_ImplRaylib_UpdateKeyModifiers()
  io = ImGuiIO.new(ImGui::GetIO())
  io.AddKeyEvent(ImGuiMod_Ctrl, Raylib.IsKeyDown(Raylib::KEY_RIGHT_CONTROL) || Raylib.IsKeyDown(Raylib::KEY_LEFT_CONTROL))
  io.AddKeyEvent(ImGuiMod_Shift, Raylib.IsKeyDown(Raylib::KEY_RIGHT_SHIFT) || Raylib.IsKeyDown(Raylib::KEY_LEFT_SHIFT))
  io.AddKeyEvent(ImGuiMod_Alt, Raylib.IsKeyDown(Raylib::KEY_RIGHT_ALT) || Raylib.IsKeyDown(Raylib::KEY_LEFT_ALT))
  io.AddKeyEvent(ImGuiMod_Super, Raylib.IsKeyDown(Raylib::KEY_RIGHT_SUPER) || Raylib.IsKeyDown(Raylib::KEY_LEFT_SUPER))
end

.ImGui_ImplSDL2_GetBackendDataObject

Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts. FIXME: multi-context support is not well tested and probably dysfunctional in this backend. FIXME: some shared resources (mouse cursor shape, gamepad) are mishandled when using multi-context.

INTERNAL


32
33
34
35
36
37
38
# File 'lib/imgui_impl_sdl2.rb', line 32

def self.ImGui_ImplSDL2_GetBackendData()
  if ImGui::GetCurrentContext() != nil
    @@g_BackendData[ImGui::GetCurrentContext().address]
  else
    nil
  end
end

.ImGui_ImplSDL2_GetClipboardText(user_data) ⇒ Object

INTERNAL


46
47
48
49
50
51
# File 'lib/imgui_impl_sdl2.rb', line 46

def self.ImGui_ImplSDL2_GetClipboardText(user_data)
  bd = ImGui_ImplSDL2_GetBackendData()
  SDL.free(bd.clipboardTextData) if bd.clipboardTextData
  bd.clipboardTextData = SDL.GetClipboardText()
  return bd.clipboardTextData
end

.ImGui_ImplSDL2_KeyToImGuiKey(key) ⇒ Object

INTERNAL


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/imgui_impl_sdl2.rb', line 59

def self.ImGui_ImplSDL2_KeyToImGuiKey(key)
  case key
  when SDL::SDLK_TAB then ImGuiKey_Tab
  when SDL::SDLK_LEFT then ImGuiKey_LeftArrow
  when SDL::SDLK_RIGHT then ImGuiKey_RightArrow
  when SDL::SDLK_UP then ImGuiKey_UpArrow
  when SDL::SDLK_DOWN then ImGuiKey_DownArrow
  when SDL::SDLK_PAGEUP then ImGuiKey_PageUp
  when SDL::SDLK_PAGEDOWN then ImGuiKey_PageDown
  when SDL::SDLK_HOME then ImGuiKey_Home
  when SDL::SDLK_END then ImGuiKey_End
  when SDL::SDLK_INSERT then ImGuiKey_Insert
  when SDL::SDLK_DELETE then ImGuiKey_Delete
  when SDL::SDLK_BACKSPACE then ImGuiKey_Backspace
  when SDL::SDLK_SPACE then ImGuiKey_Space
  when SDL::SDLK_RETURN then ImGuiKey_Enter
  when SDL::SDLK_ESCAPE then ImGuiKey_Escape
  when SDL::SDLK_QUOTE then ImGuiKey_Apostrophe
  when SDL::SDLK_COMMA then ImGuiKey_Comma
  when SDL::SDLK_MINUS then ImGuiKey_Minus
  when SDL::SDLK_PERIOD then ImGuiKey_Period
  when SDL::SDLK_SLASH then ImGuiKey_Slash
  when SDL::SDLK_SEMICOLON then ImGuiKey_Semicolon
  when SDL::SDLK_EQUALS then ImGuiKey_Equal
  when SDL::SDLK_LEFTBRACKET then ImGuiKey_LeftBracket
  when SDL::SDLK_BACKSLASH then ImGuiKey_Backslash
  when SDL::SDLK_RIGHTBRACKET then ImGuiKey_RightBracket
  when SDL::SDLK_BACKQUOTE then ImGuiKey_GraveAccent
  when SDL::SDLK_CAPSLOCK then ImGuiKey_CapsLock
  when SDL::SDLK_SCROLLLOCK then ImGuiKey_ScrollLock
  when SDL::SDLK_NUMLOCKCLEAR then ImGuiKey_NumLock
  when SDL::SDLK_PRINTSCREEN then ImGuiKey_PrintScreen
  when SDL::SDLK_PAUSE then ImGuiKey_Pause
  when SDL::SDLK_KP_0 then ImGuiKey_Keypad0
  when SDL::SDLK_KP_1 then ImGuiKey_Keypad1
  when SDL::SDLK_KP_2 then ImGuiKey_Keypad2
  when SDL::SDLK_KP_3 then ImGuiKey_Keypad3
  when SDL::SDLK_KP_4 then ImGuiKey_Keypad4
  when SDL::SDLK_KP_5 then ImGuiKey_Keypad5
  when SDL::SDLK_KP_6 then ImGuiKey_Keypad6
  when SDL::SDLK_KP_7 then ImGuiKey_Keypad7
  when SDL::SDLK_KP_8 then ImGuiKey_Keypad8
  when SDL::SDLK_KP_9 then ImGuiKey_Keypad9
  when SDL::SDLK_KP_PERIOD then ImGuiKey_KeypadDecimal
  when SDL::SDLK_KP_DIVIDE then ImGuiKey_KeypadDivide
  when SDL::SDLK_KP_MULTIPLY then ImGuiKey_KeypadMultiply
  when SDL::SDLK_KP_MINUS then ImGuiKey_KeypadSubtract
  when SDL::SDLK_KP_PLUS then ImGuiKey_KeypadAdd
  when SDL::SDLK_KP_ENTER then ImGuiKey_KeypadEnter
  when SDL::SDLK_KP_EQUALS then ImGuiKey_KeypadEqual
  when SDL::SDLK_LCTRL then ImGuiKey_LeftCtrl
  when SDL::SDLK_LSHIFT then ImGuiKey_LeftShift
  when SDL::SDLK_LALT then ImGuiKey_LeftAlt
  when SDL::SDLK_LGUI then ImGuiKey_LeftSuper
  when SDL::SDLK_RCTRL then ImGuiKey_RightCtrl
  when SDL::SDLK_RSHIFT then ImGuiKey_RightShift
  when SDL::SDLK_RALT then ImGuiKey_RightAlt
  when SDL::SDLK_RGUI then ImGuiKey_RightSuper
  when SDL::SDLK_APPLICATION then ImGuiKey_Menu
  when SDL::SDLK_0 then ImGuiKey_0
  when SDL::SDLK_1 then ImGuiKey_1
  when SDL::SDLK_2 then ImGuiKey_2
  when SDL::SDLK_3 then ImGuiKey_3
  when SDL::SDLK_4 then ImGuiKey_4
  when SDL::SDLK_5 then ImGuiKey_5
  when SDL::SDLK_6 then ImGuiKey_6
  when SDL::SDLK_7 then ImGuiKey_7
  when SDL::SDLK_8 then ImGuiKey_8
  when SDL::SDLK_9 then ImGuiKey_9
  when SDL::SDLK_a then ImGuiKey_A
  when SDL::SDLK_b then ImGuiKey_B
  when SDL::SDLK_c then ImGuiKey_C
  when SDL::SDLK_d then ImGuiKey_D
  when SDL::SDLK_e then ImGuiKey_E
  when SDL::SDLK_f then ImGuiKey_F
  when SDL::SDLK_g then ImGuiKey_G
  when SDL::SDLK_h then ImGuiKey_H
  when SDL::SDLK_i then ImGuiKey_I
  when SDL::SDLK_j then ImGuiKey_J
  when SDL::SDLK_k then ImGuiKey_K
  when SDL::SDLK_l then ImGuiKey_L
  when SDL::SDLK_m then ImGuiKey_M
  when SDL::SDLK_n then ImGuiKey_N
  when SDL::SDLK_o then ImGuiKey_O
  when SDL::SDLK_p then ImGuiKey_P
  when SDL::SDLK_q then ImGuiKey_Q
  when SDL::SDLK_r then ImGuiKey_R
  when SDL::SDLK_s then ImGuiKey_S
  when SDL::SDLK_t then ImGuiKey_T
  when SDL::SDLK_u then ImGuiKey_U
  when SDL::SDLK_v then ImGuiKey_V
  when SDL::SDLK_w then ImGuiKey_W
  when SDL::SDLK_x then ImGuiKey_X
  when SDL::SDLK_y then ImGuiKey_Y
  when SDL::SDLK_z then ImGuiKey_Z
  when SDL::SDLK_F1 then ImGuiKey_F1
  when SDL::SDLK_F2 then ImGuiKey_F2
  when SDL::SDLK_F3 then ImGuiKey_F3
  when SDL::SDLK_F4 then ImGuiKey_F4
  when SDL::SDLK_F5 then ImGuiKey_F5
  when SDL::SDLK_F6 then ImGuiKey_F6
  when SDL::SDLK_F7 then ImGuiKey_F7
  when SDL::SDLK_F8 then ImGuiKey_F8
  when SDL::SDLK_F9 then ImGuiKey_F9
  when SDL::SDLK_F10 then ImGuiKey_F10
  when SDL::SDLK_F11 then ImGuiKey_F11
  when SDL::SDLK_F12 then ImGuiKey_F12
  else ImGuiKey_None
  end
end

.ImGui_ImplSDL2_SetClipboardText(user_data, text) ⇒ Object

INTERNAL


54
55
56
# File 'lib/imgui_impl_sdl2.rb', line 54

def self.ImGui_ImplSDL2_SetClipboardText(user_data, text)
  SDL.SetClipboardText(text)
end

.ImGui_ImplSDL2_UpdateKeyModifiers(sdl_key_mods) ⇒ Object

INTERNAL


171
172
173
174
175
176
177
# File 'lib/imgui_impl_sdl2.rb', line 171

def self.ImGui_ImplSDL2_UpdateKeyModifiers(sdl_key_mods)
  io = ImGuiIO.new(ImGui::GetIO())
  io.AddKeyEvent(ImGuiMod_Ctrl, (sdl_key_mods & SDL::KMOD_CTRL) != 0)
  io.AddKeyEvent(ImGuiMod_Shift, (sdl_key_mods & SDL::KMOD_SHIFT) != 0)
  io.AddKeyEvent(ImGuiMod_Alt, (sdl_key_mods & SDL::KMOD_ALT) != 0)
  io.AddKeyEvent(ImGuiMod_Super, (sdl_key_mods & SDL::KMOD_GUI) != 0)
end

.ImGui_ImplSDLRenderer_GetBackendDataObject



14
15
16
17
18
19
20
21
22
# File 'lib/imgui_impl_sdlrenderer.rb', line 14

def self.ImGui_ImplSDLRenderer_GetBackendData()
  if ImGui::GetCurrentContext() != nil
    io = ImGuiIO.new(ImGui::GetIO())
    instance = ImGui_ImplSDLRenderer_Data.new(io[:BackendRendererUserData])
    return instance
  else
    return nil
  end
end

.ImplGlfw_Init(window, install_callbacks, client_api) ⇒ Object

private



452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'lib/imgui_impl_glfw.rb', line 452

def self.ImplGlfw_Init(window, install_callbacks, client_api)
  # Setup backend capabilities flags
  bd = ImGui_ImplGlfw_Data.new
  @@g_BackendData[ImGui::GetCurrentContext().address] = bd

  io = ImGuiIO.new(ImGui::GetIO())
  io[:BackendPlatformName] = @@g_BackendPlatformName
  io[:BackendFlags] |= ImGuiBackendFlags_HasMouseCursors # We can honor GetMouseCursor() values (optional)
  io[:BackendFlags] |= ImGuiBackendFlags_HasSetMousePos  # We can honor io.WantSetMousePos requests (optional, rarely used)

  bd.window = window
  bd.time = 0.0

  # [TODO] Support ClipboardText & IME on Windows
  # io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText;
  # io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText;
  # io.ClipboardUserData = g_Window;
  # #if defined(_WIN32)
  # io.ImeWindowHandle = (void*)glfwGetWin32Window(g_Window);
  # #endif

  # GLFWerrorfun prev_error_callback = glfwSetErrorCallback(NULL);

  # Create mouse cursors
  # (By design, on X11 cursors are user configurable and some cursors may be missing. When a cursor doesn't exist,
  # GLFW will emit an error which will often be printed by the app, so we temporarily disable error reporting.
  # Missing cursors will return NULL and our _UpdateMouseCursor() function will use the Arrow cursor instead.)
  bd.mouseCursors[ImGuiMouseCursor_Arrow] = GLFW.CreateStandardCursor(GLFW::ARROW_CURSOR)
  bd.mouseCursors[ImGuiMouseCursor_TextInput] = GLFW.CreateStandardCursor(GLFW::IBEAM_CURSOR)
  bd.mouseCursors[ImGuiMouseCursor_ResizeNS] = GLFW.CreateStandardCursor(GLFW::VRESIZE_CURSOR)
  bd.mouseCursors[ImGuiMouseCursor_ResizeEW] = GLFW.CreateStandardCursor(GLFW::HRESIZE_CURSOR)
  bd.mouseCursors[ImGuiMouseCursor_Hand] = GLFW.CreateStandardCursor(GLFW::HAND_CURSOR)

  # GLFW_HAS_NEW_CURSORS == false
  bd.mouseCursors[ImGuiMouseCursor_ResizeAll] = GLFW.CreateStandardCursor(GLFW::ARROW_CURSOR)
  bd.mouseCursors[ImGuiMouseCursor_ResizeNESW] = GLFW.CreateStandardCursor(GLFW::ARROW_CURSOR)
  bd.mouseCursors[ImGuiMouseCursor_ResizeNWSE] = GLFW.CreateStandardCursor(GLFW::ARROW_CURSOR)
  bd.mouseCursors[ImGuiMouseCursor_NotAllowed] = GLFW.CreateStandardCursor(GLFW::ARROW_CURSOR)

  # glfwSetErrorCallback(prev_error_callback)

  # Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
  ImGui_ImplGlfw_InstallCallbacks(window) if install_callbacks

  # @@g_PrevUserCallbackMousebutton = nil
  # @@g_PrevUserCallbackScroll = nil
  # @@g_PrevUserCallbackKey = nil
  # @@g_PrevUserCallbackChar = nil
  # if install_callbacks
  #   @@g_PrevUserCallbackCursorEnter = GLFW.SetCursorEnterCallback(window, @@ImGui_ImplGlfw_CursorEnterCallback)
  #   @@g_PrevUserCallbackMousebutton = GLFW.SetMouseButtonCallback(window, @@ImplGlfw_MouseButtonCallback)
  #   @@g_PrevUserCallbackScroll = GLFW.SetScrollCallback(window, @@ImplGlfw_ScrollCallback)
  #   @@g_PrevUserCallbackKey = GLFW.SetKeyCallback(window, @@ImplGlfw_KeyCallback)
  #   @@g_PrevUserCallbackChar = GLFW.SetCharCallback(window, @@ImplGlfw_CharCallback)
  # end

  return true
end

.ImplGlfw_InitForOpenGL(window, install_callbacks) ⇒ Object



356
357
358
# File 'lib/imgui_impl_glfw.rb', line 356

def self.ImplGlfw_InitForOpenGL(window, install_callbacks)
  return ImplGlfw_Init(window, install_callbacks, :GlfwClientApi_OpenGL)
end

.ImplGlfw_NewFrameObject



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/imgui_impl_glfw.rb', line 412

def self.ImplGlfw_NewFrame()
  bd = ImGui_ImplGlfw_GetBackendData()
  io = ImGuiIO.new(ImGui::GetIO())
  # unless io[:Fonts].IsBuilt()
  #   puts "Font atlas not built! It is generally built by the renderer back-end. Missing call to renderer _NewFrame() function? e.g. ImGui_ImplOpenGL3_NewFrame()."
  # end

  #  Setup display size (every frame to accommodate for window resizing)
  w = ' ' * 4
  h = ' ' * 4
  display_w = ' ' * 4
  display_h = ' ' * 4
  GLFW.GetWindowSize(bd.window, w, h)
  GLFW.GetFramebufferSize(bd.window, display_w, display_h)

  w = w.unpack1('L')
  h = h.unpack1('L')
  io[:DisplaySize][:x] = w
  io[:DisplaySize][:y] = h

  if w > 0 && h > 0
    io[:DisplayFramebufferScale][:x] = display_w.unpack1('L') / w
    io[:DisplayFramebufferScale][:y] = display_h.unpack1('L') / h
  end

  #  Setup time step
  current_time = GLFW.GetTime()
  io[:DeltaTime] = bd.time > 0.0 ? (current_time - bd.time).to_f : (1.0/60.0)
  bd.time = current_time

  ImplGlfw_UpdateMouseData()
  ImplGlfw_UpdateMouseCursor()

  # TODO update gamepads
  # Update game controllers (if enabled and available)
  # ImGui_ImplGlfw_UpdateGamepads();
end

.ImplGlfw_ShutdownObject



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/imgui_impl_glfw.rb', line 360

def self.ImplGlfw_Shutdown()
  bd = ImGui_ImplGlfw_GetBackendData()
  io = ImGuiIO.new(ImGui::GetIO())

  ImGui_ImplGlfw_RestoreCallbacks(bd.window) if bd.installedCallbacks

  ImGuiMouseCursor_COUNT.times do |cursor_n|
    GLFW.DestroyCursor(bd.mouseCursors[cursor_n])
    bd.mouseCursors[cursor_n] = nil
  end

  io[:BackendPlatformName] = nil
  io[:BackendPlatformUserData] = nil
  @@g_BackendData[ImGui::GetCurrentContext()] = nil
end

.ImplGlfw_UpdateMouseCursorObject



395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/imgui_impl_glfw.rb', line 395

def self.ImplGlfw_UpdateMouseCursor()
  io = ImGuiIO.new(ImGui::GetIO())
  bd = ImGui_ImplGlfw_GetBackendData()
  return if ((io[:ConfigFlags] & ImGuiConfigFlags_NoMouseCursorChange) || GLFW.GetInputMode(bd.window, GLFW::CURSOR) == GLFW::CURSOR_DISABLED)

  imgui_cursor = ImGui::GetMouseCursor()
  if imgui_cursor == ImGuiMouseCursor_None || io[:MouseDrawCursor]
      # Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
      GLFW.SetInputMode(bd.window, GLFW::CURSOR, GLFW::CURSOR_HIDDEN)
  else
    # Show OS mouse cursor
    # FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
    GLFW.SetCursor(bd.window, bd.mouseCursors[imgui_cursor] ? bd.mouseCursors[imgui_cursor] : bd.mouseCursors[ImGuiMouseCursor_Arrow])
    GLFW.SetInputMode(bd.window, GLFW::CURSOR, GLFW::CURSOR_NORMAL)
  end
end

.ImplGlfw_UpdateMouseDataObject



376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/imgui_impl_glfw.rb', line 376

def self.ImplGlfw_UpdateMouseData()
  bd = ImGui_ImplGlfw_GetBackendData()
  io = ImGuiIO.new(ImGui::GetIO())

  is_app_focused = GLFW.GetWindowAttrib(bd.window, GLFW::FOCUSED) != 0
  if is_app_focused
    # (Optional) Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
    if io[:WantSetMousePos]
      GLFW.SetCursorPos(bd.window, io[:MousePos][:x].to_f, io[:MousePos][:y].to_f)
    elsif bd.mouseWindow != nil
      mouse_x = ' ' * 8
      mouse_y = ' ' * 8
      GLFW.GetCursorPos(bd.window, mouse_x, mouse_y)
      io[:MousePos][:x] = mouse_x.unpack1('d')
      io[:MousePos][:y] = mouse_y.unpack1('d')
    end
  end
end

.ImplOpenGL2_CreateDeviceObjectsObject



204
205
206
# File 'lib/imgui_impl_opengl2.rb', line 204

def self.ImplOpenGL2_CreateDeviceObjects()
  return ImplOpenGL2_CreateFontsTexture()
end

.ImplOpenGL2_CreateFontsTextureObject



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/imgui_impl_opengl2.rb', line 165

def self.ImplOpenGL2_CreateFontsTexture()
  #  Build texture atlas
  io = ImGuiIO.new(ImGui::GetIO())
  pixels = FFI::MemoryPointer.new :pointer
  width = FFI::MemoryPointer.new :int
  height = FFI::MemoryPointer.new :int
  io[:Fonts].GetTexDataAsRGBA32(pixels, width, height, nil)   #  Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.

  #  Upload texture to graphics system
  last_texture = ' ' * 4
  @@g_FontTexture = ' ' * 4
  GL.GetIntegerv(GL::TEXTURE_BINDING_2D, last_texture)
  GL.GenTextures(1, @@g_FontTexture)
  GL.BindTexture(GL::TEXTURE_2D, @@g_FontTexture.unpack1('L'))
  GL.TexParameteri(GL::TEXTURE_2D, GL::TEXTURE_MIN_FILTER, GL::LINEAR)
  GL.TexParameteri(GL::TEXTURE_2D, GL::TEXTURE_MAG_FILTER, GL::LINEAR)
  GL.PixelStorei(GL::UNPACK_ROW_LENGTH, 0)
  # Ruby/FFI <-> Fiddle pointer exchange
  pixels_ptr = Fiddle::Pointer.new(pixels.read_pointer.address)
  GL.TexImage2D(GL::TEXTURE_2D, 0, GL::RGBA, width.read_uint, height.read_uint, 0, GL::RGBA, GL::UNSIGNED_BYTE, pixels_ptr)

  #  Store our identifier
  io[:Fonts][:TexID] = @@g_FontTexture.unpack1('L')

  #  Restore state
  GL.BindTexture(GL::TEXTURE_2D, last_texture.unpack1('L'))

  return true
end

.ImplOpenGL2_DestroyDeviceObjectsObject



208
209
210
# File 'lib/imgui_impl_opengl2.rb', line 208

def self.ImplOpenGL2_DestroyDeviceObjects()
  ImplOpenGL2_DestroyFontsTexture()
end

.ImplOpenGL2_DestroyFontsTextureObject



195
196
197
198
199
200
201
202
# File 'lib/imgui_impl_opengl2.rb', line 195

def self.ImplOpenGL2_DestroyFontsTexture()
  if @@g_FontTexture != 0
    GL.DeleteTextures(1, @@g_FontTexture)
    io = ImGuiIO.new(ImGui::GetIO())
    io[:Fonts][:TexID] = 0
    @@g_FontTexture = 0
  end
end

.ImplOpenGL2_InitObject



11
12
13
14
15
16
# File 'lib/imgui_impl_opengl2.rb', line 11

def self.ImplOpenGL2_Init()
  io = ImGuiIO.new(ImGui::GetIO())
  io[:BackendRendererName] = @@g_BackendRendererName

  return true
end

.ImplOpenGL2_NewFrameObject



22
23
24
# File 'lib/imgui_impl_opengl2.rb', line 22

def self.ImplOpenGL2_NewFrame()
  ImplOpenGL2_CreateDeviceObjects() if @@g_FontTexture == nil
end

.ImplOpenGL2_RenderDrawData(draw_data_raw) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/imgui_impl_opengl2.rb', line 26

def self.ImplOpenGL2_RenderDrawData(draw_data_raw)
  #  Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
  draw_data = ImDrawData.new(draw_data_raw)
  fb_width = (draw_data[:DisplaySize][:x] * draw_data[:FramebufferScale][:x]).to_i
  fb_height = (draw_data[:DisplaySize][:y] * draw_data[:FramebufferScale][:y]).to_i

  return if fb_width == 0 || fb_height == 0

  #  Backup GL state
  last_texture = ' ' * 4
  GL.GetIntegerv(GL::TEXTURE_BINDING_2D, last_texture)
  last_polygon_mode = ' ' * 8
  GL.GetIntegerv(GL::POLYGON_MODE, last_polygon_mode)
  last_viewport = ' ' * 16
  GL.GetIntegerv(GL::VIEWPORT, last_viewport)
  last_scissor_box = ' ' * 16
  GL.GetIntegerv(GL::SCISSOR_BOX, last_scissor_box)
  GL.PushAttrib(GL::ENABLE_BIT | GL::COLOR_BUFFER_BIT | GL::TRANSFORM_BIT)
  last_shade_model = ' ' * 4
  GL.GetIntegerv(GL::SHADE_MODEL, last_shade_model)
  last_tex_env_mode = ' ' * 4
  GL.GetTexEnviv(GL::TEXTURE_ENV, GL::TEXTURE_ENV_MODE, last_tex_env_mode)

  #  Setup desired GL state
  ImplOpenGL2_SetupRenderState(draw_data, fb_width, fb_height)

  #  Will project scissor/clipping rectangles into framebuffer space
  clip_off = draw_data[:DisplayPos]         #  (0,0) unless using multi-viewports
  clip_scale = draw_data[:FramebufferScale] #  (1,1) unless using retina display which are often (2,2)

  #  Render command lists
  draw_data[:CmdListsCount].times do |n|
    cmd_list = ImDrawList.new((draw_data[:CmdLists][:Data] + 8 * n).read_pointer) # 8 == const ImDrawList*
    vtx_buffer = ImDrawVert.new(cmd_list[:VtxBuffer][:Data]) # const ImDrawVert*
    idx_buffer = cmd_list[:IdxBuffer][:Data] # const ImDrawIdx*
    GL.VertexPointer(2, GL::FLOAT, ImDrawVert.size,  Fiddle::Pointer.new((cmd_list[:VtxBuffer][:Data] + vtx_buffer.offset_of(:pos))) )
    GL.TexCoordPointer(2, GL::FLOAT, ImDrawVert.size,  Fiddle::Pointer.new((cmd_list[:VtxBuffer][:Data] + vtx_buffer.offset_of(:uv))) )
    GL.ColorPointer(4, GL::UNSIGNED_BYTE, ImDrawVert.size,  Fiddle::Pointer.new((cmd_list[:VtxBuffer][:Data] + vtx_buffer.offset_of(:col))) )

    cmd_list[:CmdBuffer][:Size].times do |cmd_i|
      pcmd = ImDrawCmd.new(cmd_list[:CmdBuffer][:Data] + ImDrawCmd.size * cmd_i) # const ImDrawCmd*
      if pcmd[:UserCallback] != nil
        # [TODO] Handle user callback (Ref.: https://github.com/ffi/ffi/wiki/Callbacks )

        #  User callback, registered via ImDrawList::AddCallback()
        #  (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
        # if pcmd[:UserCallback] == :ImDrawCallback_ResetRenderState
            ImGui_ImplOpenGL2_SetupRenderState(draw_data, fb_width, fb_height)
        # else
        #   pcmd[:UserCallback](cmd_list, pcmd)
        # end
      else
        #  Project scissor/clipping rectangles into framebuffer space
        clip_rect = ImVec4.new
        clip_rect[:x] = (pcmd[:ClipRect][:x] - clip_off[:x]) * clip_scale[:x]
        clip_rect[:y] = (pcmd[:ClipRect][:y] - clip_off[:y]) * clip_scale[:y]
        clip_rect[:z] = (pcmd[:ClipRect][:z] - clip_off[:x]) * clip_scale[:x]
        clip_rect[:w] = (pcmd[:ClipRect][:w] - clip_off[:y]) * clip_scale[:y]

        if (clip_rect[:x] < fb_width && clip_rect[:y] < fb_height && clip_rect[:z] >= 0.0 && clip_rect[:w] >= 0.0)
          #  Apply scissor/clipping rectangle
          GL.Scissor(clip_rect[:x].to_i, (fb_height - clip_rect[:w]).to_i, (clip_rect[:z] - clip_rect[:x]).to_i, (clip_rect[:w] - clip_rect[:y]).to_i)

          #  Bind texture, Draw
          GL.BindTexture(GL::TEXTURE_2D, pcmd[:TextureId].address)
          GL.DrawElements(GL::TRIANGLES, pcmd[:ElemCount], GL::UNSIGNED_SHORT, Fiddle::Pointer.new(idx_buffer.address))
        end

      end
      idx_buffer += pcmd[:ElemCount] * 2 # 2 == ImDrawIdx(:ushort).size
    end
  end

  #  Restore modified GL state
  GL.DisableClientState(GL::COLOR_ARRAY)
  GL.DisableClientState(GL::TEXTURE_COORD_ARRAY)
  GL.DisableClientState(GL::VERTEX_ARRAY)
  GL.BindTexture(GL::TEXTURE_2D, last_texture.unpack1('L'))
  GL.MatrixMode(GL::MODELVIEW)
  GL.PopMatrix()
  GL.MatrixMode(GL::PROJECTION)
  GL.PopMatrix()
  GL.PopAttrib()
  last_polygon_mode = last_polygon_mode.unpack('L2')
  GL.PolygonMode(GL::FRONT, last_polygon_mode[0])
  GL.PolygonMode(GL::BACK, last_polygon_mode[1])
  last_viewport = last_viewport.unpack('L4')
  GL.Viewport(last_viewport[0], last_viewport[1], last_viewport[2], last_viewport[3])
  last_scissor_box = last_scissor_box.unpack('L4')
  GL.Scissor(last_scissor_box[0], last_scissor_box[1], last_scissor_box[2], last_scissor_box[3])
  GL.ShadeModel(last_shade_model.unpack1('L'))
  GL.TexEnvi(GL::TEXTURE_ENV, GL::TEXTURE_ENV_MODE, last_tex_env_mode.unpack1('L'))
end

.ImplOpenGL2_SetupRenderState(draw_data, fb_width, fb_height) ⇒ Object

private



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/imgui_impl_opengl2.rb', line 122

def self.ImplOpenGL2_SetupRenderState(draw_data, fb_width, fb_height)
  # Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers, polygon fill.
  GL.Enable(GL::BLEND)
  GL.BlendFunc(GL::SRC_ALPHA, GL::ONE_MINUS_SRC_ALPHA)
  # GL.BlendFuncSeparate(GL::SRC_ALPHA, GL::ONE_MINUS_SRC_ALPHA, GL::ONE, GL::ONE_MINUS_SRC_ALPHA) # In order to composite our output buffer we need to preserve alpha
  GL.Disable(GL::CULL_FACE)
  GL.Disable(GL::STENCIL_TEST)
  GL.Disable(GL::DEPTH_TEST)
  GL.Disable(GL::LIGHTING)
  GL.Disable(GL::COLOR_MATERIAL)
  GL.Enable(GL::SCISSOR_TEST)
  GL.EnableClientState(GL::VERTEX_ARRAY)
  GL.EnableClientState(GL::TEXTURE_COORD_ARRAY)
  GL.EnableClientState(GL::COLOR_ARRAY)
  GL.DisableClientState(GL::NORMAL_ARRAY)
  GL.Enable(GL::TEXTURE_2D)
  GL.PolygonMode(GL::FRONT_AND_BACK, GL::FILL)
  GL.ShadeModel(GL::SMOOTH)
  GL.TexEnvi(GL::TEXTURE_ENV, GL::TEXTURE_ENV_MODE, GL::MODULATE)

  #  If you are using this code with non-legacy OpenGL header/contexts (which you should not, prefer using imgui_impl_opengl3.cpp!!),
  #  you may need to backup/reset/restore other state, e.g. for current shader using the commented lines below.
  #  (DO NOT MODIFY THIS FILE! Add the code in your calling function)
  #    GLint last_program;
  #    glGetIntegerv(GL::CURRENT_PROGRAM, &last_program);
  #    glUseProgram(0);
  #    ImGui_ImplOpenGL2_RenderDrawData(...);
  #    glUseProgram(last_program)
  #  There are potentially many more states you could need to clear/setup that we can't access from default headers.
  #  e.g. glBindBuffer(GL::ARRAY_BUFFER, 0), glDisable(GL::TEXTURE_CUBE_MAP).

  #  Setup viewport, orthographic projection matrix
  #  Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
  GL.Viewport(0, 0, fb_width, fb_height)
  GL.MatrixMode(GL::PROJECTION)
  GL.PushMatrix()
  GL.LoadIdentity()
  GL.Ortho(draw_data[:DisplayPos][:x], draw_data[:DisplayPos][:x] + draw_data[:DisplaySize][:x], draw_data[:DisplayPos][:y] + draw_data[:DisplaySize][:y], draw_data[:DisplayPos][:y], -1.0, +1.0)
  GL.MatrixMode(GL::MODELVIEW)
  GL.PushMatrix()
  GL.LoadIdentity()
end

.ImplOpenGL2_ShutdownObject



18
19
20
# File 'lib/imgui_impl_opengl2.rb', line 18

def self.ImplOpenGL2_Shutdown()
  ImplOpenGL2_DestroyDeviceObjects()
end

.ImplOpenGL3_CreateDeviceObjectsObject



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/imgui_impl_opengl3.rb', line 309

def self.ImplOpenGL3_CreateDeviceObjects()
  # Backup GL state
  last_texture, last_array_buffer = ' ' * 4, ' ' * 4
  GL.GetIntegerv(GL::TEXTURE_BINDING_2D, last_texture)
  GL.GetIntegerv(GL::ARRAY_BUFFER_BINDING, last_array_buffer)
  last_texture = last_texture.unpack1('L')
  last_array_buffer = last_array_buffer.unpack1('L')

  last_vertex_array = ' ' * 4
  GL.GetIntegerv(GL::VERTEX_ARRAY_BINDING, last_vertex_array)
  last_vertex_array = last_vertex_array.unpack1('L')

  glsl_version = @@g_GlslVersionString.split[1].to_i # == scanf(@@g_GlslVersionString, "#version %d")

  vertex_shader_glsl_120 = <<-'SRC'
  uniform mat4 ProjMtx;
  attribute vec2 Position;
  attribute vec2 UV;
  attribute vec4 Color;
  varying vec2 Frag_UV;
  varying vec4 Frag_Color;
  void main()
  {
      Frag_UV = UV;
      Frag_Color = Color;
      gl_Position = ProjMtx * vec4(Position.xy,0,1);
  }
  SRC

  vertex_shader_glsl_130 = <<-'SRC'
  uniform mat4 ProjMtx;
  in vec2 Position;
  in vec2 UV;
  in vec4 Color;
  out vec2 Frag_UV;
  out vec4 Frag_Color;
  void main()
  {
      Frag_UV = UV;
      Frag_Color = Color;
      gl_Position = ProjMtx * vec4(Position.xy,0,1);
  }
  SRC

  vertex_shader_glsl_300_es = <<-'SRC'
  precision mediump float;
  layout (location = 0) in vec2 Position;
  layout (location = 1) in vec2 UV;
  layout (location = 2) in vec4 Color;
  uniform mat4 ProjMtx;
  out vec2 Frag_UV;
  out vec4 Frag_Color;
  void main()
  {
      Frag_UV = UV;
      Frag_Color = Color;
      gl_Position = ProjMtx * vec4(Position.xy,0,1);
  }
  SRC

  vertex_shader_glsl_410_core = <<-'SRC'
  layout (location = 0) in vec2 Position;
  layout (location = 1) in vec2 UV;
  layout (location = 2) in vec4 Color;
  uniform mat4 ProjMtx;
  out vec2 Frag_UV;
  out vec4 Frag_Color;
  void main()
  {
      Frag_UV = UV;
      Frag_Color = Color;
      gl_Position = ProjMtx * vec4(Position.xy,0,1);
  }
  SRC

  fragment_shader_glsl_120 = <<-'SRC'
  #ifdef GL::ES
      precision mediump float;
  #endif
  uniform sampler2D Texture;
  varying vec2 Frag_UV;
  varying vec4 Frag_Color;
  void main()
  {
      gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);
  }
  SRC

  fragment_shader_glsl_130 = <<-'SRC'
  uniform sampler2D Texture;
  in vec2 Frag_UV;
  in vec4 Frag_Color;
  out vec4 Out_Color;
  void main()
  {
      Out_Color = Frag_Color * texture(Texture, Frag_UV.st);
  }
  SRC

  fragment_shader_glsl_300_es = <<-'SRC'
  precision mediump float;
  uniform sampler2D Texture;
  in vec2 Frag_UV;
  in vec4 Frag_Color;
  layout (location = 0) out vec4 Out_Color;
  void main()
  {
      Out_Color = Frag_Color * texture(Texture, Frag_UV.st);
  }
  SRC

  fragment_shader_glsl_410_core = <<-'SRC'
  in vec2 Frag_UV;
  in vec4 Frag_Color;
  uniform sampler2D Texture;
  layout (location = 0) out vec4 Out_Color;
  void main()
  {
      Out_Color = Frag_Color * texture(Texture, Frag_UV.st);
  }
  SRC

  vertex_shader, fragment_shader = if glsl_version < 130
                                     [vertex_shader_glsl_120, fragment_shader_glsl_120]
                                   elsif glsl_version >= 410
                                     [vertex_shader_glsl_410_core, fragment_shader_glsl_410_core]
                                   elsif glsl_version == 300
                                     [vertex_shader_glsl_300_es, fragment_shader_glsl_300_es]
                                   else
                                     [vertex_shader_glsl_130, fragment_shader_glsl_130]
                                   end

  vertex_shader.prepend(@@g_GlslVersionString + "\n")
  vert_handle = GL.CreateShader(GL::VERTEX_SHADER)
  GL.ShaderSource(vert_handle, 1, [vertex_shader].pack('p'), nil)
  GL.CompileShader(vert_handle)
  PrintShaderCompileStatus(vert_handle)

  fragment_shader.prepend(@@g_GlslVersionString + "\n")
  frag_handle = GL.CreateShader(GL::FRAGMENT_SHADER)
  GL.ShaderSource(frag_handle, 1, [fragment_shader].pack('p'), [fragment_shader.size].pack('I'))
  GL.CompileShader(frag_handle)
  PrintShaderCompileStatus(frag_handle)

  @@g_ShaderHandle = GL.CreateProgram()
  GL.AttachShader(@@g_ShaderHandle, vert_handle)
  GL.AttachShader(@@g_ShaderHandle, frag_handle)
  GL.LinkProgram(@@g_ShaderHandle)
  PrintProgramLinkStatus(@@g_ShaderHandle)

  GL.DetachShader(@@g_ShaderHandle, vert_handle)
  GL.DetachShader(@@g_ShaderHandle, frag_handle)
  GL.DeleteShader(vert_handle)
  GL.DeleteShader(frag_handle)

  @@g_AttribLocationTex = GL.GetUniformLocation(@@g_ShaderHandle, "Texture")
  @@g_AttribLocationProjMtx = GL.GetUniformLocation(@@g_ShaderHandle, "ProjMtx")

  @@g_AttribLocationVtxPos = GL.GetAttribLocation(@@g_ShaderHandle, "Position")
  @@g_AttribLocationVtxUV = GL.GetAttribLocation(@@g_ShaderHandle, "UV")
  @@g_AttribLocationVtxColor = GL.GetAttribLocation(@@g_ShaderHandle, "Color")

  # Create buffers
  posBuf = ' ' * 4
  GL.GenBuffers(1, posBuf)
  GL.BindBuffer(GL::ARRAY_BUFFER, posBuf.unpack('L')[0])

  @@g_VboHandle, @@g_ElementsHandle = ' ' * 4, ' ' * 4
  GL.GenBuffers(1, @@g_VboHandle)
  GL.GenBuffers(1, @@g_ElementsHandle)
  @@g_VboHandle = @@g_VboHandle.unpack1('L')
  @@g_ElementsHandle = @@g_ElementsHandle.unpack1('L')

  ImplOpenGL3_CreateFontsTexture()

  # Restore modified GL state
  GL.BindTexture(GL::TEXTURE_2D, last_texture)
  GL.BindBuffer(GL::ARRAY_BUFFER, last_array_buffer)
  GL.BindVertexArray(last_vertex_array)

  return true
end

.ImplOpenGL3_CreateFontsTextureObject



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/imgui_impl_opengl3.rb', line 267

def self.ImplOpenGL3_CreateFontsTexture()
  #  Build texture atlas
  io = ImGuiIO.new(ImGui::GetIO())
  pixels = FFI::MemoryPointer.new :pointer
  width = FFI::MemoryPointer.new :int
  height = FFI::MemoryPointer.new :int
  io[:Fonts].GetTexDataAsRGBA32(pixels, width, height, nil)   #  Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.

  #  Upload texture to graphics system
  last_texture = ' ' * 4
  @@g_FontTexture = ' ' * 4
  GL.GetIntegerv(GL::TEXTURE_BINDING_2D, last_texture)
  GL.GenTextures(1, @@g_FontTexture)
  GL.BindTexture(GL::TEXTURE_2D, @@g_FontTexture.unpack1('L'))
  GL.TexParameteri(GL::TEXTURE_2D, GL::TEXTURE_MIN_FILTER, GL::LINEAR)
  GL.TexParameteri(GL::TEXTURE_2D, GL::TEXTURE_MAG_FILTER, GL::LINEAR)
  GL.PixelStorei(GL::UNPACK_ROW_LENGTH, 0)
  # Ruby/FFI <-> Fiddle pointer exchange
  # p pixels
  # p pixels.read_pointer
  # p pixels.read_pointer.address.to_s(16)
  pixels_ptr = Fiddle::Pointer.new(pixels.read_pointer.address)
  GL.TexImage2D(GL::TEXTURE_2D, 0, GL::RGBA, width.read_uint, height.read_uint, 0, GL::RGBA, GL::UNSIGNED_BYTE, pixels_ptr)

  #  Store our identifier
  io[:Fonts][:TexID] = @@g_FontTexture.unpack1('L')

  #  Restore state
  GL.BindTexture(GL::TEXTURE_2D, last_texture.unpack1('L'))

  return true
end

.ImplOpenGL3_DestroyDeviceObjectsObject



492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/imgui_impl_opengl3.rb', line 492

def self.ImplOpenGL3_DestroyDeviceObjects()
  if @@g_VboHandle != 0
    GL.DeleteBuffers(1, [@@g_VboHandle].pack('L'))
    @@g_VboHandle = 0
  end
  if @@g_ElementsHandle != 0
    GL.DeleteBuffers(1, [@@g_ElementsHandle].pack('L'))
    @@g_ElementsHandle = 0
  end
  if @@g_ShaderHandle != 0
    GL.DeleteProgram(@@g_ShaderHandle)
    @@g_ShaderHandle = 0
  end

  ImplOpenGL3_DestroyFontsTexture()
end

.ImplOpenGL3_DestroyFontsTextureObject



300
301
302
303
304
305
306
307
# File 'lib/imgui_impl_opengl3.rb', line 300

def self.ImplOpenGL3_DestroyFontsTexture()
  if @@g_FontTexture != 0
    GL.DeleteTextures(1, @@g_FontTexture)
    io = ImGuiIO.new(ImGui::GetIO())
    io[:Fonts][:TexID] = 0
    @@g_FontTexture = 0
  end
end

.ImplOpenGL3_Init(glsl_version = nil) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/imgui_impl_opengl3.rb', line 62

def self.ImplOpenGL3_Init(glsl_version = nil)
  major, minor = ' ' * 4, ' ' * 4
  GL.GetIntegerv(GL::MAJOR_VERSION, major)
  GL.GetIntegerv(GL::MINOR_VERSION, minor)
  major = major.unpack1('L')
  minor = minor.unpack1('L')
  @@g_GlVersion = major * 1000 + minor

  io = ImGuiIO.new(ImGui::GetIO())
  io[:BackendRendererName] = @@g_BackendRendererName
  io[:BackendFlags] |= ImGuiBackendFlags_RendererHasVtxOffset if @@g_GlVersion >= 3200

  # Ref.: Fix imgui_impl_opengl3 on MacOS
  #       https://github.com/ocornut/imgui/pull/3199
  if GL.get_platform() == :OPENGL_PLATFORM_MACOSX
    glsl_version = "#version 150" if glsl_version == nil
  else
    glsl_version = "#version 130" if glsl_version == nil
  end

  @@g_GlslVersionString = glsl_version.dup

  return true
end

.ImplOpenGL3_NewFrameObject



91
92
93
# File 'lib/imgui_impl_opengl3.rb', line 91

def self.ImplOpenGL3_NewFrame()
  ImplOpenGL3_CreateDeviceObjects() if @@g_ShaderHandle == 0
end

.ImplOpenGL3_RenderDrawData(draw_data_raw) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/imgui_impl_opengl3.rb', line 95

def self.ImplOpenGL3_RenderDrawData(draw_data_raw)
  #  Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
  draw_data = ImDrawData.new(draw_data_raw)
  fb_width = (draw_data[:DisplaySize][:x] * draw_data[:FramebufferScale][:x]).to_i
  fb_height = (draw_data[:DisplaySize][:y] * draw_data[:FramebufferScale][:y]).to_i

  return if fb_width == 0 || fb_height == 0

  #  Backup GL state
  last_active_texture = ' ' * 4;  GL.GetIntegerv(GL::ACTIVE_TEXTURE, last_active_texture)
  last_program = ' ' * 4;  GL.GetIntegerv(GL::CURRENT_PROGRAM, last_program)
  last_texture = ' ' * 4;  GL.GetIntegerv(GL::TEXTURE_BINDING_2D, last_texture)

  last_sampler = ' ' * 4;  GL.GetIntegerv(GL::SAMPLER_BINDING, last_sampler)
  last_array_buffer = ' ' * 4;  GL.GetIntegerv(GL::ARRAY_BUFFER_BINDING, last_array_buffer)
  last_vertex_array_object = ' ' * 4;  GL.GetIntegerv(GL::VERTEX_ARRAY_BINDING, last_vertex_array_object)

  last_polygon_mode = ' ' * 8;  GL.GetIntegerv(GL::POLYGON_MODE, last_polygon_mode)
  last_viewport = ' ' * 16;  GL.GetIntegerv(GL::VIEWPORT, last_viewport)
  last_scissor_box = ' ' * 16;  GL.GetIntegerv(GL::SCISSOR_BOX, last_scissor_box)

  last_blend_src_rgb = ' ' * 4;  GL.GetIntegerv(GL::BLEND_SRC_RGB, last_blend_src_rgb)
  last_blend_dst_rgb = ' ' * 4;  GL.GetIntegerv(GL::BLEND_DST_RGB, last_blend_dst_rgb)
  last_blend_src_alpha = ' ' * 4;  GL.GetIntegerv(GL::BLEND_SRC_ALPHA, last_blend_src_alpha)
  last_blend_dst_alpha = ' ' * 4;  GL.GetIntegerv(GL::BLEND_DST_ALPHA, last_blend_dst_alpha)
  last_blend_equation_rgb = ' ' * 4;  GL.GetIntegerv(GL::BLEND_EQUATION_RGB, last_blend_equation_rgb)
  last_blend_equation_alpha = ' ' * 4;  GL.GetIntegerv(GL::BLEND_EQUATION_ALPHA, last_blend_equation_alpha)

  last_enable_blend = GL.IsEnabled(GL::BLEND)
  last_enable_cull_face = GL.IsEnabled(GL::CULL_FACE)
  last_enable_depth_test = GL.IsEnabled(GL::DEPTH_TEST)
  last_enable_stencil_test = GL.IsEnabled(GL::STENCIL_TEST)
  last_enable_scissor_test = GL.IsEnabled(GL::SCISSOR_TEST)

  #  Setup desired GL state
  vertex_array_object = ' ' * 4
  GL.GenVertexArrays(1, vertex_array_object)
  vertex_array_object = vertex_array_object.unpack1('L')
  ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object)

  #  Will project scissor/clipping rectangles into framebuffer space
  clip_off = draw_data[:DisplayPos]         #  (0,0) unless using multi-viewports
  clip_scale = draw_data[:FramebufferScale] #  (1,1) unless using retina display which are often (2,2)

  #  Render command lists
  draw_data[:CmdListsCount].times do |n|

    cmd_list = ImDrawList.new((draw_data[:CmdLists][:Data] + 8 * n).read_pointer) # 8 == const ImDrawList*
    # vtx_buffer = ImDrawVert.new(cmd_list[:VtxBuffer][:Data]) # const ImDrawVert*
    # idx_buffer = cmd_list[:IdxBuffer][:Data] # const ImDrawIdx*

    # Upload vertex/index buffers
    GL.BufferData(GL::ARRAY_BUFFER, cmd_list[:VtxBuffer][:Size] * ImDrawVert.size, Fiddle::Pointer.new(cmd_list[:VtxBuffer][:Data]), GL::STREAM_DRAW)
    # 2 == ImDrawIdx(:ushort).size
    GL.BufferData(GL::ELEMENT_ARRAY_BUFFER, cmd_list[:IdxBuffer][:Size] * 2, Fiddle::Pointer.new(cmd_list[:IdxBuffer][:Data]), GL::STREAM_DRAW) # [TODO] Refer ImGui::ImDrawIdx

    cmd_list[:CmdBuffer][:Size].times do |cmd_i|
      pcmd = ImDrawCmd.new(cmd_list[:CmdBuffer][:Data] + ImDrawCmd.size * cmd_i) # const ImDrawCmd*
      if pcmd[:UserCallback] != nil
        # [TODO] Handle user callback (Ref.: https://github.com/ffi/ffi/wiki/Callbacks )

        #  User callback, registered via ImDrawList::AddCallback()
        #  (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
        # if pcmd[:UserCallback] == :ImDrawCallback_ResetRenderState
            ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object)
        # else
        #   pcmd[:UserCallback](cmd_list, pcmd)
        # end
      else
        #  Project scissor/clipping rectangles into framebuffer space
        clip_rect = ImVec4.new
        clip_rect[:x] = (pcmd[:ClipRect][:x] - clip_off[:x]) * clip_scale[:x]
        clip_rect[:y] = (pcmd[:ClipRect][:y] - clip_off[:y]) * clip_scale[:y]
        clip_rect[:z] = (pcmd[:ClipRect][:z] - clip_off[:x]) * clip_scale[:x]
        clip_rect[:w] = (pcmd[:ClipRect][:w] - clip_off[:y]) * clip_scale[:y]

        if (clip_rect[:x] < fb_width && clip_rect[:y] < fb_height && clip_rect[:z] >= 0.0 && clip_rect[:w] >= 0.0)
          #  Apply scissor/clipping rectangle
          GL.Scissor(clip_rect[:x].to_i, (fb_height - clip_rect[:w]).to_i, (clip_rect[:z] - clip_rect[:x]).to_i, (clip_rect[:w] - clip_rect[:y]).to_i)

          #  Bind texture, Draw
          GL.BindTexture(GL::TEXTURE_2D, pcmd[:TextureId].address)

          if @@g_GlVersion >= 3200
            # 2 == ImDrawIdx(:ushort).size
            GL.DrawElementsBaseVertex(GL::TRIANGLES, pcmd[:ElemCount], GL::UNSIGNED_SHORT, Fiddle::Pointer.new(pcmd[:IdxOffset] * 2), pcmd[:VtxOffset])
          else
            # 2 == ImDrawIdx(:ushort).size
            GL.DrawElements(GL::TRIANGLES, pcmd[:ElemCount], GL::UNSIGNED_SHORT, Fiddle::Pointer.new(pcmd[:IdxOffset] * 2))
          end
        end

      end
      # idx_buffer += pcmd[:ElemCount] * 2 # 2 == ImDrawIdx(:ushort).size
    end
  end

  # Destroy the temporary VAO
  GL.DeleteVertexArrays(1, [vertex_array_object].pack('L'))

  #  Restore modified GL state
  GL.UseProgram(last_program.unpack1('L'))
  GL.BindTexture(GL::TEXTURE_2D, last_texture.unpack1('L'))
  GL.BindSampler(0, last_sampler.unpack1('L'))
  GL.ActiveTexture(last_active_texture.unpack1('L'))
  GL.BindVertexArray(last_vertex_array_object.unpack1('L'))
  GL.BindBuffer(GL::ARRAY_BUFFER, last_array_buffer.unpack1('L'))
  GL.BlendEquationSeparate(last_blend_equation_rgb.unpack1('L'), last_blend_equation_alpha.unpack1('L'))

  if last_enable_blend then GL.Enable(GL::BLEND) else GL.Disable(GL::BLEND) end
  if last_enable_cull_face then GL.Enable(GL::CULL_FACE) else GL.Disable(GL::CULL_FACE) end
  if last_enable_depth_test then GL.Enable(GL::DEPTH_TEST) else GL.Disable(GL::DEPTH_TEST) end
  if last_enable_stencil_test then GL.Enable(GL::STENCIL_TEST) else GL.Disable(GL::STENCIL_TEST) end
  if last_enable_scissor_test then GL.Enable(GL::SCISSOR_TEST) else GL.Disable(GL::SCISSOR_TEST) end

  last_polygon_mode = last_polygon_mode.unpack('L2')
  GL.PolygonMode(GL::FRONT_AND_BACK, last_polygon_mode[0])
  last_viewport = last_viewport.unpack('L4')
  GL.Viewport(last_viewport[0], last_viewport[1], last_viewport[2], last_viewport[3])
  last_scissor_box = last_scissor_box.unpack('L4')
  GL.Scissor(last_scissor_box[0], last_scissor_box[1], last_scissor_box[2], last_scissor_box[3])

end

.ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object) ⇒ Object

private



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/imgui_impl_opengl3.rb', line 221

def self.ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object)
  # Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
  GL.Enable(GL::BLEND)
  GL.BlendEquation(GL::FUNC_ADD)
  GL.BlendFuncSeparate(GL::SRC_ALPHA, GL::ONE_MINUS_SRC_ALPHA, GL::ONE, GL::ONE_MINUS_SRC_ALPHA)
  GL.Disable(GL::CULL_FACE)
  GL.Disable(GL::DEPTH_TEST)
  GL.Disable(GL::STENCIL_TEST)
  GL.Enable(GL::SCISSOR_TEST)
  GL.PolygonMode(GL::FRONT_AND_BACK, GL::FILL) # GL::POLYGON_MODE

  # Setup viewport, orthographic projection matrix
  # Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
  GL.Viewport(0, 0, fb_width, fb_height)
  l = draw_data[:DisplayPos][:x]
  r = draw_data[:DisplayPos][:x] + draw_data[:DisplaySize][:x]
  t = draw_data[:DisplayPos][:y]
  b = draw_data[:DisplayPos][:y] + draw_data[:DisplaySize][:y]
  ortho_projection = [
      2.0/(r-l),   0.0,         0.0,   0.0,
      0.0,         2.0/(t-b),   0.0,   0.0,
      0.0,         0.0,        -1.0,   0.0,
      (r+l)/(l-r),  (t+b)/(b-t),  0.0,   1.0,
  ]
  GL.UseProgram(@@g_ShaderHandle)
  GL.Uniform1i(@@g_AttribLocationTex, 0)
  GL.UniformMatrix4fv(@@g_AttribLocationProjMtx, 1, GL::FALSE, ortho_projection.pack('F16'))
  # GL::SAMPLER_BINDING
  GL.BindSampler(0, 0) # We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.

  GL.BindVertexArray(vertex_array_object)

  # Bind vertex/index buffers and setup attributes for ImDrawVert
  GL.BindBuffer(GL::ARRAY_BUFFER, @@g_VboHandle)
  GL.BindBuffer(GL::ELEMENT_ARRAY_BUFFER, @@g_ElementsHandle)

  GL.EnableVertexAttribArray(@@g_AttribLocationVtxPos)
  GL.EnableVertexAttribArray(@@g_AttribLocationVtxUV)
  GL.EnableVertexAttribArray(@@g_AttribLocationVtxColor)

  GL.VertexAttribPointer(@@g_AttribLocationVtxPos,   2, GL::FLOAT,         GL::FALSE, ImDrawVert.size, ImDrawVert.offset_of(:pos))
  GL.VertexAttribPointer(@@g_AttribLocationVtxUV,    2, GL::FLOAT,         GL::FALSE, ImDrawVert.size, ImDrawVert.offset_of(:uv))
  GL.VertexAttribPointer(@@g_AttribLocationVtxColor, 4, GL::UNSIGNED_BYTE, GL::TRUE,  ImDrawVert.size, ImDrawVert.offset_of(:col))

end

.ImplOpenGL3_ShutdownObject



87
88
89
# File 'lib/imgui_impl_opengl3.rb', line 87

def self.ImplOpenGL3_Shutdown()
  ImplOpenGL3_DestroyDeviceObjects()
end

.ImplRaylib_InitObject

TODO

Support ImplRaylib_UpdateGamepads



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/imgui_impl_raylib.rb', line 338

def self.ImplRaylib_Init()
  # Setup backend capabilities flags
  bd = ImGui_ImplRaylib_Data.new
  @@g_BackendData[ImGui::GetCurrentContext().address] = bd

  io = ImGuiIO.new(ImGui::GetIO())

  io[:BackendPlatformUserData] = nil
  io[:BackendPlatformName] = @@g_BackendPlatformName
  io[:BackendFlags] |= ImGuiBackendFlags_HasMouseCursors # We can honor GetMouseCursor() values (optional)
  io[:BackendFlags] |= ImGuiBackendFlags_HasSetMousePos  # We can honor io.WantSetMousePos requests (optional, rarely used)

  bd.time = 0.0

  return true
end

.ImplRaylib_NewFrameObject



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/imgui_impl_raylib.rb', line 362

def self.ImplRaylib_NewFrame()
  bd = ImGui_ImplRaylib_GetBackendData()
  io = ImGuiIO.new(ImGui::GetIO())

  #  Setup display size (every frame to accommodate for window resizing)
  io[:DisplaySize][:x] = Raylib.GetScreenWidth()
  io[:DisplaySize][:y] = Raylib.GetScreenHeight()

  # Setup time step
  current_time = Raylib.GetTime()

  io[:DeltaTime] = bd.time > 0 ? (current_time - bd.time).to_f : 1.0 / 60.0
  bd.time = current_time

  ImplRaylib_ProcessKeyboard()
  ImplRaylib_UpdateMouseData()
  ImplRaylib_UpdateMouseCursor()

  # [TODO] update gamepads
end

.ImplRaylib_ProcessKeyboardObject



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/imgui_impl_raylib.rb', line 268

def self.ImplRaylib_ProcessKeyboard()
  io = ImGuiIO.new(ImGui::GetIO())

  ImGui_ImplRaylib_UpdateKeyModifiers()

  KEY_IDS.each do |raylib_key|
    if Raylib.IsKeyPressed(raylib_key)
      key = ImGui_ImplRaylib_KeyToImGuiKey(raylib_key)
      io.AddKeyEvent(key, true)
    elsif Raylib.IsKeyReleased(raylib_key)
      key = ImGui_ImplRaylib_KeyToImGuiKey(raylib_key)
      io.AddKeyEvent(key, false)
    end
  end

  while (charPressed = Raylib.GetCharPressed()) != 0
    io.AddInputCharacter(charPressed)
  end

  return true
end

.ImplRaylib_RenderDrawData(draw_data_raw) ⇒ Object



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/imgui_impl_raylib.rb', line 390

def self.ImplRaylib_RenderDrawData(draw_data_raw)
  draw_data = ImDrawData.new(draw_data_raw)
  Raylib.rlDisableBackfaceCulling()

  clip_offset = draw_data[:DisplayPos]
  draw_data[:CmdListsCount].times do |n|
    cmd_list = ImDrawList.new((draw_data[:CmdLists][:Data] + FFI.type_size(:pointer) * n).read_pointer)
    vtx_buffer = cmd_list[:VtxBuffer][:Data] # const ImDrawVert*
    idx_buffer = cmd_list[:IdxBuffer][:Data] # const ImDrawIdx*

    cmd_list[:CmdBuffer][:Size].times do |cmd_i|
      pcmd = ImDrawCmd.new(cmd_list[:CmdBuffer][:Data] + ImDrawCmd.size * cmd_i) # const ImDrawCmd*
      if pcmd[:UserCallback] != nil
        # [TODO] Handle user callback (Ref.: https://github.com/ffi/ffi/wiki/Callbacks )
      else
        rect_min_x = (pcmd[:ClipRect][:x] - clip_offset[:x])
        rect_min_y = (pcmd[:ClipRect][:y] - clip_offset[:y])
        rect_max_x = (pcmd[:ClipRect][:z] - clip_offset[:x])
        rect_max_y = (pcmd[:ClipRect][:w] - clip_offset[:y])

        rect_w = rect_max_x - rect_min_x
        rect_h = rect_max_y - rect_min_y

        Raylib.BeginScissorMode(rect_min_x, rect_min_y, rect_w, rect_h)

        # Render triangles
        indices = idx_buffer + FFI.type_size(:ImDrawIdx) * pcmd[:IdxOffset]
        vertices = vtx_buffer + ImDrawVert.size * pcmd[:VtxOffset]
        0.step(pcmd[:ElemCount] - 3, 3) do |i|
          Raylib.rlPushMatrix()
            Raylib.rlBegin(Raylib::RL_TRIANGLES)
              Raylib.rlSetTexture(pcmd[:TextureId].read_uint32)

              index = indices.get_array_of_uint16(i * FFI::type_size(:ImDrawIdx), 3)

              base_offset = ImDrawVert.size * index[0]
              xy = vertices + (base_offset + ImDrawVert.offset_of(:pos))
              uv = vertices + (base_offset + ImDrawVert.offset_of(:uv))
              color = vertices + (base_offset + ImDrawVert.offset_of(:col))
              set_vertex(xy.read_array_of_float(2), uv.read_array_of_float(2), color.read_array_of_uint8(4))

              base_offset = ImDrawVert.size * index[2]
              xy = vertices + (base_offset + ImDrawVert.offset_of(:pos))
              uv = vertices + (base_offset + ImDrawVert.offset_of(:uv))
              color = vertices + (base_offset + ImDrawVert.offset_of(:col))
              set_vertex(xy.read_array_of_float(2), uv.read_array_of_float(2), color.read_array_of_uint8(4))

              base_offset = ImDrawVert.size * index[1]
              xy = vertices + (base_offset + ImDrawVert.offset_of(:pos))
              uv = vertices + (base_offset + ImDrawVert.offset_of(:uv))
              color = vertices + (base_offset + ImDrawVert.offset_of(:col))
              set_vertex(xy.read_array_of_float(2), uv.read_array_of_float(2), color.read_array_of_uint8(4))

              Raylib.rlSetTexture(0)
            Raylib.rlEnd()
          Raylib.rlPopMatrix()
        end
        Raylib.EndScissorMode()
      end
    end
  end
  Raylib.rlEnableBackfaceCulling()
end

.ImplRaylib_ShutdownObject



355
356
357
358
359
360
# File 'lib/imgui_impl_raylib.rb', line 355

def self.ImplRaylib_Shutdown()
  io = ImGuiIO.new(ImGui::GetIO())
  io[:BackendPlatformName] = nil
  io[:BackendPlatformUserData] = nil
  @@g_BackendData[ImGui::GetCurrentContext()] = nil
end

.ImplRaylib_UpdateMouseCursorObject

INTERNAL


323
324
325
326
327
328
329
330
331
332
# File 'lib/imgui_impl_raylib.rb', line 323

def self.ImplRaylib_UpdateMouseCursor()
  io = ImGuiIO.new(ImGui::GetIO())
  return if (io[:ConfigFlags] & ImGuiConfigFlags_NoMouseCursorChange)

  if io[:MouseDrawCursor] || ImGui::GetMouseCursor() == ImGuiMouseCursor_None
    Raylib.HideCursor() # Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
  else
    Raylib.ShowCursor() # Show OS mouse cursor
  end
end

.ImplRaylib_UpdateMouseDataObject

INTERNAL


291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/imgui_impl_raylib.rb', line 291

def self.ImplRaylib_UpdateMouseData()
  bd = ImGui_ImplRaylib_GetBackendData()
  io = ImGuiIO.new(ImGui::GetIO())

  # Set OS mouse position if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
  if io[:WantSetMousePos]
    Raylib.SetMousePosition(io[:MousePos][:x].to_i, io[:MousePos][:y].to_i)
  end

  wheel_move = Raylib.GetMouseWheelMove()
  wheel_y = if wheel_move > 0
              1.0
            elsif wheel_move < 0
              -1.0
            else
              0.0
            end
  io.AddMouseWheelEvent(0, wheel_y) # [TODO] Get wheel tilt from Raylib

  [Raylib::MOUSE_BUTTON_LEFT, Raylib::MOUSE_BUTTON_RIGHT, Raylib::MOUSE_BUTTON_MIDDLE].each_with_index do |button, mouse_button|
    pressed = Raylib.IsMouseButtonPressed(button)
    released = Raylib.IsMouseButtonReleased(button)
    if pressed || released
      io.AddMouseButtonEvent(mouse_button, pressed)
    end
  end

  mouse_pos = Raylib.GetMousePosition()
  io.AddMousePosEvent(mouse_pos[:x].to_f, mouse_pos[:y].to_f)
end

.ImplSDL2_Init(window, renderer) ⇒ Object



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/imgui_impl_sdl2.rb', line 237

def self.ImplSDL2_Init(window, renderer)

  # Check and store if we are on a SDL backend that supports global mouse position
  # ("wayland" and "rpi" don't support it, but we chose to use a white-list instead of a black-list)
  mouse_can_use_global_state = false
  sdl_backend = SDL.GetCurrentVideoDriver().read_string
  global_mouse_whitelist = ["windows", "cocoa", "x11", "DIVE", "VMAN"]
  global_mouse_whitelist.each do |platform|
    mouse_can_use_global_state = true if sdl_backend == platform
  end

  # Setup backend capabilities flags
  bd = ImGui_ImplSDL2_Data.new
  @@g_BackendData[ImGui::GetCurrentContext().address] = bd

  io = ImGuiIO.new(ImGui::GetIO())
  io[:BackendPlatformName] = @@g_BackendPlatformName
  io[:BackendFlags] |= ImGuiBackendFlags_HasMouseCursors # We can honor GetMouseCursor() values (optional)
  io[:BackendFlags] |= ImGuiBackendFlags_HasSetMousePos  # We can honor io.WantSetMousePos requests (optional, rarely used)

  bd.window = window
  bd.renderer = renderer
  bd.mouseCanUseGlobalState = mouse_can_use_global_state

  # [TODO] Support ClipboardText : pass callbacks as Proc or something
  # io[:SetClipboardTextFn] = ImGui_ImplSDL2_SetClipboardText
  # io[:GetClipboardTextFn] = ImGui_ImplSDL2_GetClipboardText
  io[:ClipboardUserData] = nil

  # Load mouse cursors
  bd.mouseCursors[ImGuiMouseCursor_Arrow]      = SDL.CreateSystemCursor(SDL::SYSTEM_CURSOR_ARROW)
  bd.mouseCursors[ImGuiMouseCursor_TextInput]  = SDL.CreateSystemCursor(SDL::SYSTEM_CURSOR_IBEAM)
  bd.mouseCursors[ImGuiMouseCursor_ResizeAll]  = SDL.CreateSystemCursor(SDL::SYSTEM_CURSOR_SIZEALL)
  bd.mouseCursors[ImGuiMouseCursor_ResizeNS]   = SDL.CreateSystemCursor(SDL::SYSTEM_CURSOR_SIZENS)
  bd.mouseCursors[ImGuiMouseCursor_ResizeEW]   = SDL.CreateSystemCursor(SDL::SYSTEM_CURSOR_SIZEWE)
  bd.mouseCursors[ImGuiMouseCursor_ResizeNESW] = SDL.CreateSystemCursor(SDL::SYSTEM_CURSOR_SIZENESW)
  bd.mouseCursors[ImGuiMouseCursor_ResizeNWSE] = SDL.CreateSystemCursor(SDL::SYSTEM_CURSOR_SIZENWSE)
  bd.mouseCursors[ImGuiMouseCursor_Hand]       = SDL.CreateSystemCursor(SDL::SYSTEM_CURSOR_HAND)
  bd.mouseCursors[ImGuiMouseCursor_NotAllowed] = SDL.CreateSystemCursor(SDL::SYSTEM_CURSOR_NO)

  # Set platform dependent data in viewport
  case RbConfig::CONFIG['host_os']
  when /mswin|msys|mingw|cygwin/
    info = SDL::SysWMinfo_win.new
    SDL.GetVersion(info[:version])
    if SDL.GetWindowWMInfo(window, info) == SDL::TRUE
      viewport = ImGuiViewport.new(ImGui::GetMainViewport())
      viewport[:PlatformHandleRaw] = info[:info][:win][:window]
    end
  end

  # Set SDL hint to receive mouse click events on window focus, otherwise SDL doesn't emit the event.
  # Without this, when clicking to gain focus, our widgets wouldn't activate even though they showed as hovered.
  # (This is unfortunately a global SDL setting, so enabling it might have a side-effect on your application.
  # It is unlikely to make a difference, but if your app absolutely needs to ignore the initial on-focus click:
  # you can ignore SDL_MOUSEBUTTONDOWN events coming right after a SDL_WINDOWEVENT_FOCUS_GAINED)
  if defined?(SDL::HINT_MOUSE_FOCUS_CLICKTHROUGH)
    SDL.SetHint(SDL::HINT_MOUSE_FOCUS_CLICKTHROUGH, "1")
  end

  return true
end

.ImplSDL2_NewFrameObject

TODO

Support ImplSDL2_UpdateGamepads



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/imgui_impl_sdl2.rb', line 364

def self.ImplSDL2_NewFrame()
  bd = ImGui_ImplSDL2_GetBackendData()
  io = ImGuiIO.new(ImGui::GetIO())

  #  Setup display size (every frame to accommodate for window resizing)
  w = ' ' * 4
  h = ' ' * 4
  display_w = ' ' * 4
  display_h = ' ' * 4
  SDL.GetWindowSize(bd.window, w, h)
  w = w.unpack1('L')
  h = h.unpack1('L')

  if (SDL.GetWindowFlags(bd.window) & SDL::WINDOW_MINIMIZED) != 0
    w = h = 0
  end
  if bd.renderer != nil
    SDL.GetRendererOutputSize(bd.renderer, display_w, display_h)
  else
    SDL.GL_GetDrawableSize(bd.window, display_w, display_h)
  end
  display_w = display_w.unpack1('L')
  display_h = display_h.unpack1('L')

  io[:DisplaySize] = ImVec2.create(w.to_f, h.to_f)

  if w > 0 && h > 0
    io[:DisplayFramebufferScale][:x] = display_w.to_f / w
    io[:DisplayFramebufferScale][:y] = display_h.to_f / h
  end

  # Setup time step (we don't use SDL_GetTicks() because it is using millisecond resolution)
  frequency = SDL.GetPerformanceFrequency()
  current_time = SDL.GetPerformanceCounter()

  io[:DeltaTime] = bd.time > 0 ? ((current_time - bd.time).to_f / frequency) : (1.0/60.0)
  bd.time = current_time

  ImplSDL2_UpdateMouseData()
  ImplSDL2_UpdateMouseCursor()

  # [TODO] update gamepads
  # ImGui_ImplSDL2_UpdateGamepads()
end

.ImplSDL2_ProcessEvent(event) ⇒ Object

You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.

  • When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.

  • When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.

Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. If you have multiple SDL events and some of them are not meant to be used by dear imgui, you may need to filter events based on their windowID field.



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/imgui_impl_sdl2.rb', line 184

def self.ImplSDL2_ProcessEvent(event)
  io = ImGuiIO.new(ImGui::GetIO())
  bd = ImGui_ImplSDL2_GetBackendData()

  case event[:type]

  when SDL::MOUSEMOTION
    io.AddMousePosEvent(event[:motion][:x].to_f, event[:motion][:y].to_f)
    return true

  when SDL::MOUSEWHEEL
    wheel_x = (event[:wheel][:x] > 0) ? 1.0 : (event[:wheel][:x] < 0) ? -1.0 : 0.0
    wheel_y = (event[:wheel][:y] > 0) ? 1.0 : (event[:wheel][:y] < 0) ? -1.0 : 0.0
    io.AddMouseWheelEvent(wheel_x, wheel_y)
    return true

  when SDL::MOUSEBUTTONDOWN, SDL::MOUSEBUTTONUP
    mouse_button = -1
    mouse_button = 0 if event[:button][:button] == SDL::BUTTON_LEFT
    mouse_button = 1 if event[:button][:button] == SDL::BUTTON_RIGHT
    mouse_button = 2 if event[:button][:button] == SDL::BUTTON_MIDDLE
    if mouse_button != -1
      io.AddMouseButtonEvent(mouse_button, event[:type] == SDL::MOUSEBUTTONDOWN)
      bd.mouseButtonsDown = (event[:type] == SDL::MOUSEBUTTONDOWN) ? (bd.mouseButtonsDown | (1 << mouse_button)) : (bd.mouseButtonsDown & ~(1 << mouse_button))
      return true
    end

  when SDL::TEXTINPUT
    io.AddInputCharactersUTF8(event[:text][:text])
    return true

  when SDL::KEYDOWN, SDL::KEYUP
    ImGui_ImplSDL2_UpdateKeyModifiers(event[:key][:keysym][:mod])
    key = ImGui_ImplSDL2_KeyToImGuiKey(event[:key][:keysym][:sym])
    io.AddKeyEvent(key, (event[:type] == SDL::KEYDOWN))
    io.SetKeyEventNativeData(key, event[:key][:keysym][:sym], event[:key][:keysym][:scancode], event[:key][:keysym][:scancode]) # To support legacy indexing (<1.87 user code). Legacy backend uses SDLK_*** as indices to IsKeyXXX() functions.
    return true

  when SDL::WINDOWEVENT
    io.AddMousePosEvent(-Float::MAX, -Float::MAX) if event[:window][:event] == SDL::WINDOWEVENT_LEAVE

    if event[:window][:event] == SDL::WINDOWEVENT_FOCUS_GAINED
      io.AddFocusEvent(true)
    elsif event[:window][:event] == SDL::WINDOWEVENT_FOCUS_LOST
      io.AddFocusEvent(false)
    end
    return true

  end

  return false
end

.ImplSDL2_ShutdownObject



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/imgui_impl_sdl2.rb', line 300

def self.ImplSDL2_Shutdown()
  io = ImGuiIO.new(ImGui::GetIO())
  bd = ImGui_ImplSDL2_GetBackendData()

  SDL.free(bd.clipboardTextData) if bd.clipboardTextData

  ImGuiMouseCursor_COUNT.times do |cursor_n|
    SDL.FreeCursor(bd.mouseCursors[cursor_n])
    bd.mouseCursors[cursor_n] = nil
  end

  io[:BackendPlatformName] = nil
  io[:BackendPlatformUserData] = nil
  @@g_BackendData[ImGui::GetCurrentContext()] = nil
end

.ImplSDL2_UpdateMouseCursorObject

INTERNAL


344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/imgui_impl_sdl2.rb', line 344

def self.ImplSDL2_UpdateMouseCursor()
  io = ImGuiIO.new(ImGui::GetIO())
  return if (io[:ConfigFlags] & ImGuiConfigFlags_NoMouseCursorChange)
  bd = ImGui_ImplSDL2_GetBackendData()

  imgui_cursor = ImGui::GetMouseCursor()
  if io[:MouseDrawCursor] || imgui_cursor == ImGuiMouseCursor_None
    # Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
    SDL.ShowCursor(SDL::FALSE)
  else
    # Show OS mouse cursor
    SDL.SetCursor(bd.mouseCursors[imgui_cursor] ? bd.mouseCursors[imgui_cursor] : bd.mouseCursors[ImGuiMouseCursor_Arrow])
    SDL.ShowCursor(SDL::TRUE)
  end
end

.ImplSDL2_UpdateMouseDataObject

INTERNAL


317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/imgui_impl_sdl2.rb', line 317

def self.ImplSDL2_UpdateMouseData()
  bd = ImGui_ImplSDL2_GetBackendData()
  io = ImGuiIO.new(ImGui::GetIO())

  SDL.CaptureMouse(bd.mouseButtonsDown != 0 ? SDL::TRUE : SDL::FALSE)
  focused_window = SDL.GetKeyboardFocus()
  is_app_focused = (bd.window == focused_window)
  if is_app_focused
    # (Optional) Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
    if io[:WantSetMousePos]
      SDL.WarpMouseInWindow(bd.window, io[:MousePos][:x].to_i, io[:MousePos][:y].to_i)
    end

    # (Optional) Fallback to provide mouse position when focused (SDL_MOUSEMOTION already provides this when hovered or captured)
    if bd.mouseCanUseGlobalState && bd.mouseButtonsDown == 0
      wx = FFI::MemoryPointer.new(:int)
      wy = FFI::MemoryPointer.new(:int)
      mx = FFI::MemoryPointer.new(:int)
      my = FFI::MemoryPointer.new(:int)
      SDL.GetGlobalMouseState(mx, my)
      SDL.GetWindowPosition(bd.window, wx, wy)
      io.AddMousePosEvent(mx.read(:int).to_f - wx.read(:int).to_f, my.read(:int).to_f - wy.read(:int).to_f)
    end
  end
end

.ImplSDLRenderer_CreateDeviceObjectsObject



192
193
194
# File 'lib/imgui_impl_sdlrenderer.rb', line 192

def self.ImplSDLRenderer_CreateDeviceObjects()
  return ImGui::ImplSDLRenderer_CreateFontsTexture()
end

.ImplSDLRenderer_CreateFontsTextureObject

Called by Init/NewFrame/Shutdown



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/imgui_impl_sdlrenderer.rb', line 156

def self.ImplSDLRenderer_CreateFontsTexture()
  io = ImGuiIO.new(ImGui::GetIO())
  bd = ImGui_ImplSDLRenderer_GetBackendData()

  # Build texture atlas
  pixels = FFI::MemoryPointer.new :pointer
  width = FFI::MemoryPointer.new :int
  height = FFI::MemoryPointer.new :int
  io[:Fonts].GetTexDataAsRGBA32(pixels, width, height, nil)   #  Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.

  # Upload texture to graphics system
  bd[:FontTexture] = SDL.CreateTexture(bd[:SDLRenderer], SDL::PIXELFORMAT_ABGR8888, SDL::TEXTUREACCESS_STATIC, width.read_int, height.read_int)
  if bd[:FontTexture] == nil
    SDL.Log("error creating texture")
    return false
  end

  SDL.UpdateTexture(bd[:FontTexture], nil, pixels.read_pointer, 4 * width.read_int)
  SDL.SetTextureBlendMode(bd[:FontTexture], SDL::BLENDMODE_BLEND)

  # Store our identifier
  io[:Fonts].SetTexID(bd[:FontTexture])

  return true
end

.ImplSDLRenderer_DestroyDeviceObjectsObject



196
197
198
# File 'lib/imgui_impl_sdlrenderer.rb', line 196

def self.ImplSDLRenderer_DestroyDeviceObjects()
  ImGui::ImplSDLRenderer_DestroyFontsTexture()
end

.ImplSDLRenderer_DestroyFontsTextureObject



182
183
184
185
186
187
188
189
190
# File 'lib/imgui_impl_sdlrenderer.rb', line 182

def self.ImplSDLRenderer_DestroyFontsTexture()
  io = ImGuiIO.new(ImGui::GetIO())
  bd = ImGui_ImplSDLRenderer_GetBackendData()
  if bd[:FontTexture] != nil
    io[:Fonts].SetTexID(nil)
    SDL.DestroyTexture(bd[:FontTexture])
    bd[:FontTexture] = nil
  end
end

.ImplSDLRenderer_Init(renderer) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/imgui_impl_sdlrenderer.rb', line 27

def self.ImplSDLRenderer_Init(renderer)
  io = ImGuiIO.new(ImGui::GetIO())

  # Setup backend capabilities flags

  io[:BackendRendererName] = @@g_BackendRendererName

  @@g_BackendRendererUserData = ImGui_ImplSDLRenderer_Data.new
  @@g_BackendRendererUserData[:SDLRenderer] = renderer
  @@g_BackendRendererUserData[:FontTexture] = nil
  io[:BackendRendererUserData] = @@g_BackendRendererUserData

  io[:BackendFlags] |= ImGuiBackendFlags_RendererHasVtxOffset # We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.

  return true
end

.ImplSDLRenderer_NewFrameObject



62
63
64
65
# File 'lib/imgui_impl_sdlrenderer.rb', line 62

def self.ImplSDLRenderer_NewFrame()
  bd = ImGui_ImplSDLRenderer_GetBackendData()
  ImGui::ImplSDLRenderer_CreateDeviceObjects() if bd[:FontTexture] == nil
end

.ImplSDLRenderer_RenderDrawData(draw_data_raw) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/imgui_impl_sdlrenderer.rb', line 67

def self.ImplSDLRenderer_RenderDrawData(draw_data_raw)
  draw_data = ImDrawData.new(draw_data_raw)
  bd = ImGui_ImplSDLRenderer_GetBackendData()

  # If there's a scale factor set by the user, use that instead
  # If the user has specified a scale factor to SDL_Renderer already via SDL_RenderSetScale(), SDL will scale whatever we pass
  # to SDL_RenderGeometryRaw() by that scale factor. In that case we don't want to be also scaling it ourselves here.
  rsx = FFI::MemoryPointer.new :float
  rsy = FFI::MemoryPointer.new :float
  SDL.RenderGetScale(bd[:SDLRenderer], rsx, rsy)
  render_scale = ImVec2.create(0, 0)
  render_scale[:x] = (rsx.read_float() == 1.0) ? draw_data[:FramebufferScale][:x] : 1.0
  render_scale[:y] = (rsy.read_float() == 1.0) ? draw_data[:FramebufferScale][:y] : 1.0

  # Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
  fb_width = (draw_data[:DisplaySize][:x] * render_scale[:x]).to_i
  fb_height = (draw_data[:DisplaySize][:y] * render_scale[:y]).to_i
  return if fb_width == 0 || fb_height == 0

  # Backup SDL_Renderer state that will be modified to restore it afterwards
  oldViewport = SDL::Rect.new
  oldClipEnabled = FFI::MemoryPointer.new :bool
  oldClipRect = SDL::Rect.new

  oldClipEnabled = (SDL.RenderIsClipEnabled(bd[:SDLRenderer]) == SDL::TRUE)
  SDL.RenderGetViewport(bd[:SDLRenderer], oldViewport)
  SDL.RenderGetClipRect(bd[:SDLRenderer], oldClipRect)

  # Will project scissor/clipping rectangles into framebuffer space
  clip_off = draw_data[:DisplayPos] # (0,0) unless using multi-viewports
  clip_scale = render_scale

  # Render command lists
  ImplSDLRenderer_SetupRenderState()
  draw_data[:CmdListsCount].times do |n|
    cmd_list = ImDrawList.new((draw_data[:CmdLists][:Data] + FFI.type_size(:pointer) * n).read_pointer)
    vtx_buffer = cmd_list[:VtxBuffer][:Data] # const ImDrawVert*
    idx_buffer = cmd_list[:IdxBuffer][:Data] # const ImDrawIdx*

    cmd_list[:CmdBuffer][:Size].times do |cmd_i|
      pcmd = ImDrawCmd.new(cmd_list[:CmdBuffer][:Data] + ImDrawCmd.size * cmd_i) # const ImDrawCmd*
      if pcmd[:UserCallback] != nil
        # [TODO] Handle user callback (Ref.: https://github.com/ffi/ffi/wiki/Callbacks )

        #  User callback, registered via ImDrawList::AddCallback()
        #  (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
        # if pcmd[:UserCallback] == :ImDrawCallback_ResetRenderState
          ImGui_ImplSDLRenderer_SetupRenderState()
        # else
        #   pcmd[:UserCallback](cmd_list, pcmd)
        # end
      else
        clip_min = ImVec2.create((pcmd[:ClipRect][:x] - clip_off[:x]) * clip_scale[:x], (pcmd[:ClipRect][:y] - clip_off[:y]) * clip_scale[:y])
        clip_max = ImVec2.create((pcmd[:ClipRect][:z] - clip_off[:x]) * clip_scale[:x], (pcmd[:ClipRect][:w] - clip_off[:y]) * clip_scale[:y])

        clip_min[:x] = 0.0 if clip_min[:x] < 0.0
        clip_min[:y] = 0.0 if clip_min[:y] < 0.0
        clip_max[:x] = fb_width.to_f if clip_max[:x] > fb_width
        clip_max[:y] = fb_height.to_f if clip_max[:y] > fb_height
        next if (clip_max[:x] <= clip_min[:x] || clip_max[:y] <= clip_min[:y])

        r = SDL::Rect.new
        r[:x] = clip_min[:x].to_i
        r[:y] = clip_min[:y].to_i
        r[:w] = (clip_max[:x] - clip_min[:x]).to_i
        r[:h] = (clip_max[:y] - clip_min[:y]).to_i

        SDL.RenderSetClipRect(bd[:SDLRenderer], r.to_ptr)

        xy = vtx_buffer + (pcmd[:VtxOffset] + ImDrawVert.offset_of(:pos))
        uv = vtx_buffer + (pcmd[:VtxOffset] + ImDrawVert.offset_of(:uv))
        color = vtx_buffer + (pcmd[:VtxOffset] + ImDrawVert.offset_of(:col))

        SDL.RenderGeometryRaw(bd[:SDLRenderer], pcmd[:TextureId],
                              xy, ImDrawVert.size,
                              color, ImDrawVert.size,
                              uv, ImDrawVert.size,
                              cmd_list[:VtxBuffer][:Size] - pcmd[:VtxOffset],
                              idx_buffer + FFI.type_size(:ImDrawIdx) * pcmd[:IdxOffset], pcmd[:ElemCount], FFI.type_size(:ImDrawIdx)) # FFI.type_size(:ImDrawIdx) == FFI::Type::UINT16.size

        # Restore modified SDL_Renderer state
        SDL.RenderSetViewport(bd[:SDLRenderer], oldViewport)
        SDL.RenderSetClipRect(bd[:SDLRenderer], oldClipEnabled ? oldClipRect : nil)
      end
    end
  end
end

.ImplSDLRenderer_SetupRenderStateObject

Internal


53
54
55
56
57
58
59
60
# File 'lib/imgui_impl_sdlrenderer.rb', line 53

def self.ImplSDLRenderer_SetupRenderState()
  bd = ImGui_ImplSDLRenderer_GetBackendData()

  # Clear out any viewports and cliprect set by the user
  # FIXME: Technically speaking there are lots of other things we could backup/setup/restore during our render process.
  SDL.RenderSetViewport(bd[:SDLRenderer], nil)
  SDL.RenderSetClipRect(bd[:SDLRenderer], nil)
end

.ImplSDLRenderer_ShutdownObject



44
45
46
47
48
49
50
# File 'lib/imgui_impl_sdlrenderer.rb', line 44

def self.ImplSDLRenderer_Shutdown()
  ImplSDLRenderer_DestroyDeviceObjects()
  io = ImGuiIO.new(ImGui::GetIO())
  io[:BackendRendererName] = nil
  io[:BackendRendererUserData] = nil
  @@g_BackendRendererUserData = nil
end

.import_internal_symbols(output_error = false) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/imgui_internal.rb', line 13

def self.import_internal_symbols(output_error = false)

  symbols = [
    :igFocusWindow,
    :igGetCurrentWindow,
  ]

  args = {
    :igFocusWindow => [:pointer],
    :igGetCurrentWindow => [],
  }

  retvals = {
    :igFocusWindow => :void,
    :igGetCurrentWindow => :pointer,
  }

  symbols.each do |sym|
    begin
      attach_function sym, args[sym], retvals[sym]
    rescue FFI::NotFoundError
      $stderr.puts("[Warning] Failed to import #{sym}.\n") if output_error
    end
  end

  @@imgui_import_internal_done = true
end

.import_symbols(output_error = false) ⇒ Object



2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
# File 'lib/imgui.rb', line 2724

def self.import_symbols(output_error = false)
callback :ImDrawCallback, [ImDrawList, ImDrawCmd], :void
callback :ImGuiInputTextCallback, [ImGuiInputTextCallbackData], :int
callback :ImGuiSizeCallback, [ImGuiSizeCallbackData], :void

entries = [
  [:ImDrawCmd_GetTexID, [:pointer], :pointer],
  [:ImDrawCmd_ImDrawCmd, [], :pointer],
  [:ImDrawCmd_destroy, [:pointer], :void],
  [:ImDrawData_AddDrawList, [:pointer, :pointer], :void],
  [:ImDrawData_Clear, [:pointer], :void],
  [:ImDrawData_DeIndexAllBuffers, [:pointer], :void],
  [:ImDrawData_ImDrawData, [], :pointer],
  [:ImDrawData_ScaleClipRects, [:pointer, ImVec2.by_value], :void],
  [:ImDrawData_destroy, [:pointer], :void],
  [:ImDrawListSplitter_Clear, [:pointer], :void],
  [:ImDrawListSplitter_ClearFreeMemory, [:pointer], :void],
  [:ImDrawListSplitter_ImDrawListSplitter, [], :pointer],
  [:ImDrawListSplitter_Merge, [:pointer, :pointer], :void],
  [:ImDrawListSplitter_SetCurrentChannel, [:pointer, :pointer, :int], :void],
  [:ImDrawListSplitter_Split, [:pointer, :pointer, :int], :void],
  [:ImDrawListSplitter_destroy, [:pointer], :void],
  [:ImDrawList_AddBezierCubic, [:pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint, :float, :int], :void],
  [:ImDrawList_AddBezierQuadratic, [:pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint, :float, :int], :void],
  [:ImDrawList_AddCallback, [:pointer, :ImDrawCallback, :pointer], :void],
  [:ImDrawList_AddCircle, [:pointer, ImVec2.by_value, :float, :uint, :int, :float], :void],
  [:ImDrawList_AddCircleFilled, [:pointer, ImVec2.by_value, :float, :uint, :int], :void],
  [:ImDrawList_AddConcavePolyFilled, [:pointer, :pointer, :int, :uint], :void],
  [:ImDrawList_AddConvexPolyFilled, [:pointer, :pointer, :int, :uint], :void],
  [:ImDrawList_AddDrawCmd, [:pointer], :void],
  [:ImDrawList_AddEllipse, [:pointer, ImVec2.by_value, ImVec2.by_value, :uint, :float, :int, :float], :void],
  [:ImDrawList_AddEllipseFilled, [:pointer, ImVec2.by_value, ImVec2.by_value, :uint, :float, :int], :void],
  [:ImDrawList_AddImage, [:pointer, :pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint], :void],
  [:ImDrawList_AddImageQuad, [:pointer, :pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint], :void],
  [:ImDrawList_AddImageRounded, [:pointer, :pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint, :float, :int], :void],
  [:ImDrawList_AddLine, [:pointer, ImVec2.by_value, ImVec2.by_value, :uint, :float], :void],
  [:ImDrawList_AddNgon, [:pointer, ImVec2.by_value, :float, :uint, :int, :float], :void],
  [:ImDrawList_AddNgonFilled, [:pointer, ImVec2.by_value, :float, :uint, :int], :void],
  [:ImDrawList_AddPolyline, [:pointer, :pointer, :int, :uint, :int, :float], :void],
  [:ImDrawList_AddQuad, [:pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint, :float], :void],
  [:ImDrawList_AddQuadFilled, [:pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint], :void],
  [:ImDrawList_AddRect, [:pointer, ImVec2.by_value, ImVec2.by_value, :uint, :float, :int, :float], :void],
  [:ImDrawList_AddRectFilled, [:pointer, ImVec2.by_value, ImVec2.by_value, :uint, :float, :int], :void],
  [:ImDrawList_AddRectFilledMultiColor, [:pointer, ImVec2.by_value, ImVec2.by_value, :uint, :uint, :uint, :uint], :void],
  [:ImDrawList_AddText_Vec2, [:pointer, ImVec2.by_value, :uint, :pointer, :pointer], :void],
  [:ImDrawList_AddText_FontPtr, [:pointer, :pointer, :float, ImVec2.by_value, :uint, :pointer, :pointer, :float, :pointer], :void],
  [:ImDrawList_AddTriangle, [:pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint, :float], :void],
  [:ImDrawList_AddTriangleFilled, [:pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint], :void],
  [:ImDrawList_ChannelsMerge, [:pointer], :void],
  [:ImDrawList_ChannelsSetCurrent, [:pointer, :int], :void],
  [:ImDrawList_ChannelsSplit, [:pointer, :int], :void],
  [:ImDrawList_CloneOutput, [:pointer], :pointer],
  [:ImDrawList_GetClipRectMax, [:pointer, :pointer], :void],
  [:ImDrawList_GetClipRectMin, [:pointer, :pointer], :void],
  [:ImDrawList_ImDrawList, [:pointer], :pointer],
  [:ImDrawList_PathArcTo, [:pointer, ImVec2.by_value, :float, :float, :float, :int], :void],
  [:ImDrawList_PathArcToFast, [:pointer, ImVec2.by_value, :float, :int, :int], :void],
  [:ImDrawList_PathBezierCubicCurveTo, [:pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :int], :void],
  [:ImDrawList_PathBezierQuadraticCurveTo, [:pointer, ImVec2.by_value, ImVec2.by_value, :int], :void],
  [:ImDrawList_PathClear, [:pointer], :void],
  [:ImDrawList_PathEllipticalArcTo, [:pointer, ImVec2.by_value, ImVec2.by_value, :float, :float, :float, :int], :void],
  [:ImDrawList_PathFillConcave, [:pointer, :uint], :void],
  [:ImDrawList_PathFillConvex, [:pointer, :uint], :void],
  [:ImDrawList_PathLineTo, [:pointer, ImVec2.by_value], :void],
  [:ImDrawList_PathLineToMergeDuplicate, [:pointer, ImVec2.by_value], :void],
  [:ImDrawList_PathRect, [:pointer, ImVec2.by_value, ImVec2.by_value, :float, :int], :void],
  [:ImDrawList_PathStroke, [:pointer, :uint, :int, :float], :void],
  [:ImDrawList_PopClipRect, [:pointer], :void],
  [:ImDrawList_PopTextureID, [:pointer], :void],
  [:ImDrawList_PrimQuadUV, [:pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint], :void],
  [:ImDrawList_PrimRect, [:pointer, ImVec2.by_value, ImVec2.by_value, :uint], :void],
  [:ImDrawList_PrimRectUV, [:pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, :uint], :void],
  [:ImDrawList_PrimReserve, [:pointer, :int, :int], :void],
  [:ImDrawList_PrimUnreserve, [:pointer, :int, :int], :void],
  [:ImDrawList_PrimVtx, [:pointer, ImVec2.by_value, ImVec2.by_value, :uint], :void],
  [:ImDrawList_PrimWriteIdx, [:pointer, :ushort], :void],
  [:ImDrawList_PrimWriteVtx, [:pointer, ImVec2.by_value, ImVec2.by_value, :uint], :void],
  [:ImDrawList_PushClipRect, [:pointer, ImVec2.by_value, ImVec2.by_value, :bool], :void],
  [:ImDrawList_PushClipRectFullScreen, [:pointer], :void],
  [:ImDrawList_PushTextureID, [:pointer, :pointer], :void],
  [:ImDrawList__CalcCircleAutoSegmentCount, [:pointer, :float], :int],
  [:ImDrawList__ClearFreeMemory, [:pointer], :void],
  [:ImDrawList__OnChangedClipRect, [:pointer], :void],
  [:ImDrawList__OnChangedTextureID, [:pointer], :void],
  [:ImDrawList__OnChangedVtxOffset, [:pointer], :void],
  [:ImDrawList__PathArcToFastEx, [:pointer, ImVec2.by_value, :float, :int, :int, :int], :void],
  [:ImDrawList__PathArcToN, [:pointer, ImVec2.by_value, :float, :float, :float, :int], :void],
  [:ImDrawList__PopUnusedDrawCmd, [:pointer], :void],
  [:ImDrawList__ResetForNewFrame, [:pointer], :void],
  [:ImDrawList__SetTextureID, [:pointer, :pointer], :void],
  [:ImDrawList__TryMergeDrawCmds, [:pointer], :void],
  [:ImDrawList_destroy, [:pointer], :void],
  [:ImFontAtlasCustomRect_ImFontAtlasCustomRect, [], :pointer],
  [:ImFontAtlasCustomRect_IsPacked, [:pointer], :bool],
  [:ImFontAtlasCustomRect_destroy, [:pointer], :void],
  [:ImFontAtlas_AddCustomRectFontGlyph, [:pointer, :pointer, :ushort, :int, :int, :float, ImVec2.by_value], :int],
  [:ImFontAtlas_AddCustomRectRegular, [:pointer, :int, :int], :int],
  [:ImFontAtlas_AddFont, [:pointer, :pointer], :pointer],
  [:ImFontAtlas_AddFontDefault, [:pointer, :pointer], :pointer],
  [:ImFontAtlas_AddFontFromFileTTF, [:pointer, :pointer, :float, :pointer, :pointer], :pointer],
  [:ImFontAtlas_AddFontFromMemoryCompressedBase85TTF, [:pointer, :pointer, :float, :pointer, :pointer], :pointer],
  [:ImFontAtlas_AddFontFromMemoryCompressedTTF, [:pointer, :pointer, :int, :float, :pointer, :pointer], :pointer],
  [:ImFontAtlas_AddFontFromMemoryTTF, [:pointer, :pointer, :int, :float, :pointer, :pointer], :pointer],
  [:ImFontAtlas_Build, [:pointer], :bool],
  [:ImFontAtlas_CalcCustomRectUV, [:pointer, :pointer, :pointer, :pointer], :void],
  [:ImFontAtlas_Clear, [:pointer], :void],
  [:ImFontAtlas_ClearFonts, [:pointer], :void],
  [:ImFontAtlas_ClearInputData, [:pointer], :void],
  [:ImFontAtlas_ClearTexData, [:pointer], :void],
  [:ImFontAtlas_GetCustomRectByIndex, [:pointer, :int], :pointer],
  [:ImFontAtlas_GetGlyphRangesChineseFull, [:pointer], :pointer],
  [:ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon, [:pointer], :pointer],
  [:ImFontAtlas_GetGlyphRangesCyrillic, [:pointer], :pointer],
  [:ImFontAtlas_GetGlyphRangesDefault, [:pointer], :pointer],
  [:ImFontAtlas_GetGlyphRangesGreek, [:pointer], :pointer],
  [:ImFontAtlas_GetGlyphRangesJapanese, [:pointer], :pointer],
  [:ImFontAtlas_GetGlyphRangesKorean, [:pointer], :pointer],
  [:ImFontAtlas_GetGlyphRangesThai, [:pointer], :pointer],
  [:ImFontAtlas_GetGlyphRangesVietnamese, [:pointer], :pointer],
  [:ImFontAtlas_GetMouseCursorTexData, [:pointer, :int, :pointer, :pointer, :pointer, :pointer], :bool],
  [:ImFontAtlas_GetTexDataAsAlpha8, [:pointer, :pointer, :pointer, :pointer, :pointer], :void],
  [:ImFontAtlas_GetTexDataAsRGBA32, [:pointer, :pointer, :pointer, :pointer, :pointer], :void],
  [:ImFontAtlas_ImFontAtlas, [], :pointer],
  [:ImFontAtlas_IsBuilt, [:pointer], :bool],
  [:ImFontAtlas_SetTexID, [:pointer, :pointer], :void],
  [:ImFontAtlas_destroy, [:pointer], :void],
  [:ImFontConfig_ImFontConfig, [], :pointer],
  [:ImFontConfig_destroy, [:pointer], :void],
  [:ImFontGlyphRangesBuilder_AddChar, [:pointer, :ushort], :void],
  [:ImFontGlyphRangesBuilder_AddRanges, [:pointer, :pointer], :void],
  [:ImFontGlyphRangesBuilder_AddText, [:pointer, :pointer, :pointer], :void],
  [:ImFontGlyphRangesBuilder_BuildRanges, [:pointer, :pointer], :void],
  [:ImFontGlyphRangesBuilder_Clear, [:pointer], :void],
  [:ImFontGlyphRangesBuilder_GetBit, [:pointer, :size_t], :bool],
  [:ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder, [], :pointer],
  [:ImFontGlyphRangesBuilder_SetBit, [:pointer, :size_t], :void],
  [:ImFontGlyphRangesBuilder_destroy, [:pointer], :void],
  [:ImFont_AddGlyph, [:pointer, :pointer, :ushort, :float, :float, :float, :float, :float, :float, :float, :float, :float], :void],
  [:ImFont_AddRemapChar, [:pointer, :ushort, :ushort, :bool], :void],
  [:ImFont_BuildLookupTable, [:pointer], :void],
  [:ImFont_CalcTextSizeA, [:pointer, :pointer, :float, :float, :float, :pointer, :pointer, :pointer], :void],
  [:ImFont_CalcWordWrapPositionA, [:pointer, :float, :pointer, :pointer, :float], :pointer],
  [:ImFont_ClearOutputData, [:pointer], :void],
  [:ImFont_FindGlyph, [:pointer, :ushort], :pointer],
  [:ImFont_FindGlyphNoFallback, [:pointer, :ushort], :pointer],
  [:ImFont_GetCharAdvance, [:pointer, :ushort], :float],
  [:ImFont_GetDebugName, [:pointer], :pointer],
  [:ImFont_GrowIndex, [:pointer, :int], :void],
  [:ImFont_ImFont, [], :pointer],
  [:ImFont_IsGlyphRangeUnused, [:pointer, :uint, :uint], :bool],
  [:ImFont_IsLoaded, [:pointer], :bool],
  [:ImFont_RenderChar, [:pointer, :pointer, :float, ImVec2.by_value, :uint, :ushort], :void],
  [:ImFont_RenderText, [:pointer, :pointer, :float, ImVec2.by_value, :uint, ImVec4.by_value, :pointer, :pointer, :float, :bool], :void],
  [:ImFont_SetGlyphVisible, [:pointer, :ushort, :bool], :void],
  [:ImFont_destroy, [:pointer], :void],
  [:ImGuiIO_AddFocusEvent, [:pointer, :bool], :void],
  [:ImGuiIO_AddInputCharacter, [:pointer, :uint], :void],
  [:ImGuiIO_AddInputCharacterUTF16, [:pointer, :ushort], :void],
  [:ImGuiIO_AddInputCharactersUTF8, [:pointer, :pointer], :void],
  [:ImGuiIO_AddKeyAnalogEvent, [:pointer, :int, :bool, :float], :void],
  [:ImGuiIO_AddKeyEvent, [:pointer, :int, :bool], :void],
  [:ImGuiIO_AddMouseButtonEvent, [:pointer, :int, :bool], :void],
  [:ImGuiIO_AddMousePosEvent, [:pointer, :float, :float], :void],
  [:ImGuiIO_AddMouseSourceEvent, [:pointer, :int], :void],
  [:ImGuiIO_AddMouseWheelEvent, [:pointer, :float, :float], :void],
  [:ImGuiIO_ClearEventsQueue, [:pointer], :void],
  [:ImGuiIO_ClearInputKeys, [:pointer], :void],
  [:ImGuiIO_ClearInputMouse, [:pointer], :void],
  [:ImGuiIO_ImGuiIO, [], :pointer],
  [:ImGuiIO_SetAppAcceptingEvents, [:pointer, :bool], :void],
  [:ImGuiIO_SetKeyEventNativeData, [:pointer, :int, :int, :int, :int], :void],
  [:ImGuiIO_destroy, [:pointer], :void],
  [:ImGuiInputTextCallbackData_ClearSelection, [:pointer], :void],
  [:ImGuiInputTextCallbackData_DeleteChars, [:pointer, :int, :int], :void],
  [:ImGuiInputTextCallbackData_HasSelection, [:pointer], :bool],
  [:ImGuiInputTextCallbackData_ImGuiInputTextCallbackData, [], :pointer],
  [:ImGuiInputTextCallbackData_InsertChars, [:pointer, :int, :pointer, :pointer], :void],
  [:ImGuiInputTextCallbackData_SelectAll, [:pointer], :void],
  [:ImGuiInputTextCallbackData_destroy, [:pointer], :void],
  [:ImGuiListClipper_Begin, [:pointer, :int, :float], :void],
  [:ImGuiListClipper_End, [:pointer], :void],
  [:ImGuiListClipper_ImGuiListClipper, [], :pointer],
  [:ImGuiListClipper_IncludeItemByIndex, [:pointer, :int], :void],
  [:ImGuiListClipper_IncludeItemsByIndex, [:pointer, :int, :int], :void],
  [:ImGuiListClipper_SeekCursorForItem, [:pointer, :int], :void],
  [:ImGuiListClipper_Step, [:pointer], :bool],
  [:ImGuiListClipper_destroy, [:pointer], :void],
  [:ImGuiOnceUponAFrame_ImGuiOnceUponAFrame, [], :pointer],
  [:ImGuiOnceUponAFrame_destroy, [:pointer], :void],
  [:ImGuiPayload_Clear, [:pointer], :void],
  [:ImGuiPayload_ImGuiPayload, [], :pointer],
  [:ImGuiPayload_IsDataType, [:pointer, :pointer], :bool],
  [:ImGuiPayload_IsDelivery, [:pointer], :bool],
  [:ImGuiPayload_IsPreview, [:pointer], :bool],
  [:ImGuiPayload_destroy, [:pointer], :void],
  [:ImGuiPlatformIO_ImGuiPlatformIO, [], :pointer],
  [:ImGuiPlatformIO_destroy, [:pointer], :void],
  [:ImGuiPlatformImeData_ImGuiPlatformImeData, [], :pointer],
  [:ImGuiPlatformImeData_destroy, [:pointer], :void],
  [:ImGuiSelectionBasicStorage_ApplyRequests, [:pointer, :pointer], :void],
  [:ImGuiSelectionBasicStorage_Clear, [:pointer], :void],
  [:ImGuiSelectionBasicStorage_Contains, [:pointer, :uint], :bool],
  [:ImGuiSelectionBasicStorage_GetNextSelectedItem, [:pointer, :pointer, :pointer], :bool],
  [:ImGuiSelectionBasicStorage_GetStorageIdFromIndex, [:pointer, :int], :uint],
  [:ImGuiSelectionBasicStorage_ImGuiSelectionBasicStorage, [], :pointer],
  [:ImGuiSelectionBasicStorage_SetItemSelected, [:pointer, :uint, :bool], :void],
  [:ImGuiSelectionBasicStorage_Swap, [:pointer, :pointer], :void],
  [:ImGuiSelectionBasicStorage_destroy, [:pointer], :void],
  [:ImGuiSelectionExternalStorage_ApplyRequests, [:pointer, :pointer], :void],
  [:ImGuiSelectionExternalStorage_ImGuiSelectionExternalStorage, [], :pointer],
  [:ImGuiSelectionExternalStorage_destroy, [:pointer], :void],
  [:ImGuiStoragePair_ImGuiStoragePair_Int, [:uint, :int], :pointer],
  [:ImGuiStoragePair_ImGuiStoragePair_Float, [:uint, :float], :pointer],
  [:ImGuiStoragePair_ImGuiStoragePair_Ptr, [:uint, :pointer], :pointer],
  [:ImGuiStoragePair_destroy, [:pointer], :void],
  [:ImGuiStorage_BuildSortByKey, [:pointer], :void],
  [:ImGuiStorage_Clear, [:pointer], :void],
  [:ImGuiStorage_GetBool, [:pointer, :uint, :bool], :bool],
  [:ImGuiStorage_GetBoolRef, [:pointer, :uint, :bool], :pointer],
  [:ImGuiStorage_GetFloat, [:pointer, :uint, :float], :float],
  [:ImGuiStorage_GetFloatRef, [:pointer, :uint, :float], :pointer],
  [:ImGuiStorage_GetInt, [:pointer, :uint, :int], :int],
  [:ImGuiStorage_GetIntRef, [:pointer, :uint, :int], :pointer],
  [:ImGuiStorage_GetVoidPtr, [:pointer, :uint], :pointer],
  [:ImGuiStorage_GetVoidPtrRef, [:pointer, :uint, :pointer], :pointer],
  [:ImGuiStorage_SetAllInt, [:pointer, :int], :void],
  [:ImGuiStorage_SetBool, [:pointer, :uint, :bool], :void],
  [:ImGuiStorage_SetFloat, [:pointer, :uint, :float], :void],
  [:ImGuiStorage_SetInt, [:pointer, :uint, :int], :void],
  [:ImGuiStorage_SetVoidPtr, [:pointer, :uint, :pointer], :void],
  [:ImGuiStyle_ImGuiStyle, [], :pointer],
  [:ImGuiStyle_ScaleAllSizes, [:pointer, :float], :void],
  [:ImGuiStyle_destroy, [:pointer], :void],
  [:ImGuiTableColumnSortSpecs_ImGuiTableColumnSortSpecs, [], :pointer],
  [:ImGuiTableColumnSortSpecs_destroy, [:pointer], :void],
  [:ImGuiTableSortSpecs_ImGuiTableSortSpecs, [], :pointer],
  [:ImGuiTableSortSpecs_destroy, [:pointer], :void],
  [:ImGuiTextBuffer_ImGuiTextBuffer, [], :pointer],
  [:ImGuiTextBuffer_append, [:pointer, :pointer, :pointer], :void],
  [:ImGuiTextBuffer_appendf, [:pointer, :pointer, :varargs], :void],
  [:ImGuiTextBuffer_begin, [:pointer], :pointer],
  [:ImGuiTextBuffer_c_str, [:pointer], :pointer],
  [:ImGuiTextBuffer_clear, [:pointer], :void],
  [:ImGuiTextBuffer_destroy, [:pointer], :void],
  [:ImGuiTextBuffer_empty, [:pointer], :bool],
  [:ImGuiTextBuffer_end, [:pointer], :pointer],
  [:ImGuiTextBuffer_reserve, [:pointer, :int], :void],
  [:ImGuiTextBuffer_size, [:pointer], :int],
  [:ImGuiTextFilter_Build, [:pointer], :void],
  [:ImGuiTextFilter_Clear, [:pointer], :void],
  [:ImGuiTextFilter_Draw, [:pointer, :pointer, :float], :bool],
  [:ImGuiTextFilter_ImGuiTextFilter, [:pointer], :pointer],
  [:ImGuiTextFilter_IsActive, [:pointer], :bool],
  [:ImGuiTextFilter_PassFilter, [:pointer, :pointer, :pointer], :bool],
  [:ImGuiTextFilter_destroy, [:pointer], :void],
  [:ImGuiTextRange_ImGuiTextRange_Nil, [], :pointer],
  [:ImGuiTextRange_ImGuiTextRange_Str, [:pointer, :pointer], :pointer],
  [:ImGuiTextRange_destroy, [:pointer], :void],
  [:ImGuiTextRange_empty, [:pointer], :bool],
  [:ImGuiTextRange_split, [:pointer, :char, :pointer], :void],
  [:ImGuiViewport_GetCenter, [:pointer, :pointer], :void],
  [:ImGuiViewport_GetWorkCenter, [:pointer, :pointer], :void],
  [:ImGuiViewport_ImGuiViewport, [], :pointer],
  [:ImGuiViewport_destroy, [:pointer], :void],
  [:igAcceptDragDropPayload, [:pointer, :int], :pointer],
  [:igAlignTextToFramePadding, [], :void],
  [:igArrowButton, [:pointer, :int], :bool],
  [:igBegin, [:pointer, :pointer, :int], :bool],
  [:igBeginChild_Str, [:pointer, ImVec2.by_value, :int, :int], :bool],
  [:igBeginChild_ID, [:uint, ImVec2.by_value, :int, :int], :bool],
  [:igBeginCombo, [:pointer, :pointer, :int], :bool],
  [:igBeginDisabled, [:bool], :void],
  [:igBeginDragDropSource, [:int], :bool],
  [:igBeginDragDropTarget, [], :bool],
  [:igBeginGroup, [], :void],
  [:igBeginItemTooltip, [], :bool],
  [:igBeginListBox, [:pointer, ImVec2.by_value], :bool],
  [:igBeginMainMenuBar, [], :bool],
  [:igBeginMenu, [:pointer, :bool], :bool],
  [:igBeginMenuBar, [], :bool],
  [:igBeginMultiSelect, [:int, :int, :int], :pointer],
  [:igBeginPopup, [:pointer, :int], :bool],
  [:igBeginPopupContextItem, [:pointer, :int], :bool],
  [:igBeginPopupContextVoid, [:pointer, :int], :bool],
  [:igBeginPopupContextWindow, [:pointer, :int], :bool],
  [:igBeginPopupModal, [:pointer, :pointer, :int], :bool],
  [:igBeginTabBar, [:pointer, :int], :bool],
  [:igBeginTabItem, [:pointer, :pointer, :int], :bool],
  [:igBeginTable, [:pointer, :int, :int, ImVec2.by_value, :float], :bool],
  [:igBeginTooltip, [], :bool],
  [:igBullet, [], :void],
  [:igBulletText, [:pointer, :varargs], :void],
  [:igButton, [:pointer, ImVec2.by_value], :bool],
  [:igCalcItemWidth, [], :float],
  [:igCalcTextSize, [:pointer, :pointer, :pointer, :bool, :float], :void],
  [:igCheckbox, [:pointer, :pointer], :bool],
  [:igCheckboxFlags_IntPtr, [:pointer, :pointer, :int], :bool],
  [:igCheckboxFlags_UintPtr, [:pointer, :pointer, :uint], :bool],
  [:igCloseCurrentPopup, [], :void],
  [:igCollapsingHeader_TreeNodeFlags, [:pointer, :int], :bool],
  [:igCollapsingHeader_BoolPtr, [:pointer, :pointer, :int], :bool],
  [:igColorButton, [:pointer, ImVec4.by_value, :int, ImVec2.by_value], :bool],
  [:igColorConvertFloat4ToU32, [ImVec4.by_value], :uint],
  [:igColorConvertHSVtoRGB, [:float, :float, :float, :pointer, :pointer, :pointer], :void],
  [:igColorConvertRGBtoHSV, [:float, :float, :float, :pointer, :pointer, :pointer], :void],
  [:igColorConvertU32ToFloat4, [:pointer, :uint], :void],
  [:igColorEdit3, [:pointer, :pointer, :int], :bool],
  [:igColorEdit4, [:pointer, :pointer, :int], :bool],
  [:igColorPicker3, [:pointer, :pointer, :int], :bool],
  [:igColorPicker4, [:pointer, :pointer, :int, :pointer], :bool],
  [:igColumns, [:int, :pointer, :bool], :void],
  [:igCombo_Str_arr, [:pointer, :pointer, :pointer, :int, :int], :bool],
  [:igCombo_Str, [:pointer, :pointer, :pointer, :int], :bool],
  [:igCombo_FnStrPtr, [:pointer, :pointer, :pointer, :pointer, :int, :int], :bool],
  [:igCreateContext, [:pointer], :pointer],
  [:igDebugCheckVersionAndDataLayout, [:pointer, :size_t, :size_t, :size_t, :size_t, :size_t, :size_t], :bool],
  [:igDebugFlashStyleColor, [:int], :void],
  [:igDebugLog, [:pointer, :varargs], :void],
  [:igDebugStartItemPicker, [], :void],
  [:igDebugTextEncoding, [:pointer], :void],
  [:igDestroyContext, [:pointer], :void],
  [:igDragFloat, [:pointer, :pointer, :float, :float, :float, :pointer, :int], :bool],
  [:igDragFloat2, [:pointer, :pointer, :float, :float, :float, :pointer, :int], :bool],
  [:igDragFloat3, [:pointer, :pointer, :float, :float, :float, :pointer, :int], :bool],
  [:igDragFloat4, [:pointer, :pointer, :float, :float, :float, :pointer, :int], :bool],
  [:igDragFloatRange2, [:pointer, :pointer, :pointer, :float, :float, :float, :pointer, :pointer, :int], :bool],
  [:igDragInt, [:pointer, :pointer, :float, :int, :int, :pointer, :int], :bool],
  [:igDragInt2, [:pointer, :pointer, :float, :int, :int, :pointer, :int], :bool],
  [:igDragInt3, [:pointer, :pointer, :float, :int, :int, :pointer, :int], :bool],
  [:igDragInt4, [:pointer, :pointer, :float, :int, :int, :pointer, :int], :bool],
  [:igDragIntRange2, [:pointer, :pointer, :pointer, :float, :int, :int, :pointer, :pointer, :int], :bool],
  [:igDragScalar, [:pointer, :int, :pointer, :float, :pointer, :pointer, :pointer, :int], :bool],
  [:igDragScalarN, [:pointer, :int, :pointer, :int, :float, :pointer, :pointer, :pointer, :int], :bool],
  [:igDummy, [ImVec2.by_value], :void],
  [:igEnd, [], :void],
  [:igEndChild, [], :void],
  [:igEndCombo, [], :void],
  [:igEndDisabled, [], :void],
  [:igEndDragDropSource, [], :void],
  [:igEndDragDropTarget, [], :void],
  [:igEndFrame, [], :void],
  [:igEndGroup, [], :void],
  [:igEndListBox, [], :void],
  [:igEndMainMenuBar, [], :void],
  [:igEndMenu, [], :void],
  [:igEndMenuBar, [], :void],
  [:igEndMultiSelect, [], :pointer],
  [:igEndPopup, [], :void],
  [:igEndTabBar, [], :void],
  [:igEndTabItem, [], :void],
  [:igEndTable, [], :void],
  [:igEndTooltip, [], :void],
  [:igGetAllocatorFunctions, [:pointer, :pointer, :pointer], :void],
  [:igGetBackgroundDrawList, [], :pointer],
  [:igGetClipboardText, [], :pointer],
  [:igGetColorU32_Col, [:int, :float], :uint],
  [:igGetColorU32_Vec4, [ImVec4.by_value], :uint],
  [:igGetColorU32_U32, [:uint, :float], :uint],
  [:igGetColumnIndex, [], :int],
  [:igGetColumnOffset, [:int], :float],
  [:igGetColumnWidth, [:int], :float],
  [:igGetColumnsCount, [], :int],
  [:igGetContentRegionAvail, [:pointer], :void],
  [:igGetCurrentContext, [], :pointer],
  [:igGetCursorPos, [:pointer], :void],
  [:igGetCursorPosX, [], :float],
  [:igGetCursorPosY, [], :float],
  [:igGetCursorScreenPos, [:pointer], :void],
  [:igGetCursorStartPos, [:pointer], :void],
  [:igGetDragDropPayload, [], :pointer],
  [:igGetDrawData, [], :pointer],
  [:igGetDrawListSharedData, [], :pointer],
  [:igGetFont, [], :pointer],
  [:igGetFontSize, [], :float],
  [:igGetFontTexUvWhitePixel, [:pointer], :void],
  [:igGetForegroundDrawList, [], :pointer],
  [:igGetFrameCount, [], :int],
  [:igGetFrameHeight, [], :float],
  [:igGetFrameHeightWithSpacing, [], :float],
  [:igGetID_Str, [:pointer], :uint],
  [:igGetID_StrStr, [:pointer, :pointer], :uint],
  [:igGetID_Ptr, [:pointer], :uint],
  [:igGetID_Int, [:int], :uint],
  [:igGetIO, [], :pointer],
  [:igGetItemID, [], :uint],
  [:igGetItemRectMax, [:pointer], :void],
  [:igGetItemRectMin, [:pointer], :void],
  [:igGetItemRectSize, [:pointer], :void],
  [:igGetKeyName, [:int], :pointer],
  [:igGetKeyPressedAmount, [:int, :float, :float], :int],
  [:igGetMainViewport, [], :pointer],
  [:igGetMouseClickedCount, [:int], :int],
  [:igGetMouseCursor, [], :int],
  [:igGetMouseDragDelta, [:pointer, :int, :float], :void],
  [:igGetMousePos, [:pointer], :void],
  [:igGetMousePosOnOpeningCurrentPopup, [:pointer], :void],
  [:igGetPlatformIO, [], :pointer],
  [:igGetScrollMaxX, [], :float],
  [:igGetScrollMaxY, [], :float],
  [:igGetScrollX, [], :float],
  [:igGetScrollY, [], :float],
  [:igGetStateStorage, [], :pointer],
  [:igGetStyle, [], :pointer],
  [:igGetStyleColorName, [:int], :pointer],
  [:igGetStyleColorVec4, [:int], :pointer],
  [:igGetTextLineHeight, [], :float],
  [:igGetTextLineHeightWithSpacing, [], :float],
  [:igGetTime, [], :double],
  [:igGetTreeNodeToLabelSpacing, [], :float],
  [:igGetVersion, [], :pointer],
  [:igGetWindowDrawList, [], :pointer],
  [:igGetWindowHeight, [], :float],
  [:igGetWindowPos, [:pointer], :void],
  [:igGetWindowSize, [:pointer], :void],
  [:igGetWindowWidth, [], :float],
  [:igImage, [:pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec4.by_value, ImVec4.by_value], :void],
  [:igImageButton, [:pointer, :pointer, ImVec2.by_value, ImVec2.by_value, ImVec2.by_value, ImVec4.by_value, ImVec4.by_value], :bool],
  [:igIndent, [:float], :void],
  [:igInputDouble, [:pointer, :pointer, :double, :double, :pointer, :int], :bool],
  [:igInputFloat, [:pointer, :pointer, :float, :float, :pointer, :int], :bool],
  [:igInputFloat2, [:pointer, :pointer, :pointer, :int], :bool],
  [:igInputFloat3, [:pointer, :pointer, :pointer, :int], :bool],
  [:igInputFloat4, [:pointer, :pointer, :pointer, :int], :bool],
  [:igInputInt, [:pointer, :pointer, :int, :int, :int], :bool],
  [:igInputInt2, [:pointer, :pointer, :int], :bool],
  [:igInputInt3, [:pointer, :pointer, :int], :bool],
  [:igInputInt4, [:pointer, :pointer, :int], :bool],
  [:igInputScalar, [:pointer, :int, :pointer, :pointer, :pointer, :pointer, :int], :bool],
  [:igInputScalarN, [:pointer, :int, :pointer, :int, :pointer, :pointer, :pointer, :int], :bool],
  [:igInputText, [:pointer, :pointer, :size_t, :int, :ImGuiInputTextCallback, :pointer], :bool],
  [:igInputTextMultiline, [:pointer, :pointer, :size_t, ImVec2.by_value, :int, :ImGuiInputTextCallback, :pointer], :bool],
  [:igInputTextWithHint, [:pointer, :pointer, :pointer, :size_t, :int, :ImGuiInputTextCallback, :pointer], :bool],
  [:igInvisibleButton, [:pointer, ImVec2.by_value, :int], :bool],
  [:igIsAnyItemActive, [], :bool],
  [:igIsAnyItemFocused, [], :bool],
  [:igIsAnyItemHovered, [], :bool],
  [:igIsAnyMouseDown, [], :bool],
  [:igIsItemActivated, [], :bool],
  [:igIsItemActive, [], :bool],
  [:igIsItemClicked, [:int], :bool],
  [:igIsItemDeactivated, [], :bool],
  [:igIsItemDeactivatedAfterEdit, [], :bool],
  [:igIsItemEdited, [], :bool],
  [:igIsItemFocused, [], :bool],
  [:igIsItemHovered, [:int], :bool],
  [:igIsItemToggledOpen, [], :bool],
  [:igIsItemToggledSelection, [], :bool],
  [:igIsItemVisible, [], :bool],
  [:igIsKeyChordPressed, [:int], :bool],
  [:igIsKeyDown, [:int], :bool],
  [:igIsKeyPressed, [:int, :bool], :bool],
  [:igIsKeyReleased, [:int], :bool],
  [:igIsMouseClicked, [:int, :bool], :bool],
  [:igIsMouseDoubleClicked, [:int], :bool],
  [:igIsMouseDown, [:int], :bool],
  [:igIsMouseDragging, [:int, :float], :bool],
  [:igIsMouseHoveringRect, [ImVec2.by_value, ImVec2.by_value, :bool], :bool],
  [:igIsMousePosValid, [:pointer], :bool],
  [:igIsMouseReleased, [:int], :bool],
  [:igIsPopupOpen, [:pointer, :int], :bool],
  [:igIsRectVisible_Nil, [ImVec2.by_value], :bool],
  [:igIsRectVisible_Vec2, [ImVec2.by_value, ImVec2.by_value], :bool],
  [:igIsWindowAppearing, [], :bool],
  [:igIsWindowCollapsed, [], :bool],
  [:igIsWindowFocused, [:int], :bool],
  [:igIsWindowHovered, [:int], :bool],
  [:igLabelText, [:pointer, :pointer, :varargs], :void],
  [:igListBox_Str_arr, [:pointer, :pointer, :pointer, :int, :int], :bool],
  [:igListBox_FnStrPtr, [:pointer, :pointer, :pointer, :pointer, :int, :int], :bool],
  [:igLoadIniSettingsFromDisk, [:pointer], :void],
  [:igLoadIniSettingsFromMemory, [:pointer, :size_t], :void],
  [:igLogButtons, [], :void],
  [:igLogFinish, [], :void],
  [:igLogText, [:pointer, :varargs], :void],
  [:igLogToClipboard, [:int], :void],
  [:igLogToFile, [:int, :pointer], :void],
  [:igLogToTTY, [:int], :void],
  [:igMemAlloc, [:size_t], :pointer],
  [:igMemFree, [:pointer], :void],
  [:igMenuItem_Bool, [:pointer, :pointer, :bool, :bool], :bool],
  [:igMenuItem_BoolPtr, [:pointer, :pointer, :pointer, :bool], :bool],
  [:igNewFrame, [], :void],
  [:igNewLine, [], :void],
  [:igNextColumn, [], :void],
  [:igOpenPopup_Str, [:pointer, :int], :void],
  [:igOpenPopup_ID, [:uint, :int], :void],
  [:igOpenPopupOnItemClick, [:pointer, :int], :void],
  [:igPlotHistogram_FloatPtr, [:pointer, :pointer, :int, :int, :pointer, :float, :float, ImVec2.by_value, :int], :void],
  [:igPlotHistogram_FnFloatPtr, [:pointer, :pointer, :pointer, :int, :int, :pointer, :float, :float, ImVec2.by_value], :void],
  [:igPlotLines_FloatPtr, [:pointer, :pointer, :int, :int, :pointer, :float, :float, ImVec2.by_value, :int], :void],
  [:igPlotLines_FnFloatPtr, [:pointer, :pointer, :pointer, :int, :int, :pointer, :float, :float, ImVec2.by_value], :void],
  [:igPopClipRect, [], :void],
  [:igPopFont, [], :void],
  [:igPopID, [], :void],
  [:igPopItemFlag, [], :void],
  [:igPopItemWidth, [], :void],
  [:igPopStyleColor, [:int], :void],
  [:igPopStyleVar, [:int], :void],
  [:igPopTextWrapPos, [], :void],
  [:igProgressBar, [:float, ImVec2.by_value, :pointer], :void],
  [:igPushClipRect, [ImVec2.by_value, ImVec2.by_value, :bool], :void],
  [:igPushFont, [:pointer], :void],
  [:igPushID_Str, [:pointer], :void],
  [:igPushID_StrStr, [:pointer, :pointer], :void],
  [:igPushID_Ptr, [:pointer], :void],
  [:igPushID_Int, [:int], :void],
  [:igPushItemFlag, [:int, :bool], :void],
  [:igPushItemWidth, [:float], :void],
  [:igPushStyleColor_U32, [:int, :uint], :void],
  [:igPushStyleColor_Vec4, [:int, ImVec4.by_value], :void],
  [:igPushStyleVar_Float, [:int, :float], :void],
  [:igPushStyleVar_Vec2, [:int, ImVec2.by_value], :void],
  [:igPushStyleVarX, [:int, :float], :void],
  [:igPushStyleVarY, [:int, :float], :void],
  [:igPushTextWrapPos, [:float], :void],
  [:igRadioButton_Bool, [:pointer, :bool], :bool],
  [:igRadioButton_IntPtr, [:pointer, :pointer, :int], :bool],
  [:igRender, [], :void],
  [:igResetMouseDragDelta, [:int], :void],
  [:igSameLine, [:float, :float], :void],
  [:igSaveIniSettingsToDisk, [:pointer], :void],
  [:igSaveIniSettingsToMemory, [:pointer], :pointer],
  [:igSelectable_Bool, [:pointer, :bool, :int, ImVec2.by_value], :bool],
  [:igSelectable_BoolPtr, [:pointer, :pointer, :int, ImVec2.by_value], :bool],
  [:igSeparator, [], :void],
  [:igSeparatorText, [:pointer], :void],
  [:igSetAllocatorFunctions, [:pointer, :pointer, :pointer], :void],
  [:igSetClipboardText, [:pointer], :void],
  [:igSetColorEditOptions, [:int], :void],
  [:igSetColumnOffset, [:int, :float], :void],
  [:igSetColumnWidth, [:int, :float], :void],
  [:igSetCurrentContext, [:pointer], :void],
  [:igSetCursorPos, [ImVec2.by_value], :void],
  [:igSetCursorPosX, [:float], :void],
  [:igSetCursorPosY, [:float], :void],
  [:igSetCursorScreenPos, [ImVec2.by_value], :void],
  [:igSetDragDropPayload, [:pointer, :pointer, :size_t, :int], :bool],
  [:igSetItemDefaultFocus, [], :void],
  [:igSetItemKeyOwner, [:int], :void],
  [:igSetItemTooltip, [:pointer, :varargs], :void],
  [:igSetKeyboardFocusHere, [:int], :void],
  [:igSetMouseCursor, [:int], :void],
  [:igSetNextFrameWantCaptureKeyboard, [:bool], :void],
  [:igSetNextFrameWantCaptureMouse, [:bool], :void],
  [:igSetNextItemAllowOverlap, [], :void],
  [:igSetNextItemOpen, [:bool, :int], :void],
  [:igSetNextItemSelectionUserData, [:int64], :void],
  [:igSetNextItemShortcut, [:int, :int], :void],
  [:igSetNextItemStorageID, [:uint], :void],
  [:igSetNextItemWidth, [:float], :void],
  [:igSetNextWindowBgAlpha, [:float], :void],
  [:igSetNextWindowCollapsed, [:bool, :int], :void],
  [:igSetNextWindowContentSize, [ImVec2.by_value], :void],
  [:igSetNextWindowFocus, [], :void],
  [:igSetNextWindowPos, [ImVec2.by_value, :int, ImVec2.by_value], :void],
  [:igSetNextWindowScroll, [ImVec2.by_value], :void],
  [:igSetNextWindowSize, [ImVec2.by_value, :int], :void],
  [:igSetNextWindowSizeConstraints, [ImVec2.by_value, ImVec2.by_value, :ImGuiSizeCallback, :pointer], :void],
  [:igSetScrollFromPosX, [:float, :float], :void],
  [:igSetScrollFromPosY, [:float, :float], :void],
  [:igSetScrollHereX, [:float], :void],
  [:igSetScrollHereY, [:float], :void],
  [:igSetScrollX, [:float], :void],
  [:igSetScrollY, [:float], :void],
  [:igSetStateStorage, [:pointer], :void],
  [:igSetTabItemClosed, [:pointer], :void],
  [:igSetTooltip, [:pointer, :varargs], :void],
  [:igSetWindowCollapsed_Bool, [:bool, :int], :void],
  [:igSetWindowCollapsed_Str, [:pointer, :bool, :int], :void],
  [:igSetWindowFocus_Nil, [], :void],
  [:igSetWindowFocus_Str, [:pointer], :void],
  [:igSetWindowFontScale, [:float], :void],
  [:igSetWindowPos_Vec2, [ImVec2.by_value, :int], :void],
  [:igSetWindowPos_Str, [:pointer, ImVec2.by_value, :int], :void],
  [:igSetWindowSize_Vec2, [ImVec2.by_value, :int], :void],
  [:igSetWindowSize_Str, [:pointer, ImVec2.by_value, :int], :void],
  [:igShortcut, [:int, :int], :bool],
  [:igShowAboutWindow, [:pointer], :void],
  [:igShowDebugLogWindow, [:pointer], :void],
  [:igShowDemoWindow, [:pointer], :void],
  [:igShowFontSelector, [:pointer], :void],
  [:igShowIDStackToolWindow, [:pointer], :void],
  [:igShowMetricsWindow, [:pointer], :void],
  [:igShowStyleEditor, [:pointer], :void],
  [:igShowStyleSelector, [:pointer], :bool],
  [:igShowUserGuide, [], :void],
  [:igSliderAngle, [:pointer, :pointer, :float, :float, :pointer, :int], :bool],
  [:igSliderFloat, [:pointer, :pointer, :float, :float, :pointer, :int], :bool],
  [:igSliderFloat2, [:pointer, :pointer, :float, :float, :pointer, :int], :bool],
  [:igSliderFloat3, [:pointer, :pointer, :float, :float, :pointer, :int], :bool],
  [:igSliderFloat4, [:pointer, :pointer, :float, :float, :pointer, :int], :bool],
  [:igSliderInt, [:pointer, :pointer, :int, :int, :pointer, :int], :bool],
  [:igSliderInt2, [:pointer, :pointer, :int, :int, :pointer, :int], :bool],
  [:igSliderInt3, [:pointer, :pointer, :int, :int, :pointer, :int], :bool],
  [:igSliderInt4, [:pointer, :pointer, :int, :int, :pointer, :int], :bool],
  [:igSliderScalar, [:pointer, :int, :pointer, :pointer, :pointer, :pointer, :int], :bool],
  [:igSliderScalarN, [:pointer, :int, :pointer, :int, :pointer, :pointer, :pointer, :int], :bool],
  [:igSmallButton, [:pointer], :bool],
  [:igSpacing, [], :void],
  [:igStyleColorsClassic, [:pointer], :void],
  [:igStyleColorsDark, [:pointer], :void],
  [:igStyleColorsLight, [:pointer], :void],
  [:igTabItemButton, [:pointer, :int], :bool],
  [:igTableAngledHeadersRow, [], :void],
  [:igTableGetColumnCount, [], :int],
  [:igTableGetColumnFlags, [:int], :int],
  [:igTableGetColumnIndex, [], :int],
  [:igTableGetColumnName, [:int], :pointer],
  [:igTableGetHoveredColumn, [], :int],
  [:igTableGetRowIndex, [], :int],
  [:igTableGetSortSpecs, [], :pointer],
  [:igTableHeader, [:pointer], :void],
  [:igTableHeadersRow, [], :void],
  [:igTableNextColumn, [], :bool],
  [:igTableNextRow, [:int, :float], :void],
  [:igTableSetBgColor, [:int, :uint, :int], :void],
  [:igTableSetColumnEnabled, [:int, :bool], :void],
  [:igTableSetColumnIndex, [:int], :bool],
  [:igTableSetupColumn, [:pointer, :int, :float, :uint], :void],
  [:igTableSetupScrollFreeze, [:int, :int], :void],
  [:igText, [:pointer, :varargs], :void],
  [:igTextColored, [ImVec4.by_value, :pointer, :varargs], :void],
  [:igTextDisabled, [:pointer, :varargs], :void],
  [:igTextLink, [:pointer], :bool],
  [:igTextLinkOpenURL, [:pointer, :pointer], :void],
  [:igTextUnformatted, [:pointer, :pointer], :void],
  [:igTextWrapped, [:pointer, :varargs], :void],
  [:igTreeNode_Str, [:pointer], :bool],
  [:igTreeNode_StrStr, [:pointer, :pointer, :varargs], :bool],
  [:igTreeNode_Ptr, [:pointer, :pointer, :varargs], :bool],
  [:igTreeNodeEx_Str, [:pointer, :int], :bool],
  [:igTreeNodeEx_StrStr, [:pointer, :int, :pointer, :varargs], :bool],
  [:igTreeNodeEx_Ptr, [:pointer, :int, :pointer, :varargs], :bool],
  [:igTreePop, [], :void],
  [:igTreePush_Str, [:pointer], :void],
  [:igTreePush_Ptr, [:pointer], :void],
  [:igUnindent, [:float], :void],
  [:igVSliderFloat, [:pointer, ImVec2.by_value, :pointer, :float, :float, :pointer, :int], :bool],
  [:igVSliderInt, [:pointer, ImVec2.by_value, :pointer, :int, :int, :pointer, :int], :bool],
  [:igVSliderScalar, [:pointer, ImVec2.by_value, :int, :pointer, :pointer, :pointer, :pointer, :int], :bool],
  [:igValue_Bool, [:pointer, :bool], :void],
  [:igValue_Int, [:pointer, :int], :void],
  [:igValue_Uint, [:pointer, :uint], :void],
  [:igValue_Float, [:pointer, :float, :pointer], :void],
]

entries.each do |entry|
  attach_function entry[0], entry[1], entry[2]
rescue FFI::NotFoundError => e
  warn "[Warning] Failed to import #{entry[0]} (#{e})."
end

attach_function :ImVector_ImWchar_create, :ImVector_ImWchar_create, [], :pointer
attach_function :ImVector_ImWchar_destroy, :ImVector_ImWchar_destroy, [:pointer], :void
attach_function :ImVector_ImWchar_Init, :ImVector_ImWchar_destroy, [:pointer], :void
attach_function :ImVector_ImWchar_UnInit, :ImVector_ImWchar_destroy, [:pointer], :void

@@imgui_import_done = true  end

.Indent(indent_w = 0.0) ⇒ Object

arg: indent_w(float) ret: void



4430
4431
4432
# File 'lib/imgui.rb', line 4430

def self.Indent(indent_w = 0.0)  # Implied indent_w = 0.0f
  igIndent(indent_w)
end

.InputDouble(label, v, step = 0.0, step_fast = 0.0, format = "%.6f", flags = 0) ⇒ Object

arg: label(const char*), v(double*), step(double), step_fast(double), format(const char*), flags(ImGuiInputTextFlags) ret: bool



4436
4437
4438
# File 'lib/imgui.rb', line 4436

def self.InputDouble(label, v, step = 0.0, step_fast = 0.0, format = "%.6f", flags = 0)  # Implied step = 0.0, step_fast = 0.0, format = "%.6f", flags = 0
  igInputDouble(label, v, step, step_fast, format, flags)
end

.InputFloat(label, v, step = 0.0, step_fast = 0.0, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float*), step(float), step_fast(float), format(const char*), flags(ImGuiInputTextFlags) ret: bool



4442
4443
4444
# File 'lib/imgui.rb', line 4442

def self.InputFloat(label, v, step = 0.0, step_fast = 0.0, format = "%.3f", flags = 0)  # Implied step = 0.0f, step_fast = 0.0f, format = "%.3f", flags = 0
  igInputFloat(label, v, step, step_fast, format, flags)
end

.InputFloat2(label, v, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float), format(const char*), flags(ImGuiInputTextFlags) ret: bool



4448
4449
4450
# File 'lib/imgui.rb', line 4448

def self.InputFloat2(label, v, format = "%.3f", flags = 0)  # Implied format = "%.3f", flags = 0
  igInputFloat2(label, v, format, flags)
end

.InputFloat3(label, v, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float), format(const char*), flags(ImGuiInputTextFlags) ret: bool



4454
4455
4456
# File 'lib/imgui.rb', line 4454

def self.InputFloat3(label, v, format = "%.3f", flags = 0)  # Implied format = "%.3f", flags = 0
  igInputFloat3(label, v, format, flags)
end

.InputFloat4(label, v, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float), format(const char*), flags(ImGuiInputTextFlags) ret: bool



4460
4461
4462
# File 'lib/imgui.rb', line 4460

def self.InputFloat4(label, v, format = "%.3f", flags = 0)  # Implied format = "%.3f", flags = 0
  igInputFloat4(label, v, format, flags)
end

.InputInt(label, v, step = 1, step_fast = 100, flags = 0) ⇒ Object

arg: label(const char*), v(int*), step(int), step_fast(int), flags(ImGuiInputTextFlags) ret: bool



4466
4467
4468
# File 'lib/imgui.rb', line 4466

def self.InputInt(label, v, step = 1, step_fast = 100, flags = 0)  # Implied step = 1, step_fast = 100, flags = 0
  igInputInt(label, v, step, step_fast, flags)
end

.InputInt2(label, v, flags = 0) ⇒ Object

arg: label(const char*), v(int), flags(ImGuiInputTextFlags) ret: bool



4472
4473
4474
# File 'lib/imgui.rb', line 4472

def self.InputInt2(label, v, flags = 0)
  igInputInt2(label, v, flags)
end

.InputInt3(label, v, flags = 0) ⇒ Object

arg: label(const char*), v(int), flags(ImGuiInputTextFlags) ret: bool



4478
4479
4480
# File 'lib/imgui.rb', line 4478

def self.InputInt3(label, v, flags = 0)
  igInputInt3(label, v, flags)
end

.InputInt4(label, v, flags = 0) ⇒ Object

arg: label(const char*), v(int), flags(ImGuiInputTextFlags) ret: bool



4484
4485
4486
# File 'lib/imgui.rb', line 4484

def self.InputInt4(label, v, flags = 0)
  igInputInt4(label, v, flags)
end

.InputScalar(label, data_type, p_data, p_step = nil, p_step_fast = nil, format = nil, flags = 0) ⇒ Object

arg: label(const char*), data_type(ImGuiDataType), p_data(void*), p_step(const void*), p_step_fast(const void*), format(const char*), flags(ImGuiInputTextFlags) ret: bool



4490
4491
4492
# File 'lib/imgui.rb', line 4490

def self.InputScalar(label, data_type, p_data, p_step = nil, p_step_fast = nil, format = nil, flags = 0)  # Implied p_step = NULL, p_step_fast = NULL, format = NULL, flags = 0
  igInputScalar(label, data_type, p_data, p_step, p_step_fast, format, flags)
end

.InputScalarN(label, data_type, p_data, components, p_step = nil, p_step_fast = nil, format = nil, flags = 0) ⇒ Object

arg: label(const char*), data_type(ImGuiDataType), p_data(void*), components(int), p_step(const void*), p_step_fast(const void*), format(const char*), flags(ImGuiInputTextFlags) ret: bool



4496
4497
4498
# File 'lib/imgui.rb', line 4496

def self.InputScalarN(label, data_type, p_data, components, p_step = nil, p_step_fast = nil, format = nil, flags = 0)  # Implied p_step = NULL, p_step_fast = NULL, format = NULL, flags = 0
  igInputScalarN(label, data_type, p_data, components, p_step, p_step_fast, format, flags)
end

.InputText(label, buf, buf_size, flags = 0, callback = nil, user_data = nil) ⇒ Object

arg: label(const char*), buf(char*), buf_size(size_t), flags(ImGuiInputTextFlags), callback(ImGuiInputTextCallback), user_data(void*) ret: bool

Widgets: Input with Keyboard

  • If you want to use InputText() with std::string or any custom dynamic string type, see misc/cpp/imgui_stdlib.h and comments in imgui_demo.cpp.

  • Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc.



4506
4507
4508
# File 'lib/imgui.rb', line 4506

def self.InputText(label, buf, buf_size, flags = 0, callback = nil, user_data = nil)  # Implied callback = NULL, user_data = NULL
  igInputText(label, buf, buf_size, flags, callback, user_data)
end

.InputTextMultiline(label, buf, buf_size, size = ImVec2.create(0,0), flags = 0, callback = nil, user_data = nil) ⇒ Object

arg: label(const char*), buf(char*), buf_size(size_t), size(ImVec2), flags(ImGuiInputTextFlags), callback(ImGuiInputTextCallback), user_data(void*) ret: bool



4512
4513
4514
# File 'lib/imgui.rb', line 4512

def self.InputTextMultiline(label, buf, buf_size, size = ImVec2.create(0,0), flags = 0, callback = nil, user_data = nil)  # Implied size = ImVec2(0, 0), flags = 0, callback = NULL, user_data = NULL
  igInputTextMultiline(label, buf, buf_size, size, flags, callback, user_data)
end

.InputTextWithHint(label, hint, buf, buf_size, flags = 0, callback = nil, user_data = nil) ⇒ Object

arg: label(const char*), hint(const char*), buf(char*), buf_size(size_t), flags(ImGuiInputTextFlags), callback(ImGuiInputTextCallback), user_data(void*) ret: bool



4518
4519
4520
# File 'lib/imgui.rb', line 4518

def self.InputTextWithHint(label, hint, buf, buf_size, flags = 0, callback = nil, user_data = nil)  # Implied callback = NULL, user_data = NULL
  igInputTextWithHint(label, hint, buf, buf_size, flags, callback, user_data)
end

.InvisibleButton(str_id, size, flags = 0) ⇒ Object

arg: str_id(const char*), size(ImVec2), flags(ImGuiButtonFlags) ret: bool



4524
4525
4526
# File 'lib/imgui.rb', line 4524

def self.InvisibleButton(str_id, size, flags = 0)  # flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
  igInvisibleButton(str_id, size, flags)
end

.IsAnyItemActiveObject

ret: bool



4529
4530
4531
# File 'lib/imgui.rb', line 4529

def self.IsAnyItemActive()  # is any item active?
  igIsAnyItemActive()
end

.IsAnyItemFocusedObject

ret: bool



4534
4535
4536
# File 'lib/imgui.rb', line 4534

def self.IsAnyItemFocused()  # is any item focused?
  igIsAnyItemFocused()
end

.IsAnyItemHoveredObject

ret: bool



4539
4540
4541
# File 'lib/imgui.rb', line 4539

def self.IsAnyItemHovered()  # is any item hovered?
  igIsAnyItemHovered()
end

.IsAnyMouseDownObject

ret: bool



4544
4545
4546
# File 'lib/imgui.rb', line 4544

def self.IsAnyMouseDown()  # [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.
  igIsAnyMouseDown()
end

.IsItemActivatedObject

ret: bool



4549
4550
4551
# File 'lib/imgui.rb', line 4549

def self.IsItemActivated()  # was the last item just made active (item was previously inactive).
  igIsItemActivated()
end

.IsItemActiveObject

ret: bool



4554
4555
4556
# File 'lib/imgui.rb', line 4554

def self.IsItemActive()  # 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)
  igIsItemActive()
end

.IsItemClicked(mouse_button = 0) ⇒ Object

arg: mouse_button(ImGuiMouseButton) ret: bool



4560
4561
4562
# File 'lib/imgui.rb', line 4560

def self.IsItemClicked(mouse_button = 0)  # Implied mouse_button = 0
  igIsItemClicked(mouse_button)
end

.IsItemDeactivatedObject

ret: bool



4565
4566
4567
# File 'lib/imgui.rb', line 4565

def self.IsItemDeactivated()  # was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that require continuous editing.
  igIsItemDeactivated()
end

.IsItemDeactivatedAfterEditObject

ret: bool



4570
4571
4572
# File 'lib/imgui.rb', line 4570

def self.IsItemDeactivatedAfterEdit()  # 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 require 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).
  igIsItemDeactivatedAfterEdit()
end

.IsItemEditedObject

ret: bool



4575
4576
4577
# File 'lib/imgui.rb', line 4575

def self.IsItemEdited()  # 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.
  igIsItemEdited()
end

.IsItemFocusedObject

ret: bool



4580
4581
4582
# File 'lib/imgui.rb', line 4580

def self.IsItemFocused()  # is the last item focused for keyboard/gamepad navigation?
  igIsItemFocused()
end

.IsItemHovered(flags = 0) ⇒ Object

arg: flags(ImGuiHoveredFlags) ret: bool

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.



4590
4591
4592
# File 'lib/imgui.rb', line 4590

def self.IsItemHovered(flags = 0)  # is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.
  igIsItemHovered(flags)
end

.IsItemToggledOpenObject

ret: bool



4595
4596
4597
# File 'lib/imgui.rb', line 4595

def self.IsItemToggledOpen()  # was the last item open state toggled? set by TreeNode().
  igIsItemToggledOpen()
end

.IsItemToggledSelectionObject

ret: bool



4600
4601
4602
# File 'lib/imgui.rb', line 4600

def self.IsItemToggledSelection()  # Was the last item selection state toggled? Useful if you need the per-item information _before_ reaching EndMultiSelect(). We only returns toggle _event_ in order to handle clipping correctly.
  igIsItemToggledSelection()
end

.IsItemVisibleObject

ret: bool



4605
4606
4607
# File 'lib/imgui.rb', line 4605

def self.IsItemVisible()  # is the last item visible? (items may be out of sight because of clipping/scrolling)
  igIsItemVisible()
end

.IsKeyChordPressed(key_chord) ⇒ Object

arg: key_chord(ImGuiKeyChord) ret: bool



4611
4612
4613
# File 'lib/imgui.rb', line 4611

def self.IsKeyChordPressed(key_chord)  # was key chord (mods + key) pressed, e.g. you can pass 'ImGuiMod_Ctrl | ImGuiKey_S' as a key-chord. This doesn't do any routing or focus check, please consider using Shortcut() function instead.
  igIsKeyChordPressed(key_chord)
end

.IsKeyDown(key) ⇒ Object

arg: key(ImGuiKey) ret: bool

Inputs Utilities: Keyboard/Mouse/Gamepad

  • the ImGuiKey enum contains all possible keyboard, mouse and gamepad inputs (e.g. ImGuiKey_A, ImGuiKey_MouseLeft, ImGuiKey_GamepadDpadUp…).

  • before v1.87, we used ImGuiKey to carry native/user indices as defined by each backends. About use of those legacy ImGuiKey values:

  • without IMGUI_DISABLE_OBSOLETE_KEYIO (legacy support): you can still use your legacy native/user indices (< 512) according to how your backend/engine stored them in io.KeysDown[], but need to cast them to ImGuiKey.

  • with IMGUI_DISABLE_OBSOLETE_KEYIO (this is the way forward): any use of ImGuiKey will assert with key < 512. GetKeyIndex() is pass-through and therefore deprecated (gone if IMGUI_DISABLE_OBSOLETE_KEYIO is defined).



4623
4624
4625
# File 'lib/imgui.rb', line 4623

def self.IsKeyDown(key)  # is key being held.
  igIsKeyDown(key)
end

.IsKeyPressed(key, repeat = true) ⇒ Object

arg: key(ImGuiKey), repeat(bool) ret: bool



4629
4630
4631
# File 'lib/imgui.rb', line 4629

def self.IsKeyPressed(key, repeat = true)  # Implied repeat = true
  igIsKeyPressed(key, repeat)
end

.IsKeyReleased(key) ⇒ Object

arg: key(ImGuiKey) ret: bool



4635
4636
4637
# File 'lib/imgui.rb', line 4635

def self.IsKeyReleased(key)  # was key released (went from Down to !Down)?
  igIsKeyReleased(key)
end

.IsMouseClicked(button, repeat = false) ⇒ Object

arg: button(ImGuiMouseButton), repeat(bool) ret: bool



4641
4642
4643
# File 'lib/imgui.rb', line 4641

def self.IsMouseClicked(button, repeat = false)  # Implied repeat = false
  igIsMouseClicked(button, repeat)
end

.IsMouseDoubleClicked(button) ⇒ Object

arg: button(ImGuiMouseButton) ret: bool



4647
4648
4649
# File 'lib/imgui.rb', line 4647

def self.IsMouseDoubleClicked(button)  # did mouse button double-clicked? Same as GetMouseClickedCount() == 2. (note that a double-click will also report IsMouseClicked() == true)
  igIsMouseDoubleClicked(button)
end

.IsMouseDown(button) ⇒ Object

arg: button(ImGuiMouseButton) ret: bool

Inputs Utilities: Mouse specific

  • 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’)



4658
4659
4660
# File 'lib/imgui.rb', line 4658

def self.IsMouseDown(button)  # is mouse button held?
  igIsMouseDown(button)
end

.IsMouseDragging(button, lock_threshold = -1.0)) ⇒ Object

arg: button(ImGuiMouseButton), lock_threshold(float) ret: bool



4664
4665
4666
# File 'lib/imgui.rb', line 4664

def self.IsMouseDragging(button, lock_threshold = -1.0)  # is mouse dragging? (uses io.MouseDraggingThreshold if lock_threshold < 0.0f)
  igIsMouseDragging(button, lock_threshold)
end

.IsMouseHoveringRect(r_min, r_max, clip = true) ⇒ Object

arg: r_min(ImVec2), r_max(ImVec2), clip(bool) ret: bool



4670
4671
4672
# File 'lib/imgui.rb', line 4670

def self.IsMouseHoveringRect(r_min, r_max, clip = true)  # Implied clip = true
  igIsMouseHoveringRect(r_min, r_max, clip)
end

.IsMousePosValid(mouse_pos = nil) ⇒ Object

arg: mouse_pos(const ImVec2*) ret: bool



4676
4677
4678
# File 'lib/imgui.rb', line 4676

def self.IsMousePosValid(mouse_pos = nil)  # by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available
  igIsMousePosValid(mouse_pos)
end

.IsMouseReleased(button) ⇒ Object

arg: button(ImGuiMouseButton) ret: bool



4682
4683
4684
# File 'lib/imgui.rb', line 4682

def self.IsMouseReleased(button)  # did mouse button released? (went from Down to !Down)
  igIsMouseReleased(button)
end

.IsPopupOpen(str_id, flags = 0) ⇒ Object

arg: str_id(const char*), flags(ImGuiPopupFlags) ret: bool

Popups: query functions

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


4693
4694
4695
# File 'lib/imgui.rb', line 4693

def self.IsPopupOpen(str_id, flags = 0)  # return true if the popup is open.
  igIsPopupOpen(str_id, flags)
end

.IsRectVisible(*arg) ⇒ Object

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



5949
5950
5951
5952
5953
5954
5955
5956
5957
# File 'lib/imgui.rb', line 5949

def self.IsRectVisible(*arg)  # test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.
  # arg: 0:size(ImVec2)
  # ret: bool
  return igIsRectVisible_Nil(arg[0]) if arg.length == 1 && (arg[0].kind_of?(ImVec2))
  # arg: 0:rect_min(ImVec2), 1:rect_max(ImVec2)
  # ret: bool
  return igIsRectVisible_Vec2(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(ImVec2) && arg[1].kind_of?(ImVec2))
  $stderr.puts("[Warning] IsRectVisible : No matching functions found (#{arg})")
end

.IsRectVisible_Nil(size) ⇒ Object

arg: size(ImVec2) ret: bool



4699
4700
4701
# File 'lib/imgui.rb', line 4699

def self.IsRectVisible_Nil(size)
  igIsRectVisible_Nil(size)
end

.IsRectVisible_Vec2(rect_min, rect_max) ⇒ Object

arg: rect_min(ImVec2), rect_max(ImVec2) ret: bool



4705
4706
4707
# File 'lib/imgui.rb', line 4705

def self.IsRectVisible_Vec2(rect_min, rect_max)
  igIsRectVisible_Vec2(rect_min, rect_max)
end

.IsWindowAppearingObject

ret: bool

Windows Utilities

  • ‘current window’ = the window we are appending into while inside a Begin()/End() block. ‘next window’ = next window we will Begin() into.



4713
4714
4715
# File 'lib/imgui.rb', line 4713

def self.IsWindowAppearing()
  igIsWindowAppearing()
end

.IsWindowCollapsedObject

ret: bool



4718
4719
4720
# File 'lib/imgui.rb', line 4718

def self.IsWindowCollapsed()
  igIsWindowCollapsed()
end

.IsWindowFocused(flags = 0) ⇒ Object

arg: flags(ImGuiFocusedFlags) ret: bool



4724
4725
4726
# File 'lib/imgui.rb', line 4724

def self.IsWindowFocused(flags = 0)  # is current window focused? or its root/child, depending on flags. see flags for options.
  igIsWindowFocused(flags)
end

.IsWindowHovered(flags = 0) ⇒ Object

arg: flags(ImGuiHoveredFlags) ret: bool



4730
4731
4732
# File 'lib/imgui.rb', line 4730

def self.IsWindowHovered(flags = 0)  # is current window hovered and hoverable (e.g. not blocked by a popup/modal)? See ImGuiHoveredFlags_ for options. IMPORTANT: If you are trying to check whether your mouse should be dispatched to Dear ImGui or to your underlying app, you should not use this function! Use the 'io.WantCaptureMouse' boolean for that! Refer to FAQ entry "How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?" for details.
  igIsWindowHovered(flags)
end

.LabelText(label, fmt, *varargs) ⇒ Object

arg: label(const char*), fmt(const char*), …(…) ret: void



4736
4737
4738
# File 'lib/imgui.rb', line 4736

def self.LabelText(label, fmt, *varargs)  # display text+label aligned the same way as value+label widgets
  igLabelText(label, fmt, *varargs)
end

.ListBox(*arg) ⇒ Object



5959
5960
5961
5962
5963
5964
5965
5966
5967
# File 'lib/imgui.rb', line 5959

def self.ListBox(*arg)
  # arg: 0:label(const char*), 1:current_item(int*), 2:items(const char* const[]), 3:items_count(int), 4:height_in_items(int)
  # ret: bool
  return igListBox_Str_arr(arg[0], arg[1], arg[2], arg[3], arg[4]) if arg.length == 5 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(FFI::Pointer) && arg[3].kind_of?(Integer) && arg[4].kind_of?(Integer))
  # arg: 0:label(const char*), 1:current_item(int*), 2:getter(const char*(*)(void* user_data,int idx)), 3:user_data(void*), 4:items_count(int), 5:height_in_items(int)
  # ret: bool
  return igListBox_FnStrPtr(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5]) if arg.length == 6 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(String) && arg[3].kind_of?(FFI::Pointer) && arg[4].kind_of?(Integer) && arg[5].kind_of?(Integer))
  $stderr.puts("[Warning] ListBox : No matching functions found (#{arg})")
end

.ListBox_FnStrPtr(label, current_item, getter, user_data, items_count, height_in_items = -1)) ⇒ Object

arg: label(const char*), current_item(int*), getter(const char*(*)(void* user_data,int idx)), user_data(void*), items_count(int), height_in_items(int) ret: bool



4748
4749
4750
# File 'lib/imgui.rb', line 4748

def self.ListBox_FnStrPtr(label, current_item, getter, user_data, items_count, height_in_items = -1)
  igListBox_FnStrPtr(label, current_item, getter, user_data, items_count, height_in_items)
end

.ListBox_Str_arr(label, current_item, items, items_count, height_in_items = -1)) ⇒ Object

arg: label(const char*), current_item(int*), items(const char* const[]), items_count(int), height_in_items(int) ret: bool



4742
4743
4744
# File 'lib/imgui.rb', line 4742

def self.ListBox_Str_arr(label, current_item, items, items_count, height_in_items = -1)
  igListBox_Str_arr(label, current_item, items, items_count, height_in_items)
end

.load_lib(libpath = './imgui.dylib', output_error = false) ⇒ Object



2718
2719
2720
2721
2722
# File 'lib/imgui.rb', line 2718

def self.load_lib(libpath = './imgui.dylib', output_error = false)
  ffi_lib_flags :now, :global
  ffi_lib libpath
  import_symbols(output_error) unless @@imgui_import_done
end

.LoadIniSettingsFromDisk(ini_filename) ⇒ Object

arg: ini_filename(const char*) ret: void

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).



4759
4760
4761
# File 'lib/imgui.rb', line 4759

def self.LoadIniSettingsFromDisk(ini_filename)  # call after CreateContext() and before the first call to NewFrame(). NewFrame() automatically calls LoadIniSettingsFromDisk(io.IniFilename).
  igLoadIniSettingsFromDisk(ini_filename)
end

.LoadIniSettingsFromMemory(ini_data, ini_size = 0) ⇒ Object

arg: ini_data(const char*), ini_size(size_t) ret: void



4765
4766
4767
# File 'lib/imgui.rb', line 4765

def self.LoadIniSettingsFromMemory(ini_data, ini_size = 0)  # call after CreateContext() and before the first call to NewFrame() to provide .ini data from your own data source.
  igLoadIniSettingsFromMemory(ini_data, ini_size)
end

.LogButtonsObject

ret: void



4770
4771
4772
# File 'lib/imgui.rb', line 4770

def self.LogButtons()  # helper to display buttons for logging to tty/file/clipboard
  igLogButtons()
end

.LogFinishObject

ret: void



4775
4776
4777
# File 'lib/imgui.rb', line 4775

def self.LogFinish()  # stop logging (close file, etc.)
  igLogFinish()
end

.LogText(fmt, *varargs) ⇒ Object

arg: fmt(const char*), …(…) ret: void



4781
4782
4783
# File 'lib/imgui.rb', line 4781

def self.LogText(fmt, *varargs)  # pass text data straight to log (without being displayed)
  igLogText(fmt, *varargs)
end

.LogToClipboard(auto_open_depth = -1)) ⇒ Object

arg: auto_open_depth(int) ret: void



4787
4788
4789
# File 'lib/imgui.rb', line 4787

def self.LogToClipboard(auto_open_depth = -1)  # start logging to OS clipboard
  igLogToClipboard(auto_open_depth)
end

.LogToFile(auto_open_depth = -1,, filename = nil) ⇒ Object

arg: auto_open_depth(int), filename(const char*) ret: void



4793
4794
4795
# File 'lib/imgui.rb', line 4793

def self.LogToFile(auto_open_depth = -1, filename = nil)  # start logging to file
  igLogToFile(auto_open_depth, filename)
end

.LogToTTY(auto_open_depth = -1)) ⇒ Object

arg: auto_open_depth(int) ret: void

Logging/Capture

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



4802
4803
4804
# File 'lib/imgui.rb', line 4802

def self.LogToTTY(auto_open_depth = -1)  # start logging to tty (stdout)
  igLogToTTY(auto_open_depth)
end

.MemAlloc(size) ⇒ Object

arg: size(size_t) ret: pointer



4808
4809
4810
# File 'lib/imgui.rb', line 4808

def self.MemAlloc(size)
  igMemAlloc(size)
end

.MemFree(ptr) ⇒ Object

arg: ptr(void*) ret: void



4814
4815
4816
# File 'lib/imgui.rb', line 4814

def self.MemFree(ptr)
  igMemFree(ptr)
end

Implied shortcut = NULL, selected = false, enabled = true



5969
5970
5971
5972
5973
5974
5975
5976
5977
# File 'lib/imgui.rb', line 5969

def self.MenuItem(*arg)  # Implied shortcut = NULL, selected = false, enabled = true
  # arg: 0:label(const char*), 1:shortcut(const char*), 2:selected(bool), 3:enabled(bool)
  # ret: bool
  return igMenuItem_Bool(arg[0], arg[1], arg[2], arg[3]) if arg.length == 4 && (arg[0].kind_of?(String) && arg[1].kind_of?(String) && (arg[2].is_a?(TrueClass) || arg[2].is_a?(FalseClass)) && (arg[3].is_a?(TrueClass) || arg[3].is_a?(FalseClass)))
  # arg: 0:label(const char*), 1:shortcut(const char*), 2:p_selected(bool*), 3:enabled(bool)
  # ret: bool
  return igMenuItem_BoolPtr(arg[0], arg[1], arg[2], arg[3]) if arg.length == 4 && (arg[0].kind_of?(String) && arg[1].kind_of?(String) && arg[2].kind_of?(FFI::Pointer) && (arg[3].is_a?(TrueClass) || arg[3].is_a?(FalseClass)))
  $stderr.puts("[Warning] MenuItem : No matching functions found (#{arg})")
end

arg: label(const char*), shortcut(const char*), selected(bool), enabled(bool) ret: bool



4820
4821
4822
# File 'lib/imgui.rb', line 4820

def self.MenuItem_Bool(label, shortcut = nil, selected = false, enabled = true)
  igMenuItem_Bool(label, shortcut, selected, enabled)
end

arg: label(const char*), shortcut(const char*), p_selected(bool*), enabled(bool) ret: bool



4826
4827
4828
# File 'lib/imgui.rb', line 4826

def self.MenuItem_BoolPtr(label, shortcut, p_selected, enabled = true)
  igMenuItem_BoolPtr(label, shortcut, p_selected, enabled)
end

.NewFrameObject

ret: void



4831
4832
4833
# File 'lib/imgui.rb', line 4831

def self.NewFrame()  # start a new Dear ImGui frame, you can submit any command from this point until Render()/EndFrame().
  igNewFrame()
end

.NewLineObject

ret: void



4836
4837
4838
# File 'lib/imgui.rb', line 4836

def self.NewLine()  # undo a SameLine() or force a new line when in a horizontal-layout context.
  igNewLine()
end

.NextColumnObject

ret: void



4841
4842
4843
# File 'lib/imgui.rb', line 4841

def self.NextColumn()  # next column, defaults to current row or next row if the current row is finished
  igNextColumn()
end

.OpenPopup(*arg) ⇒ Object

Popups: open/close functions

- OpenPopup(): set popup state to open. ImGuiPopupFlags are available for opening options.
- If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE.
- CloseCurrentPopup(): use inside the BeginPopup()/EndPopup() scope to close manually.
- CloseCurrentPopup() 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 IsWindowAppearing() after BeginPopup() to tell if a window just opened.
- IMPORTANT: Notice that for OpenPopupOnItemClick() we exceptionally default flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter


5988
5989
5990
5991
5992
5993
5994
5995
5996
# File 'lib/imgui.rb', line 5988

def self.OpenPopup(*arg)  # call to mark popup as open (don't call every frame!).
  # arg: 0:str_id(const char*), 1:popup_flags(ImGuiPopupFlags)
  # ret: void
  return igOpenPopup_Str(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(String) && arg[1].kind_of?(Integer))
  # arg: 0:id(ImGuiID), 1:popup_flags(ImGuiPopupFlags)
  # ret: void
  return igOpenPopup_ID(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(Integer) && arg[1].kind_of?(Integer))
  $stderr.puts("[Warning] OpenPopup : No matching functions found (#{arg})")
end

.OpenPopup_ID(id, popup_flags = 0) ⇒ Object

arg: id(ImGuiID), popup_flags(ImGuiPopupFlags) ret: void



4853
4854
4855
# File 'lib/imgui.rb', line 4853

def self.OpenPopup_ID(id, popup_flags = 0)
  igOpenPopup_ID(id, popup_flags)
end

.OpenPopup_Str(str_id, popup_flags = 0) ⇒ Object

arg: str_id(const char*), popup_flags(ImGuiPopupFlags) ret: void



4847
4848
4849
# File 'lib/imgui.rb', line 4847

def self.OpenPopup_Str(str_id, popup_flags = 0)
  igOpenPopup_Str(str_id, popup_flags)
end

.OpenPopupOnItemClick(str_id = nil, popup_flags = 1) ⇒ Object

arg: str_id(const char*), popup_flags(ImGuiPopupFlags) ret: void



4859
4860
4861
# File 'lib/imgui.rb', line 4859

def self.OpenPopupOnItemClick(str_id = nil, popup_flags = 1)  # 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)
  igOpenPopupOnItemClick(str_id, popup_flags)
end

.PlotHistogram(*arg) ⇒ Object

Implied values_offset = 0, overlay_text = NULL, scale_min = FLT_MAX, scale_max = FLT_MAX, graph_size = ImVec2(0, 0), stride = sizeof(float)



5998
5999
6000
6001
6002
6003
6004
6005
6006
# File 'lib/imgui.rb', line 5998

def self.PlotHistogram(*arg)  # Implied values_offset = 0, overlay_text = NULL, scale_min = FLT_MAX, scale_max = FLT_MAX, graph_size = ImVec2(0, 0), stride = sizeof(float)
  # arg: 0:label(const char*), 1:values(const float*), 2:values_count(int), 3:values_offset(int), 4:overlay_text(const char*), 5:scale_min(float), 6:scale_max(float), 7:graph_size(ImVec2), 8:stride(int)
  # ret: void
  return igPlotHistogram_FloatPtr(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8]) if arg.length == 9 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(Integer) && arg[3].kind_of?(Integer) && arg[4].kind_of?(String) && arg[5].kind_of?(Float) && arg[6].kind_of?(Float) && arg[7].kind_of?(ImVec2) && arg[8].kind_of?(Integer))
  # arg: 0:label(const char*), 1:values_getter(float(*)(void* data,int idx)), 2:data(void*), 3:values_count(int), 4:values_offset(int), 5:overlay_text(const char*), 6:scale_min(float), 7:scale_max(float), 8:graph_size(ImVec2)
  # ret: void
  return igPlotHistogram_FnFloatPtr(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8]) if arg.length == 9 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(FFI::Pointer) && arg[3].kind_of?(Integer) && arg[4].kind_of?(Integer) && arg[5].kind_of?(String) && arg[6].kind_of?(Float) && arg[7].kind_of?(Float) && arg[8].kind_of?(ImVec2))
  $stderr.puts("[Warning] PlotHistogram : No matching functions found (#{arg})")
end

.PlotHistogram_FloatPtr(label, values, values_count, values_offset = 0, overlay_text = nil, scale_min = Float::MAX, scale_max = Float::MAX, graph_size = ImVec2.create(0,0), stride = FFI::TYPE_FLOAT32.size) ⇒ Object

arg: label(const char*), values(const float*), values_count(int), values_offset(int), overlay_text(const char*), scale_min(float), scale_max(float), graph_size(ImVec2), stride(int) ret: void



4865
4866
4867
# File 'lib/imgui.rb', line 4865

def self.PlotHistogram_FloatPtr(label, values, values_count, values_offset = 0, overlay_text = nil, scale_min = Float::MAX, scale_max = Float::MAX, graph_size = ImVec2.create(0,0), stride = FFI::TYPE_FLOAT32.size)
  igPlotHistogram_FloatPtr(label, values, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, stride)
end

.PlotHistogram_FnFloatPtr(label, values_getter, data, values_count, values_offset = 0, overlay_text = nil, scale_min = Float::MAX, scale_max = Float::MAX, graph_size = ImVec2.create(0,0)) ⇒ Object

arg: label(const char*), values_getter(float(*)(void* data,int idx)), data(void*), values_count(int), values_offset(int), overlay_text(const char*), scale_min(float), scale_max(float), graph_size(ImVec2) ret: void



4871
4872
4873
# File 'lib/imgui.rb', line 4871

def self.PlotHistogram_FnFloatPtr(label, values_getter, data, values_count, values_offset = 0, overlay_text = nil, scale_min = Float::MAX, scale_max = Float::MAX, graph_size = ImVec2.create(0,0))
  igPlotHistogram_FnFloatPtr(label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size)
end

.PlotLines(*arg) ⇒ Object

Widgets: Data Plotting



6011
6012
6013
6014
6015
6016
6017
6018
6019
# File 'lib/imgui.rb', line 6011

def self.PlotLines(*arg)  # Implied values_offset = 0, overlay_text = NULL, scale_min = FLT_MAX, scale_max = FLT_MAX, graph_size = ImVec2(0, 0), stride = sizeof(float)
  # arg: 0:label(const char*), 1:values(const float*), 2:values_count(int), 3:values_offset(int), 4:overlay_text(const char*), 5:scale_min(float), 6:scale_max(float), 7:graph_size(ImVec2), 8:stride(int)
  # ret: void
  return igPlotLines_FloatPtr(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8]) if arg.length == 9 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(Integer) && arg[3].kind_of?(Integer) && arg[4].kind_of?(String) && arg[5].kind_of?(Float) && arg[6].kind_of?(Float) && arg[7].kind_of?(ImVec2) && arg[8].kind_of?(Integer))
  # arg: 0:label(const char*), 1:values_getter(float(*)(void* data,int idx)), 2:data(void*), 3:values_count(int), 4:values_offset(int), 5:overlay_text(const char*), 6:scale_min(float), 7:scale_max(float), 8:graph_size(ImVec2)
  # ret: void
  return igPlotLines_FnFloatPtr(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8]) if arg.length == 9 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(FFI::Pointer) && arg[3].kind_of?(Integer) && arg[4].kind_of?(Integer) && arg[5].kind_of?(String) && arg[6].kind_of?(Float) && arg[7].kind_of?(Float) && arg[8].kind_of?(ImVec2))
  $stderr.puts("[Warning] PlotLines : No matching functions found (#{arg})")
end

.PlotLines_FloatPtr(label, values, values_count, values_offset = 0, overlay_text = nil, scale_min = Float::MAX, scale_max = Float::MAX, graph_size = ImVec2.create(0,0), stride = FFI::TYPE_FLOAT32.size) ⇒ Object

arg: label(const char*), values(const float*), values_count(int), values_offset(int), overlay_text(const char*), scale_min(float), scale_max(float), graph_size(ImVec2), stride(int) ret: void



4877
4878
4879
# File 'lib/imgui.rb', line 4877

def self.PlotLines_FloatPtr(label, values, values_count, values_offset = 0, overlay_text = nil, scale_min = Float::MAX, scale_max = Float::MAX, graph_size = ImVec2.create(0,0), stride = FFI::TYPE_FLOAT32.size)
  igPlotLines_FloatPtr(label, values, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, stride)
end

.PlotLines_FnFloatPtr(label, values_getter, data, values_count, values_offset = 0, overlay_text = nil, scale_min = Float::MAX, scale_max = Float::MAX, graph_size = ImVec2.create(0,0)) ⇒ Object

arg: label(const char*), values_getter(float(*)(void* data,int idx)), data(void*), values_count(int), values_offset(int), overlay_text(const char*), scale_min(float), scale_max(float), graph_size(ImVec2) ret: void



4883
4884
4885
# File 'lib/imgui.rb', line 4883

def self.PlotLines_FnFloatPtr(label, values_getter, data, values_count, values_offset = 0, overlay_text = nil, scale_min = Float::MAX, scale_max = Float::MAX, graph_size = ImVec2.create(0,0))
  igPlotLines_FnFloatPtr(label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size)
end

.PopClipRectObject

ret: void



4888
4889
4890
# File 'lib/imgui.rb', line 4888

def self.PopClipRect()
  igPopClipRect()
end

.PopFontObject

ret: void



4893
4894
4895
# File 'lib/imgui.rb', line 4893

def self.PopFont()
  igPopFont()
end

.PopIDObject

ret: void



4898
4899
4900
# File 'lib/imgui.rb', line 4898

def self.PopID()  # pop from the ID stack.
  igPopID()
end

.PopItemFlagObject

ret: void



4903
4904
4905
# File 'lib/imgui.rb', line 4903

def self.PopItemFlag()
  igPopItemFlag()
end

.PopItemWidthObject

ret: void



4908
4909
4910
# File 'lib/imgui.rb', line 4908

def self.PopItemWidth()
  igPopItemWidth()
end

.PopStyleColor(count = 1) ⇒ Object

arg: count(int) ret: void



4914
4915
4916
# File 'lib/imgui.rb', line 4914

def self.PopStyleColor(count = 1)  # Implied count = 1
  igPopStyleColor(count)
end

.PopStyleVar(count = 1) ⇒ Object

arg: count(int) ret: void



4920
4921
4922
# File 'lib/imgui.rb', line 4920

def self.PopStyleVar(count = 1)  # Implied count = 1
  igPopStyleVar(count)
end

.PopTextWrapPosObject

ret: void



4925
4926
4927
# File 'lib/imgui.rb', line 4925

def self.PopTextWrapPos()
  igPopTextWrapPos()
end

.PrintProgramLinkStatus(handle) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/imgui_impl_opengl3.rb', line 44

def self.PrintProgramLinkStatus(handle)
  rvalue = ' ' * 4
  GL.GetProgramiv(handle, GL::LINK_STATUS, rvalue)
  rvalue = rvalue.unpack1('L')
  if rvalue == GL::FALSE
    $stderr.puts "Error in linking program"
    log_length = ' ' * 4
    GL.GetProgramiv(handle, GL::INFO_LOG_LENGTH, log_length)
    log_length = log_length.unpack1('L')
    if log_length > 0
      buf = ' ' * log_length
      GL.GetProgramInfoLog(handle, log_length, nil, buf)
      $stderr.puts(buf)
      exit()
    end
  end
end

.PrintShaderCompileStatus(handle) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/imgui_impl_opengl3.rb', line 26

def self.PrintShaderCompileStatus(handle)
  rvalue = ' ' * 4
  GL.GetShaderiv(handle, GL::COMPILE_STATUS, rvalue)
  rvalue = rvalue.unpack1('L')
  if rvalue == GL::FALSE
    $stderr.puts "Error in compiling shader"
    log_length = ' ' * 4
    GL.GetShaderiv(handle, GL::INFO_LOG_LENGTH, log_length)
    log_length = log_length.unpack1('L')
    if log_length > 0
      buf = ' ' * log_length
      GL.GetShaderInfoLog(handle, log_length, nil, buf)
      $stderr.puts(buf)
      exit()
    end
  end
end

.ProgressBar(fraction, size_arg = ImVec2.create(-FLT_MIN,0), overlay = nil) ⇒ Object

arg: fraction(float), size_arg(ImVec2), overlay(const char*) ret: void



4931
4932
4933
# File 'lib/imgui.rb', line 4931

def self.ProgressBar(fraction, size_arg = ImVec2.create(-FLT_MIN,0), overlay = nil)
  igProgressBar(fraction, size_arg, overlay)
end

.PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect) ⇒ Object

arg: clip_rect_min(ImVec2), clip_rect_max(ImVec2), intersect_with_current_clip_rect(bool) ret: void

Clipping

  • Mouse hovering is affected by ImGui::PushClipRect() calls, unlike direct calls to ImDrawList::PushClipRect() which are render only.



4940
4941
4942
# File 'lib/imgui.rb', line 4940

def self.PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect)
  igPushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect)
end

.PushFont(font) ⇒ Object

arg: font(ImFont*) ret: void

Parameters stacks (shared)



4948
4949
4950
# File 'lib/imgui.rb', line 4948

def self.PushFont(font)  # use NULL as a shortcut to push default font
  igPushFont(font)
end

.PushID(*arg) ⇒ Object

ID stack/scopes Read the FAQ (docs/FAQ.md or dearimgui.com/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.



6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
# File 'lib/imgui.rb', line 6033

def self.PushID(*arg)  # push string into the ID stack (will hash string).
  # arg: 0:str_id(const char*)
  # ret: void
  return igPushID_Str(arg[0]) if arg.length == 1 && (arg[0].kind_of?(String))
  # arg: 0:str_id_begin(const char*), 1:str_id_end(const char*)
  # ret: void
  return igPushID_StrStr(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(String) && arg[1].kind_of?(String))
  # arg: 0:ptr_id(const void*)
  # ret: void
  return igPushID_Ptr(arg[0]) if arg.length == 1 && (arg[0].kind_of?(FFI::Pointer))
  # arg: 0:int_id(int)
  # ret: void
  return igPushID_Int(arg[0]) if arg.length == 1 && (arg[0].kind_of?(Integer))
  $stderr.puts("[Warning] PushID : No matching functions found (#{arg})")
end

.PushID_Int(int_id) ⇒ Object

arg: int_id(int) ret: void



4972
4973
4974
# File 'lib/imgui.rb', line 4972

def self.PushID_Int(int_id)
  igPushID_Int(int_id)
end

.PushID_Ptr(ptr_id) ⇒ Object

arg: ptr_id(const void*) ret: void



4966
4967
4968
# File 'lib/imgui.rb', line 4966

def self.PushID_Ptr(ptr_id)
  igPushID_Ptr(ptr_id)
end

.PushID_Str(str_id) ⇒ Object

arg: str_id(const char*) ret: void



4954
4955
4956
# File 'lib/imgui.rb', line 4954

def self.PushID_Str(str_id)
  igPushID_Str(str_id)
end

.PushID_StrStr(str_id_begin, str_id_end) ⇒ Object

arg: str_id_begin(const char*), str_id_end(const char*) ret: void



4960
4961
4962
# File 'lib/imgui.rb', line 4960

def self.PushID_StrStr(str_id_begin, str_id_end)
  igPushID_StrStr(str_id_begin, str_id_end)
end

.PushItemFlag(option, enabled) ⇒ Object

arg: option(ImGuiItemFlags), enabled(bool) ret: void



4978
4979
4980
# File 'lib/imgui.rb', line 4978

def self.PushItemFlag(option, enabled)  # modify specified shared item flag, e.g. PushItemFlag(ImGuiItemFlags_NoTabStop, true)
  igPushItemFlag(option, enabled)
end

.PushItemWidth(item_width) ⇒ Object

arg: item_width(float) ret: void

Parameters stacks (current window)



4986
4987
4988
# File 'lib/imgui.rb', line 4986

def self.PushItemWidth(item_width)  # 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).
  igPushItemWidth(item_width)
end

.PushStyleColor(*arg) ⇒ Object

modify a style color. always use this if you modify the style after NewFrame().



6049
6050
6051
6052
6053
6054
6055
6056
6057
# File 'lib/imgui.rb', line 6049

def self.PushStyleColor(*arg)  # modify a style color. always use this if you modify the style after NewFrame().
  # arg: 0:idx(ImGuiCol), 1:col(ImU32)
  # ret: void
  return igPushStyleColor_U32(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(Integer) && arg[1].kind_of?(Integer))
  # arg: 0:idx(ImGuiCol), 1:col(ImVec4)
  # ret: void
  return igPushStyleColor_Vec4(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(Integer) && arg[1].kind_of?(ImVec4))
  $stderr.puts("[Warning] PushStyleColor : No matching functions found (#{arg})")
end

.PushStyleColor_U32(idx, col) ⇒ Object

arg: idx(ImGuiCol), col(ImU32) ret: void



4992
4993
4994
# File 'lib/imgui.rb', line 4992

def self.PushStyleColor_U32(idx, col)
  igPushStyleColor_U32(idx, col)
end

.PushStyleColor_Vec4(idx, col) ⇒ Object

arg: idx(ImGuiCol), col(ImVec4) ret: void



4998
4999
5000
# File 'lib/imgui.rb', line 4998

def self.PushStyleColor_Vec4(idx, col)
  igPushStyleColor_Vec4(idx, col)
end

.PushStyleVar(*arg) ⇒ Object

modify a style float variable. always use this if you modify the style after NewFrame()!



6059
6060
6061
6062
6063
6064
6065
6066
6067
# File 'lib/imgui.rb', line 6059

def self.PushStyleVar(*arg)  # modify a style float variable. always use this if you modify the style after NewFrame()!
  # arg: 0:idx(ImGuiStyleVar), 1:val(float)
  # ret: void
  return igPushStyleVar_Float(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(Integer) && arg[1].kind_of?(Float))
  # arg: 0:idx(ImGuiStyleVar), 1:val(ImVec2)
  # ret: void
  return igPushStyleVar_Vec2(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(Integer) && arg[1].kind_of?(ImVec2))
  $stderr.puts("[Warning] PushStyleVar : No matching functions found (#{arg})")
end

.PushStyleVar_Float(idx, val) ⇒ Object

arg: idx(ImGuiStyleVar), val(float) ret: void



5004
5005
5006
# File 'lib/imgui.rb', line 5004

def self.PushStyleVar_Float(idx, val)
  igPushStyleVar_Float(idx, val)
end

.PushStyleVar_Vec2(idx, val) ⇒ Object

arg: idx(ImGuiStyleVar), val(ImVec2) ret: void



5010
5011
5012
# File 'lib/imgui.rb', line 5010

def self.PushStyleVar_Vec2(idx, val)
  igPushStyleVar_Vec2(idx, val)
end

.PushStyleVarX(idx, val_x) ⇒ Object

arg: idx(ImGuiStyleVar), val_x(float) ret: void



5016
5017
5018
# File 'lib/imgui.rb', line 5016

def self.PushStyleVarX(idx, val_x)  # modify X component of a style ImVec2 variable. "
  igPushStyleVarX(idx, val_x)
end

.PushStyleVarY(idx, val_y) ⇒ Object

arg: idx(ImGuiStyleVar), val_y(float) ret: void



5022
5023
5024
# File 'lib/imgui.rb', line 5022

def self.PushStyleVarY(idx, val_y)  # modify Y component of a style ImVec2 variable. "
  igPushStyleVarY(idx, val_y)
end

.PushTextWrapPos(wrap_local_pos_x = 0.0) ⇒ Object

arg: wrap_local_pos_x(float) ret: void



5028
5029
5030
# File 'lib/imgui.rb', line 5028

def self.PushTextWrapPos(wrap_local_pos_x = 0.0)  # push word-wrapping position for 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
  igPushTextWrapPos(wrap_local_pos_x)
end

.RadioButton(*arg) ⇒ Object

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



6069
6070
6071
6072
6073
6074
6075
6076
6077
# File 'lib/imgui.rb', line 6069

def self.RadioButton(*arg)  # use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; }
  # arg: 0:label(const char*), 1:active(bool)
  # ret: bool
  return igRadioButton_Bool(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(String) && (arg[1].is_a?(TrueClass) || arg[1].is_a?(FalseClass)))
  # arg: 0:label(const char*), 1:v(int*), 2:v_button(int)
  # ret: bool
  return igRadioButton_IntPtr(arg[0], arg[1], arg[2]) if arg.length == 3 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(Integer))
  $stderr.puts("[Warning] RadioButton : No matching functions found (#{arg})")
end

.RadioButton_Bool(label, active) ⇒ Object

arg: label(const char*), active(bool) ret: bool



5034
5035
5036
# File 'lib/imgui.rb', line 5034

def self.RadioButton_Bool(label, active)
  igRadioButton_Bool(label, active)
end

.RadioButton_IntPtr(label, v, v_button) ⇒ Object

arg: label(const char*), v(int*), v_button(int) ret: bool



5040
5041
5042
# File 'lib/imgui.rb', line 5040

def self.RadioButton_IntPtr(label, v, v_button)
  igRadioButton_IntPtr(label, v, v_button)
end

.RenderObject

ret: void



5045
5046
5047
# File 'lib/imgui.rb', line 5045

def self.Render()  # ends the Dear ImGui frame, finalize the draw data. You can then get call GetDrawData().
  igRender()
end

.ResetMouseDragDelta(button = 0) ⇒ Object

arg: button(ImGuiMouseButton) ret: void



5051
5052
5053
# File 'lib/imgui.rb', line 5051

def self.ResetMouseDragDelta(button = 0)  # Implied button = 0
  igResetMouseDragDelta(button)
end

.SameLine(offset_from_start_x = 0.0, spacing = -1.0)) ⇒ Object

arg: offset_from_start_x(float), spacing(float) ret: void



5057
5058
5059
# File 'lib/imgui.rb', line 5057

def self.SameLine(offset_from_start_x = 0.0, spacing = -1.0)  # Implied offset_from_start_x = 0.0f, spacing = -1.0f
  igSameLine(offset_from_start_x, spacing)
end

.SaveIniSettingsToDisk(ini_filename) ⇒ Object

arg: ini_filename(const char*) ret: void



5063
5064
5065
# File 'lib/imgui.rb', line 5063

def self.SaveIniSettingsToDisk(ini_filename)  # 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 DestroyContext).
  igSaveIniSettingsToDisk(ini_filename)
end

.SaveIniSettingsToMemory(out_ini_size = nil) ⇒ Object

arg: out_ini_size(size_t*) ret: pointer



5069
5070
5071
# File 'lib/imgui.rb', line 5069

def self.SaveIniSettingsToMemory(out_ini_size = nil)  # 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.
  igSaveIniSettingsToMemory(out_ini_size)
end

.Selectable(*arg) ⇒ Object

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.



6083
6084
6085
6086
6087
6088
6089
6090
6091
# File 'lib/imgui.rb', line 6083

def self.Selectable(*arg)  # Implied selected = false, flags = 0, size = ImVec2(0, 0)
  # arg: 0:label(const char*), 1:selected(bool), 2:flags(ImGuiSelectableFlags), 3:size(ImVec2)
  # ret: bool
  return igSelectable_Bool(arg[0], arg[1], arg[2], arg[3]) if arg.length == 4 && (arg[0].kind_of?(String) && (arg[1].is_a?(TrueClass) || arg[1].is_a?(FalseClass)) && arg[2].kind_of?(Integer) && arg[3].kind_of?(ImVec2))
  # arg: 0:label(const char*), 1:p_selected(bool*), 2:flags(ImGuiSelectableFlags), 3:size(ImVec2)
  # ret: bool
  return igSelectable_BoolPtr(arg[0], arg[1], arg[2], arg[3]) if arg.length == 4 && (arg[0].kind_of?(String) && arg[1].kind_of?(FFI::Pointer) && arg[2].kind_of?(Integer) && arg[3].kind_of?(ImVec2))
  $stderr.puts("[Warning] Selectable : No matching functions found (#{arg})")
end

.Selectable_Bool(label, selected = false, flags = 0, size = ImVec2.create(0,0)) ⇒ Object

arg: label(const char*), selected(bool), flags(ImGuiSelectableFlags), size(ImVec2) ret: bool



5075
5076
5077
# File 'lib/imgui.rb', line 5075

def self.Selectable_Bool(label, selected = false, flags = 0, size = ImVec2.create(0,0))
  igSelectable_Bool(label, selected, flags, size)
end

.Selectable_BoolPtr(label, p_selected, flags = 0, size = ImVec2.create(0,0)) ⇒ Object

arg: label(const char*), p_selected(bool*), flags(ImGuiSelectableFlags), size(ImVec2) ret: bool



5081
5082
5083
# File 'lib/imgui.rb', line 5081

def self.Selectable_BoolPtr(label, p_selected, flags = 0, size = ImVec2.create(0,0))
  igSelectable_BoolPtr(label, p_selected, flags, size)
end

.SeparatorObject

ret: void

Other layout functions



5088
5089
5090
# File 'lib/imgui.rb', line 5088

def self.Separator()  # separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator.
  igSeparator()
end

.SeparatorText(label) ⇒ Object

arg: label(const char*) ret: void



5094
5095
5096
# File 'lib/imgui.rb', line 5094

def self.SeparatorText(label)  # currently: formatted text with an horizontal line
  igSeparatorText(label)
end

.set_vertex(xy, uv, color) ⇒ Object

INTERNAL


384
385
386
387
388
# File 'lib/imgui_impl_raylib.rb', line 384

def self.set_vertex(xy, uv, color)
  Raylib.rlColor4ub(color[0], color[1], color[2], color[3])
  Raylib.rlTexCoord2f(uv[0], uv[1])
  Raylib.rlVertex2f(xy[0], xy[1])
end

.SetAllocatorFunctions(alloc_func, free_func, user_data = nil) ⇒ Object

arg: alloc_func(ImGuiMemAllocFunc), free_func(ImGuiMemFreeFunc), user_data(void*) ret: void

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 SetCurrentContext() + SetAllocatorFunctions() for each static/DLL boundary you are calling from. Read “Context and Memory Allocators” section of imgui.cpp for more details.



5105
5106
5107
# File 'lib/imgui.rb', line 5105

def self.SetAllocatorFunctions(alloc_func, free_func, user_data = nil)
  igSetAllocatorFunctions(alloc_func, free_func, user_data)
end

.SetClipboardText(text) ⇒ Object

arg: text(const char*) ret: void



5111
5112
5113
# File 'lib/imgui.rb', line 5111

def self.SetClipboardText(text)
  igSetClipboardText(text)
end

.SetColorEditOptions(flags) ⇒ Object

arg: flags(ImGuiColorEditFlags) ret: void



5117
5118
5119
# File 'lib/imgui.rb', line 5117

def self.SetColorEditOptions(flags)  # 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.
  igSetColorEditOptions(flags)
end

.SetColumnOffset(column_index, offset_x) ⇒ Object

arg: column_index(int), offset_x(float) ret: void



5123
5124
5125
# File 'lib/imgui.rb', line 5123

def self.SetColumnOffset(column_index, offset_x)  # set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column
  igSetColumnOffset(column_index, offset_x)
end

.SetColumnWidth(column_index, width) ⇒ Object

arg: column_index(int), width(float) ret: void



5129
5130
5131
# File 'lib/imgui.rb', line 5129

def self.SetColumnWidth(column_index, width)  # set column width (in pixels). pass -1 to use current column
  igSetColumnWidth(column_index, width)
end

.SetCurrentContext(ctx) ⇒ Object

arg: ctx(ImGuiContext*) ret: void



5135
5136
5137
# File 'lib/imgui.rb', line 5135

def self.SetCurrentContext(ctx)
  igSetCurrentContext(ctx)
end

.SetCursorPos(local_pos) ⇒ Object

arg: local_pos(ImVec2) ret: void



5141
5142
5143
# File 'lib/imgui.rb', line 5141

def self.SetCursorPos(local_pos)  # [window-local] "
  igSetCursorPos(local_pos)
end

.SetCursorPosX(local_x) ⇒ Object

arg: local_x(float) ret: void



5147
5148
5149
# File 'lib/imgui.rb', line 5147

def self.SetCursorPosX(local_x)  # [window-local] "
  igSetCursorPosX(local_x)
end

.SetCursorPosY(local_y) ⇒ Object

arg: local_y(float) ret: void



5153
5154
5155
# File 'lib/imgui.rb', line 5153

def self.SetCursorPosY(local_y)  # [window-local] "
  igSetCursorPosY(local_y)
end

.SetCursorScreenPos(pos) ⇒ Object

arg: pos(ImVec2) ret: void



5159
5160
5161
# File 'lib/imgui.rb', line 5159

def self.SetCursorScreenPos(pos)  # cursor position, absolute coordinates. THIS IS YOUR BEST FRIEND.
  igSetCursorScreenPos(pos)
end

.SetDragDropPayload(type, data, sz, cond = 0) ⇒ Object

arg: type(const char*), data(const void*), sz(size_t), cond(ImGuiCond) ret: bool



5165
5166
5167
# File 'lib/imgui.rb', line 5165

def self.SetDragDropPayload(type, data, sz, cond = 0)  # 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.
  igSetDragDropPayload(type, data, sz, cond)
end

.SetItemDefaultFocusObject

ret: void

Focus, Activation

  • Prefer using “SetItemDefaultFocus()” over “if (IsWindowAppearing()) SetScrollHereY()” when applicable to signify “this is the default item”



5173
5174
5175
# File 'lib/imgui.rb', line 5173

def self.SetItemDefaultFocus()  # make last item the default focused item of a window.
  igSetItemDefaultFocus()
end

.SetItemKeyOwner(key) ⇒ Object

arg: key(ImGuiKey) ret: void

Inputs Utilities: Key/Input Ownership [BETA]

  • One common use case would be to allow your items to disable standard inputs behaviors such as Tab or Alt key handling, Mouse Wheel scrolling, etc. e.g. Button(…); SetItemKeyOwner(ImGuiKey_MouseWheelY); to make hovering/activating a button disable wheel for scrolling.

  • Reminder ImGuiKey enum include access to mouse buttons and gamepad, so key ownership can apply to them.

  • Many related features are still in imgui_internal.h. For instance, most IsKeyXXX()/IsMouseXXX() functions have an owner-id-aware version.



5186
5187
5188
# File 'lib/imgui.rb', line 5186

def self.SetItemKeyOwner(key)  # Set key owner to last item ID if it is hovered or active. Equivalent to 'if (IsItemHovered() || IsItemActive()) { SetKeyOwner(key, GetItemID());'.
  igSetItemKeyOwner(key)
end

.SetItemTooltip(fmt, *varargs) ⇒ Object

arg: fmt(const char*), …(…) ret: void



5192
5193
5194
# File 'lib/imgui.rb', line 5192

def self.SetItemTooltip(fmt, *varargs)  # set a text-only tooltip if preceding item was hovered. override any previous call to SetTooltip().
  igSetItemTooltip(fmt, *varargs)
end

.SetKeyboardFocusHere(offset = 0) ⇒ Object

arg: offset(int) ret: void



5198
5199
5200
# File 'lib/imgui.rb', line 5198

def self.SetKeyboardFocusHere(offset = 0)  # Implied offset = 0
  igSetKeyboardFocusHere(offset)
end

.SetMouseCursor(cursor_type) ⇒ Object

arg: cursor_type(ImGuiMouseCursor) ret: void



5204
5205
5206
# File 'lib/imgui.rb', line 5204

def self.SetMouseCursor(cursor_type)  # set desired mouse cursor shape
  igSetMouseCursor(cursor_type)
end

.SetNextFrameWantCaptureKeyboard(want_capture_keyboard) ⇒ Object

arg: want_capture_keyboard(bool) ret: void



5210
5211
5212
# File 'lib/imgui.rb', line 5210

def self.SetNextFrameWantCaptureKeyboard(want_capture_keyboard)  # 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 NewFrame() call.
  igSetNextFrameWantCaptureKeyboard(want_capture_keyboard)
end

.SetNextFrameWantCaptureMouse(want_capture_mouse) ⇒ Object

arg: want_capture_mouse(bool) ret: void



5216
5217
5218
# File 'lib/imgui.rb', line 5216

def self.SetNextFrameWantCaptureMouse(want_capture_mouse)  # 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 NewFrame() call.
  igSetNextFrameWantCaptureMouse(want_capture_mouse)
end

.SetNextItemAllowOverlapObject

ret: void

Overlapping mode



5223
5224
5225
# File 'lib/imgui.rb', line 5223

def self.SetNextItemAllowOverlap()  # allow next item to be overlapped by a subsequent item. Useful with invisible buttons, selectable, treenode covering an area where subsequent items may need to be added. Note that both Selectable() and TreeNode() have dedicated flags doing this.
  igSetNextItemAllowOverlap()
end

.SetNextItemOpen(is_open, cond = 0) ⇒ Object

arg: is_open(bool), cond(ImGuiCond) ret: void



5229
5230
5231
# File 'lib/imgui.rb', line 5229

def self.SetNextItemOpen(is_open, cond = 0)  # set next TreeNode/CollapsingHeader open state.
  igSetNextItemOpen(is_open, cond)
end

.SetNextItemSelectionUserData(selection_user_data) ⇒ Object

arg: selection_user_data(ImGuiSelectionUserData) ret: void



5235
5236
5237
# File 'lib/imgui.rb', line 5235

def self.SetNextItemSelectionUserData(selection_user_data)
  igSetNextItemSelectionUserData(selection_user_data)
end

.SetNextItemShortcut(key_chord, flags = 0) ⇒ Object

arg: key_chord(ImGuiKeyChord), flags(ImGuiInputFlags) ret: void



5241
5242
5243
# File 'lib/imgui.rb', line 5241

def self.SetNextItemShortcut(key_chord, flags = 0)
  igSetNextItemShortcut(key_chord, flags)
end

.SetNextItemStorageID(storage_id) ⇒ Object

arg: storage_id(ImGuiID) ret: void



5247
5248
5249
# File 'lib/imgui.rb', line 5247

def self.SetNextItemStorageID(storage_id)  # set id to use for open/close storage (default to same as item id).
  igSetNextItemStorageID(storage_id)
end

.SetNextItemWidth(item_width) ⇒ Object

arg: item_width(float) ret: void



5253
5254
5255
# File 'lib/imgui.rb', line 5253

def self.SetNextItemWidth(item_width)  # 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)
  igSetNextItemWidth(item_width)
end

.SetNextWindowBgAlpha(alpha) ⇒ Object

arg: alpha(float) ret: void



5259
5260
5261
# File 'lib/imgui.rb', line 5259

def self.SetNextWindowBgAlpha(alpha)  # set next window background color alpha. helper to easily override the Alpha component of ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground.
  igSetNextWindowBgAlpha(alpha)
end

.SetNextWindowCollapsed(collapsed, cond = 0) ⇒ Object

arg: collapsed(bool), cond(ImGuiCond) ret: void



5265
5266
5267
# File 'lib/imgui.rb', line 5265

def self.SetNextWindowCollapsed(collapsed, cond = 0)  # set next window collapsed state. call before Begin()
  igSetNextWindowCollapsed(collapsed, cond)
end

.SetNextWindowContentSize(size) ⇒ Object

arg: size(ImVec2) ret: void



5271
5272
5273
# File 'lib/imgui.rb', line 5271

def self.SetNextWindowContentSize(size)  # 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 Begin()
  igSetNextWindowContentSize(size)
end

.SetNextWindowFocusObject

ret: void



5276
5277
5278
# File 'lib/imgui.rb', line 5276

def self.SetNextWindowFocus()  # set next window to be focused / top-most. call before Begin()
  igSetNextWindowFocus()
end

.SetNextWindowPos(pos, cond = 0, pivot = ImVec2.create(0,0)) ⇒ Object

arg: pos(ImVec2), cond(ImGuiCond), pivot(ImVec2) ret: void

Window manipulation

  • Prefer using SetNextXXX functions (before Begin) rather that SetXXX functions (after Begin).



5285
5286
5287
# File 'lib/imgui.rb', line 5285

def self.SetNextWindowPos(pos, cond = 0, pivot = ImVec2.create(0,0))  # Implied pivot = ImVec2(0, 0)
  igSetNextWindowPos(pos, cond, pivot)
end

.SetNextWindowScroll(scroll) ⇒ Object

arg: scroll(ImVec2) ret: void



5291
5292
5293
# File 'lib/imgui.rb', line 5291

def self.SetNextWindowScroll(scroll)  # set next window scrolling value (use < 0.0f to not affect a given axis).
  igSetNextWindowScroll(scroll)
end

.SetNextWindowSize(size, cond = 0) ⇒ Object

arg: size(ImVec2), cond(ImGuiCond) ret: void



5297
5298
5299
# File 'lib/imgui.rb', line 5297

def self.SetNextWindowSize(size, cond = 0)  # set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
  igSetNextWindowSize(size, cond)
end

.SetNextWindowSizeConstraints(size_min, size_max, custom_callback = nil, custom_callback_data = nil) ⇒ Object

arg: size_min(ImVec2), size_max(ImVec2), custom_callback(ImGuiSizeCallback), custom_callback_data(void*) ret: void



5303
5304
5305
# File 'lib/imgui.rb', line 5303

def self.SetNextWindowSizeConstraints(size_min, size_max, custom_callback = nil, custom_callback_data = nil)  # set next window size limits. use 0.0f or FLT_MAX if you don't want limits. Use -1 for both min and max of same axis to preserve current size (which itself is a constraint). Use callback to apply non-trivial programmatic constraints.
  igSetNextWindowSizeConstraints(size_min, size_max, custom_callback, custom_callback_data)
end

.SetScrollFromPosX(local_x, center_x_ratio = 0.5) ⇒ Object

arg: local_x(float), center_x_ratio(float) ret: void



5309
5310
5311
# File 'lib/imgui.rb', line 5309

def self.SetScrollFromPosX(local_x, center_x_ratio = 0.5)  # adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position.
  igSetScrollFromPosX(local_x, center_x_ratio)
end

.SetScrollFromPosY(local_y, center_y_ratio = 0.5) ⇒ Object

arg: local_y(float), center_y_ratio(float) ret: void



5315
5316
5317
# File 'lib/imgui.rb', line 5315

def self.SetScrollFromPosY(local_y, center_y_ratio = 0.5)  # adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position.
  igSetScrollFromPosY(local_y, center_y_ratio)
end

.SetScrollHereX(center_x_ratio = 0.5) ⇒ Object

arg: center_x_ratio(float) ret: void



5321
5322
5323
# File 'lib/imgui.rb', line 5321

def self.SetScrollHereX(center_x_ratio = 0.5)  # 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 SetItemDefaultFocus() instead.
  igSetScrollHereX(center_x_ratio)
end

.SetScrollHereY(center_y_ratio = 0.5) ⇒ Object

arg: center_y_ratio(float) ret: void



5327
5328
5329
# File 'lib/imgui.rb', line 5327

def self.SetScrollHereY(center_y_ratio = 0.5)  # 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 SetItemDefaultFocus() instead.
  igSetScrollHereY(center_y_ratio)
end

.SetScrollX(scroll_x) ⇒ Object

arg: scroll_x(float) ret: void



5333
5334
5335
# File 'lib/imgui.rb', line 5333

def self.SetScrollX(scroll_x)  # set scrolling amount [0 .. GetScrollMaxX()]
  igSetScrollX(scroll_x)
end

.SetScrollY(scroll_y) ⇒ Object

arg: scroll_y(float) ret: void



5339
5340
5341
# File 'lib/imgui.rb', line 5339

def self.SetScrollY(scroll_y)  # set scrolling amount [0 .. GetScrollMaxY()]
  igSetScrollY(scroll_y)
end

.SetStateStorage(storage) ⇒ Object

arg: storage(ImGuiStorage*) ret: void



5345
5346
5347
# File 'lib/imgui.rb', line 5345

def self.SetStateStorage(storage)  # replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
  igSetStateStorage(storage)
end

.SetTabItemClosed(tab_or_docked_window_label) ⇒ Object

arg: tab_or_docked_window_label(const char*) ret: void



5351
5352
5353
# File 'lib/imgui.rb', line 5351

def self.SetTabItemClosed(tab_or_docked_window_label)  # 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.
  igSetTabItemClosed(tab_or_docked_window_label)
end

.SetTooltip(fmt, *varargs) ⇒ Object

arg: fmt(const char*), …(…) ret: void



5357
5358
5359
# File 'lib/imgui.rb', line 5357

def self.SetTooltip(fmt, *varargs)  # set a text-only tooltip. Often used after a ImGui::IsItemHovered() check. Override any previous call to SetTooltip().
  igSetTooltip(fmt, *varargs)
end

.SetWindowCollapsed(*arg) ⇒ Object

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



6093
6094
6095
6096
6097
6098
6099
6100
6101
# File 'lib/imgui.rb', line 6093

def self.SetWindowCollapsed(*arg)  # (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
  # arg: 0:collapsed(bool), 1:cond(ImGuiCond)
  # ret: void
  return igSetWindowCollapsed_Bool(arg[0], arg[1]) if arg.length == 2 && ((arg[0].is_a?(TrueClass) || arg[0].is_a?(FalseClass)) && arg[1].kind_of?(Integer))
  # arg: 0:name(const char*), 1:collapsed(bool), 2:cond(ImGuiCond)
  # ret: void
  return igSetWindowCollapsed_Str(arg[0], arg[1], arg[2]) if arg.length == 3 && (arg[0].kind_of?(String) && (arg[1].is_a?(TrueClass) || arg[1].is_a?(FalseClass)) && arg[2].kind_of?(Integer))
  $stderr.puts("[Warning] SetWindowCollapsed : No matching functions found (#{arg})")
end

.SetWindowCollapsed_Bool(collapsed, cond = 0) ⇒ Object

arg: collapsed(bool), cond(ImGuiCond) ret: void



5363
5364
5365
# File 'lib/imgui.rb', line 5363

def self.SetWindowCollapsed_Bool(collapsed, cond = 0)
  igSetWindowCollapsed_Bool(collapsed, cond)
end

.SetWindowCollapsed_Str(name, collapsed, cond = 0) ⇒ Object

arg: name(const char*), collapsed(bool), cond(ImGuiCond) ret: void



5369
5370
5371
# File 'lib/imgui.rb', line 5369

def self.SetWindowCollapsed_Str(name, collapsed, cond = 0)
  igSetWindowCollapsed_Str(name, collapsed, cond)
end

.SetWindowFocus(*arg) ⇒ Object

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



6103
6104
6105
6106
6107
6108
6109
6110
6111
# File 'lib/imgui.rb', line 6103

def self.SetWindowFocus(*arg)  # (not recommended) set current window to be focused / top-most. prefer using SetNextWindowFocus().
  # arg: 
  # ret: void
  return igSetWindowFocus_Nil() if arg.length == 0 && ()
  # arg: 0:name(const char*)
  # ret: void
  return igSetWindowFocus_Str(arg[0]) if arg.length == 1 && (arg[0].kind_of?(String))
  $stderr.puts("[Warning] SetWindowFocus : No matching functions found (#{arg})")
end

.SetWindowFocus_NilObject

ret: void



5374
5375
5376
# File 'lib/imgui.rb', line 5374

def self.SetWindowFocus_Nil()
  igSetWindowFocus_Nil()
end

.SetWindowFocus_Str(name) ⇒ Object

arg: name(const char*) ret: void



5380
5381
5382
# File 'lib/imgui.rb', line 5380

def self.SetWindowFocus_Str(name)
  igSetWindowFocus_Str(name)
end

.SetWindowFontScale(scale) ⇒ Object

arg: scale(float) ret: void



5386
5387
5388
# File 'lib/imgui.rb', line 5386

def self.SetWindowFontScale(scale)  # [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 ImFontAtlas + call style.ScaleAllSizes().
  igSetWindowFontScale(scale)
end

.SetWindowPos(*arg) ⇒ Object

(not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.



6113
6114
6115
6116
6117
6118
6119
6120
6121
# File 'lib/imgui.rb', line 6113

def self.SetWindowPos(*arg)  # (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.
  # arg: 0:pos(ImVec2), 1:cond(ImGuiCond)
  # ret: void
  return igSetWindowPos_Vec2(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(ImVec2) && arg[1].kind_of?(Integer))
  # arg: 0:name(const char*), 1:pos(ImVec2), 2:cond(ImGuiCond)
  # ret: void
  return igSetWindowPos_Str(arg[0], arg[1], arg[2]) if arg.length == 3 && (arg[0].kind_of?(String) && arg[1].kind_of?(ImVec2) && arg[2].kind_of?(Integer))
  $stderr.puts("[Warning] SetWindowPos : No matching functions found (#{arg})")
end

.SetWindowPos_Str(name, pos, cond = 0) ⇒ Object

arg: name(const char*), pos(ImVec2), cond(ImGuiCond) ret: void



5398
5399
5400
# File 'lib/imgui.rb', line 5398

def self.SetWindowPos_Str(name, pos, cond = 0)
  igSetWindowPos_Str(name, pos, cond)
end

.SetWindowPos_Vec2(pos, cond = 0) ⇒ Object

arg: pos(ImVec2), cond(ImGuiCond) ret: void



5392
5393
5394
# File 'lib/imgui.rb', line 5392

def self.SetWindowPos_Vec2(pos, cond = 0)
  igSetWindowPos_Vec2(pos, cond)
end

.SetWindowSize(*arg) ⇒ Object

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



6123
6124
6125
6126
6127
6128
6129
6130
6131
# File 'lib/imgui.rb', line 6123

def self.SetWindowSize(*arg)  # (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0, 0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
  # arg: 0:size(ImVec2), 1:cond(ImGuiCond)
  # ret: void
  return igSetWindowSize_Vec2(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(ImVec2) && arg[1].kind_of?(Integer))
  # arg: 0:name(const char*), 1:size(ImVec2), 2:cond(ImGuiCond)
  # ret: void
  return igSetWindowSize_Str(arg[0], arg[1], arg[2]) if arg.length == 3 && (arg[0].kind_of?(String) && arg[1].kind_of?(ImVec2) && arg[2].kind_of?(Integer))
  $stderr.puts("[Warning] SetWindowSize : No matching functions found (#{arg})")
end

.SetWindowSize_Str(name, size, cond = 0) ⇒ Object

arg: name(const char*), size(ImVec2), cond(ImGuiCond) ret: void



5410
5411
5412
# File 'lib/imgui.rb', line 5410

def self.SetWindowSize_Str(name, size, cond = 0)
  igSetWindowSize_Str(name, size, cond)
end

.SetWindowSize_Vec2(size, cond = 0) ⇒ Object

arg: size(ImVec2), cond(ImGuiCond) ret: void



5404
5405
5406
# File 'lib/imgui.rb', line 5404

def self.SetWindowSize_Vec2(size, cond = 0)
  igSetWindowSize_Vec2(size, cond)
end

.Shortcut(key_chord, flags = 0) ⇒ Object

arg: key_chord(ImGuiKeyChord), flags(ImGuiInputFlags) ret: bool

Inputs Utilities: Shortcut Testing & Routing [BETA]

  • ImGuiKeyChord = a ImGuiKey + optional ImGuiMod_Alt/ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Super.

    ImGuiKey_C                          // Accepted by functions taking ImGuiKey or ImGuiKeyChord arguments)
    ImGuiMod_Ctrl | ImGuiKey_C          // Accepted by functions taking ImGuiKeyChord arguments)
    

    only ImGuiMod_XXX values are legal to combine with an ImGuiKey. You CANNOT combine two ImGuiKey values.

  • The general idea is that several callers may register interest in a shortcut, and only one owner gets it.

    Parent   -> call Shortcut(Ctrl+S)    // When Parent is focused, Parent gets the shortcut.
      Child1 -> call Shortcut(Ctrl+S)    // When Child1 is focused, Child1 gets the shortcut (Child1 overrides Parent shortcuts)
      Child2 -> no call                  // When Child2 is focused, Parent gets the shortcut.
    

    The whole system is order independent, so if Child1 makes its calls before Parent, results will be identical. This is an important property as it facilitate working with foreign code or larger codebase.

  • To understand the difference:

    • IsKeyChordPressed() compares mods and call IsKeyPressed() -> function has no side-effect.

    • Shortcut() submits a route, routes are resolved, if it currently can be routed it calls IsKeyChordPressed() -> function has (desirable) side-effects as it can prevents another call from getting the route.

  • Visualize registered routes in ‘Metrics/Debugger->Inputs’.



5432
5433
5434
# File 'lib/imgui.rb', line 5432

def self.Shortcut(key_chord, flags = 0)
  igShortcut(key_chord, flags)
end

.ShowAboutWindow(p_open = nil) ⇒ Object

arg: p_open(bool*) ret: void



5438
5439
5440
# File 'lib/imgui.rb', line 5438

def self.ShowAboutWindow(p_open = nil)  # create About window. display Dear ImGui version, credits and build/system information.
  igShowAboutWindow(p_open)
end

.ShowDebugLogWindow(p_open = nil) ⇒ Object

arg: p_open(bool*) ret: void



5444
5445
5446
# File 'lib/imgui.rb', line 5444

def self.ShowDebugLogWindow(p_open = nil)  # create Debug Log window. display a simplified log of important dear imgui events.
  igShowDebugLogWindow(p_open)
end

.ShowDemoWindow(p_open = nil) ⇒ Object

arg: p_open(bool*) ret: void

Demo, Debug, Information



5452
5453
5454
# File 'lib/imgui.rb', line 5452

def self.ShowDemoWindow(p_open = nil)  # create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
  igShowDemoWindow(p_open)
end

.ShowFontSelector(label) ⇒ Object

arg: label(const char*) ret: void



5458
5459
5460
# File 'lib/imgui.rb', line 5458

def self.ShowFontSelector(label)  # add font selector block (not a window), essentially a combo listing the loaded fonts.
  igShowFontSelector(label)
end

.ShowIDStackToolWindow(p_open = nil) ⇒ Object

arg: p_open(bool*) ret: void



5464
5465
5466
# File 'lib/imgui.rb', line 5464

def self.ShowIDStackToolWindow(p_open = nil)  # Implied p_open = NULL
  igShowIDStackToolWindow(p_open)
end

.ShowMetricsWindow(p_open = nil) ⇒ Object

arg: p_open(bool*) ret: void



5470
5471
5472
# File 'lib/imgui.rb', line 5470

def self.ShowMetricsWindow(p_open = nil)  # create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.
  igShowMetricsWindow(p_open)
end

.ShowStyleEditor(ref = nil) ⇒ Object

arg: ref(ImGuiStyle*) ret: void



5476
5477
5478
# File 'lib/imgui.rb', line 5476

def self.ShowStyleEditor(ref = nil)  # add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
  igShowStyleEditor(ref)
end

.ShowStyleSelector(label) ⇒ Object

arg: label(const char*) ret: bool



5482
5483
5484
# File 'lib/imgui.rb', line 5482

def self.ShowStyleSelector(label)  # add style selector block (not a window), essentially a combo listing the default styles.
  igShowStyleSelector(label)
end

.ShowUserGuideObject

ret: void



5487
5488
5489
# File 'lib/imgui.rb', line 5487

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

.SliderAngle(label, v_rad, v_degrees_min = -360.0,, v_degrees_max = +360.0, format = "%.0f deg", flags = 0) ⇒ Object

arg: label(const char*), v_rad(float*), v_degrees_min(float), v_degrees_max(float), format(const char*), flags(ImGuiSliderFlags) ret: bool



5493
5494
5495
# File 'lib/imgui.rb', line 5493

def self.SliderAngle(label, v_rad, v_degrees_min = -360.0, v_degrees_max = +360.0, format = "%.0f deg", flags = 0)  # Implied v_degrees_min = -360.0f, v_degrees_max = +360.0f, format = "%.0f deg", flags = 0
  igSliderAngle(label, v_rad, v_degrees_min, v_degrees_max, format, flags)
end

.SliderFloat(label, v, v_min, v_max, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float*), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) ret: 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 take a final ‘float power=1.0f’ argument instead of the ‘ImGuiSliderFlags flags=0’ argument. If you get a warning converting a float to ImGuiSliderFlags, read github.com/ocornut/imgui/issues/3361



5506
5507
5508
# File 'lib/imgui.rb', line 5506

def self.SliderFloat(label, v, v_min, v_max, format = "%.3f", flags = 0)  # Implied format = "%.3f", flags = 0
  igSliderFloat(label, v, v_min, v_max, format, flags)
end

.SliderFloat2(label, v, v_min, v_max, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) ret: bool



5512
5513
5514
# File 'lib/imgui.rb', line 5512

def self.SliderFloat2(label, v, v_min, v_max, format = "%.3f", flags = 0)  # Implied format = "%.3f", flags = 0
  igSliderFloat2(label, v, v_min, v_max, format, flags)
end

.SliderFloat3(label, v, v_min, v_max, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) ret: bool



5518
5519
5520
# File 'lib/imgui.rb', line 5518

def self.SliderFloat3(label, v, v_min, v_max, format = "%.3f", flags = 0)  # Implied format = "%.3f", flags = 0
  igSliderFloat3(label, v, v_min, v_max, format, flags)
end

.SliderFloat4(label, v, v_min, v_max, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), v(float), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) ret: bool



5524
5525
5526
# File 'lib/imgui.rb', line 5524

def self.SliderFloat4(label, v, v_min, v_max, format = "%.3f", flags = 0)  # Implied format = "%.3f", flags = 0
  igSliderFloat4(label, v, v_min, v_max, format, flags)
end

.SliderInt(label, v, v_min, v_max, format = "%d", flags = 0) ⇒ Object

arg: label(const char*), v(int*), v_min(int), v_max(int), format(const char*), flags(ImGuiSliderFlags) ret: bool



5530
5531
5532
# File 'lib/imgui.rb', line 5530

def self.SliderInt(label, v, v_min, v_max, format = "%d", flags = 0)  # Implied format = "%d", flags = 0
  igSliderInt(label, v, v_min, v_max, format, flags)
end

.SliderInt2(label, v, v_min, v_max, format = "%d", flags = 0) ⇒ Object

arg: label(const char*), v(int), v_min(int), v_max(int), format(const char*), flags(ImGuiSliderFlags) ret: bool



5536
5537
5538
# File 'lib/imgui.rb', line 5536

def self.SliderInt2(label, v, v_min, v_max, format = "%d", flags = 0)  # Implied format = "%d", flags = 0
  igSliderInt2(label, v, v_min, v_max, format, flags)
end

.SliderInt3(label, v, v_min, v_max, format = "%d", flags = 0) ⇒ Object

arg: label(const char*), v(int), v_min(int), v_max(int), format(const char*), flags(ImGuiSliderFlags) ret: bool



5542
5543
5544
# File 'lib/imgui.rb', line 5542

def self.SliderInt3(label, v, v_min, v_max, format = "%d", flags = 0)  # Implied format = "%d", flags = 0
  igSliderInt3(label, v, v_min, v_max, format, flags)
end

.SliderInt4(label, v, v_min, v_max, format = "%d", flags = 0) ⇒ Object

arg: label(const char*), v(int), v_min(int), v_max(int), format(const char*), flags(ImGuiSliderFlags) ret: bool



5548
5549
5550
# File 'lib/imgui.rb', line 5548

def self.SliderInt4(label, v, v_min, v_max, format = "%d", flags = 0)  # Implied format = "%d", flags = 0
  igSliderInt4(label, v, v_min, v_max, format, flags)
end

.SliderScalar(label, data_type, p_data, p_min, p_max, format = nil, flags = 0) ⇒ Object

arg: label(const char*), data_type(ImGuiDataType), p_data(void*), p_min(const void*), p_max(const void*), format(const char*), flags(ImGuiSliderFlags) ret: bool



5554
5555
5556
# File 'lib/imgui.rb', line 5554

def self.SliderScalar(label, data_type, p_data, p_min, p_max, format = nil, flags = 0)  # Implied format = NULL, flags = 0
  igSliderScalar(label, data_type, p_data, p_min, p_max, format, flags)
end

.SliderScalarN(label, data_type, p_data, components, p_min, p_max, format = nil, flags = 0) ⇒ Object

arg: label(const char*), data_type(ImGuiDataType), p_data(void*), components(int), p_min(const void*), p_max(const void*), format(const char*), flags(ImGuiSliderFlags) ret: bool



5560
5561
5562
# File 'lib/imgui.rb', line 5560

def self.SliderScalarN(label, data_type, p_data, components, p_min, p_max, format = nil, flags = 0)  # Implied format = NULL, flags = 0
  igSliderScalarN(label, data_type, p_data, components, p_min, p_max, format, flags)
end

.SmallButton(label) ⇒ Object

arg: label(const char*) ret: bool



5566
5567
5568
# File 'lib/imgui.rb', line 5566

def self.SmallButton(label)  # button with (FramePadding.y == 0) to easily embed within text
  igSmallButton(label)
end

.SpacingObject

ret: void



5571
5572
5573
# File 'lib/imgui.rb', line 5571

def self.Spacing()  # add vertical spacing.
  igSpacing()
end

.StyleColorsClassic(dst = nil) ⇒ Object

arg: dst(ImGuiStyle*) ret: void



5577
5578
5579
# File 'lib/imgui.rb', line 5577

def self.StyleColorsClassic(dst = nil)  # classic imgui style
  igStyleColorsClassic(dst)
end

.StyleColorsDark(dst = nil) ⇒ Object

arg: dst(ImGuiStyle*) ret: void

Styles



5585
5586
5587
# File 'lib/imgui.rb', line 5585

def self.StyleColorsDark(dst = nil)  # new, recommended style (default)
  igStyleColorsDark(dst)
end

.StyleColorsLight(dst = nil) ⇒ Object

arg: dst(ImGuiStyle*) ret: void



5591
5592
5593
# File 'lib/imgui.rb', line 5591

def self.StyleColorsLight(dst = nil)  # best used with borders and a custom, thicker font
  igStyleColorsLight(dst)
end

.TabItemButton(label, flags = 0) ⇒ Object

arg: label(const char*), flags(ImGuiTabItemFlags) ret: bool



5597
5598
5599
# File 'lib/imgui.rb', line 5597

def self.TabItemButton(label, flags = 0)  # create a Tab behaving like a button. return true when clicked. cannot be selected in the tab bar.
  igTabItemButton(label, flags)
end

.TableAngledHeadersRowObject

ret: void



5602
5603
5604
# File 'lib/imgui.rb', line 5602

def self.TableAngledHeadersRow()  # submit a row with angled headers for every column with the ImGuiTableColumnFlags_AngledHeader flag. MUST BE FIRST ROW.
  igTableAngledHeadersRow()
end

.TableGetColumnCountObject

ret: int



5607
5608
5609
# File 'lib/imgui.rb', line 5607

def self.TableGetColumnCount()  # return number of columns (value passed to BeginTable)
  igTableGetColumnCount()
end

.TableGetColumnFlags(column_n = -1)) ⇒ Object

arg: column_n(int) ret: int



5613
5614
5615
# File 'lib/imgui.rb', line 5613

def self.TableGetColumnFlags(column_n = -1)  # return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column.
  igTableGetColumnFlags(column_n)
end

.TableGetColumnIndexObject

ret: int



5618
5619
5620
# File 'lib/imgui.rb', line 5618

def self.TableGetColumnIndex()  # return current column index.
  igTableGetColumnIndex()
end

.TableGetColumnName(column_n = -1)) ⇒ Object

arg: column_n(int) ret: pointer



5624
5625
5626
# File 'lib/imgui.rb', line 5624

def self.TableGetColumnName(column_n = -1)  # return "" if column didn't have a name declared by TableSetupColumn(). Pass -1 to use current column.
  igTableGetColumnName(column_n)
end

.TableGetHoveredColumnObject

ret: int



5629
5630
5631
# File 'lib/imgui.rb', line 5629

def self.TableGetHoveredColumn()  # return hovered column. return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered. Can also use (TableGetColumnFlags() & ImGuiTableColumnFlags_IsHovered) instead.
  igTableGetHoveredColumn()
end

.TableGetRowIndexObject

ret: int



5634
5635
5636
# File 'lib/imgui.rb', line 5634

def self.TableGetRowIndex()  # return current row index.
  igTableGetRowIndex()
end

.TableGetSortSpecsObject

ret: pointer

Tables: Sorting & Miscellaneous functions

  • Sorting: call TableGetSortSpecs() 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.



5646
5647
5648
# File 'lib/imgui.rb', line 5646

def self.TableGetSortSpecs()  # 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 BeginTable().
  igTableGetSortSpecs()
end

.TableHeader(label) ⇒ Object

arg: label(const char*) ret: void



5652
5653
5654
# File 'lib/imgui.rb', line 5652

def self.TableHeader(label)  # submit one header cell manually (rarely used)
  igTableHeader(label)
end

.TableHeadersRowObject

ret: void



5657
5658
5659
# File 'lib/imgui.rb', line 5657

def self.TableHeadersRow()  # submit a row with headers cells based on data provided to TableSetupColumn() + submit context menu
  igTableHeadersRow()
end

.TableNextColumnObject

ret: bool



5662
5663
5664
# File 'lib/imgui.rb', line 5662

def self.TableNextColumn()  # append into the next column (or first column of next row if currently in last column). Return true when column is visible.
  igTableNextColumn()
end

.TableNextRow(row_flags = 0, min_row_height = 0.0) ⇒ Object

arg: row_flags(ImGuiTableRowFlags), min_row_height(float) ret: void



5668
5669
5670
# File 'lib/imgui.rb', line 5668

def self.TableNextRow(row_flags = 0, min_row_height = 0.0)  # Implied row_flags = 0, min_row_height = 0.0f
  igTableNextRow(row_flags, min_row_height)
end

.TableSetBgColor(target, color, column_n = -1)) ⇒ Object

arg: target(ImGuiTableBgTarget), color(ImU32), column_n(int) ret: void



5674
5675
5676
# File 'lib/imgui.rb', line 5674

def self.TableSetBgColor(target, color, column_n = -1)  # change the color of a cell, row, or column. See ImGuiTableBgTarget_ flags for details.
  igTableSetBgColor(target, color, column_n)
end

.TableSetColumnEnabled(column_n, v) ⇒ Object

arg: column_n(int), v(bool) ret: void



5680
5681
5682
# File 'lib/imgui.rb', line 5680

def self.TableSetColumnEnabled(column_n, v)  # change user accessible enabled/disabled state of a column. Set to false to hide the column. User can use the context menu to change this themselves (right-click in headers, or right-click in columns body with ImGuiTableFlags_ContextMenuInBody)
  igTableSetColumnEnabled(column_n, v)
end

.TableSetColumnIndex(column_n) ⇒ Object

arg: column_n(int) ret: bool



5686
5687
5688
# File 'lib/imgui.rb', line 5686

def self.TableSetColumnIndex(column_n)  # append into the specified column. Return true when column is visible.
  igTableSetColumnIndex(column_n)
end

.TableSetupColumn(label, flags = 0, init_width_or_weight = 0.0, user_id = 0) ⇒ Object

arg: label(const char*), flags(ImGuiTableColumnFlags), init_width_or_weight(float), user_id(ImGuiID) ret: void

Tables: Headers & Columns declaration

  • Use TableSetupColumn() to specify label, resizing policy, default width/weight, id, various other flags etc.

  • Use TableHeadersRow() to create a header row and automatically submit a TableHeader() 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 TableNextRow() + TableHeader() calls, but this is only useful in some advanced use cases (e.g. adding custom widgets in header row).

  • Use TableSetupScrollFreeze() to lock columns/rows so they stay visible when scrolled.



5701
5702
5703
# File 'lib/imgui.rb', line 5701

def self.TableSetupColumn(label, flags = 0, init_width_or_weight = 0.0, user_id = 0)  # Implied init_width_or_weight = 0.0f, user_id = 0
  igTableSetupColumn(label, flags, init_width_or_weight, user_id)
end

.TableSetupScrollFreeze(cols, rows) ⇒ Object

arg: cols(int), rows(int) ret: void



5707
5708
5709
# File 'lib/imgui.rb', line 5707

def self.TableSetupScrollFreeze(cols, rows)  # lock columns/rows so they stay visible when scrolled.
  igTableSetupScrollFreeze(cols, rows)
end

.Text(fmt, *varargs) ⇒ Object

arg: fmt(const char*), …(…) ret: void



5713
5714
5715
# File 'lib/imgui.rb', line 5713

def self.Text(fmt, *varargs)  # formatted text
  igText(fmt, *varargs)
end

.TextColored(col, fmt, *varargs) ⇒ Object

arg: col(ImVec4), fmt(const char*), …(…) ret: void



5719
5720
5721
# File 'lib/imgui.rb', line 5719

def self.TextColored(col, fmt, *varargs)  # shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();
  igTextColored(col, fmt, *varargs)
end

.TextDisabled(fmt, *varargs) ⇒ Object

arg: fmt(const char*), …(…) ret: void



5725
5726
5727
# File 'lib/imgui.rb', line 5725

def self.TextDisabled(fmt, *varargs)  # shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor();
  igTextDisabled(fmt, *varargs)
end

arg: label(const char*) ret: bool



5731
5732
5733
# File 'lib/imgui.rb', line 5731

def self.TextLink(label)  # hyperlink text button, return true when clicked
  igTextLink(label)
end

.TextLinkOpenURL(label, url = nil) ⇒ Object

arg: label(const char*), url(const char*) ret: void



5737
5738
5739
# File 'lib/imgui.rb', line 5737

def self.TextLinkOpenURL(label, url = nil)  # Implied url = NULL
  igTextLinkOpenURL(label, url)
end

.TextUnformatted(text, text_end = nil) ⇒ Object

arg: text(const char*), text_end(const char*) ret: void

Widgets: Text



5745
5746
5747
# File 'lib/imgui.rb', line 5745

def self.TextUnformatted(text, text_end = nil)  # Implied text_end = NULL
  igTextUnformatted(text, text_end)
end

.TextWrapped(fmt, *varargs) ⇒ Object

arg: fmt(const char*), …(…) ret: void



5751
5752
5753
# File 'lib/imgui.rb', line 5751

def self.TextWrapped(fmt, *varargs)  # shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();. 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 SetNextWindowSize().
  igTextWrapped(fmt, *varargs)
end

.TreeNode(*arg) ⇒ Object

Widgets: Trees

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



6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
# File 'lib/imgui.rb', line 6136

def self.TreeNode(*arg)
  # arg: 0:label(const char*)
  # ret: bool
  return igTreeNode_Str(arg[0]) if arg.length == 1 && (arg[0].kind_of?(String))
  # arg: 0:str_id(const char*), 1:fmt(const char*), 2:...(...)
  # ret: bool
  return igTreeNode_StrStr(arg[0], arg[1], arg[2..]) if arg.length >= 2 && (arg[0].kind_of?(String) && arg[1].kind_of?(String))
  # arg: 0:ptr_id(const void*), 1:fmt(const char*), 2:...(...)
  # ret: bool
  return igTreeNode_Ptr(arg[0], arg[1], arg[2..]) if arg.length >= 2 && (arg[0].kind_of?(FFI::Pointer) && arg[1].kind_of?(String))
  $stderr.puts("[Warning] TreeNode : No matching functions found (#{arg})")
end

.TreeNode_Ptr(ptr_id, fmt, *varargs) ⇒ Object

arg: ptr_id(const void*), fmt(const char*), …(…) ret: bool



5769
5770
5771
# File 'lib/imgui.rb', line 5769

def self.TreeNode_Ptr(ptr_id, fmt, *varargs)
  igTreeNode_Ptr(ptr_id, fmt, *varargs)
end

.TreeNode_Str(label) ⇒ Object

arg: label(const char*) ret: bool



5757
5758
5759
# File 'lib/imgui.rb', line 5757

def self.TreeNode_Str(label)
  igTreeNode_Str(label)
end

.TreeNode_StrStr(str_id, fmt, *varargs) ⇒ Object

arg: str_id(const char*), fmt(const char*), …(…) ret: bool



5763
5764
5765
# File 'lib/imgui.rb', line 5763

def self.TreeNode_StrStr(str_id, fmt, *varargs)
  igTreeNode_StrStr(str_id, fmt, *varargs)
end

.TreeNodeEx(*arg) ⇒ Object



6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
# File 'lib/imgui.rb', line 6149

def self.TreeNodeEx(*arg)
  # arg: 0:label(const char*), 1:flags(ImGuiTreeNodeFlags)
  # ret: bool
  return igTreeNodeEx_Str(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(String) && arg[1].kind_of?(Integer))
  # arg: 0:str_id(const char*), 1:flags(ImGuiTreeNodeFlags), 2:fmt(const char*), 3:...(...)
  # ret: bool
  return igTreeNodeEx_StrStr(arg[0], arg[1], arg[2], arg[3..]) if arg.length >= 3 && (arg[0].kind_of?(String) && arg[1].kind_of?(Integer) && arg[2].kind_of?(String))
  # arg: 0:ptr_id(const void*), 1:flags(ImGuiTreeNodeFlags), 2:fmt(const char*), 3:...(...)
  # ret: bool
  return igTreeNodeEx_Ptr(arg[0], arg[1], arg[2], arg[3..]) if arg.length >= 3 && (arg[0].kind_of?(FFI::Pointer) && arg[1].kind_of?(Integer) && arg[2].kind_of?(String))
  $stderr.puts("[Warning] TreeNodeEx : No matching functions found (#{arg})")
end

.TreeNodeEx_Ptr(ptr_id, flags, fmt, *varargs) ⇒ Object

arg: ptr_id(const void*), flags(ImGuiTreeNodeFlags), fmt(const char*), …(…) ret: bool



5787
5788
5789
# File 'lib/imgui.rb', line 5787

def self.TreeNodeEx_Ptr(ptr_id, flags, fmt, *varargs)
  igTreeNodeEx_Ptr(ptr_id, flags, fmt, *varargs)
end

.TreeNodeEx_Str(label, flags = 0) ⇒ Object

arg: label(const char*), flags(ImGuiTreeNodeFlags) ret: bool



5775
5776
5777
# File 'lib/imgui.rb', line 5775

def self.TreeNodeEx_Str(label, flags = 0)
  igTreeNodeEx_Str(label, flags)
end

.TreeNodeEx_StrStr(str_id, flags, fmt, *varargs) ⇒ Object

arg: str_id(const char*), flags(ImGuiTreeNodeFlags), fmt(const char*), …(…) ret: bool



5781
5782
5783
# File 'lib/imgui.rb', line 5781

def self.TreeNodeEx_StrStr(str_id, flags, fmt, *varargs)
  igTreeNodeEx_StrStr(str_id, flags, fmt, *varargs)
end

.TreePopObject

ret: void



5792
5793
5794
# File 'lib/imgui.rb', line 5792

def self.TreePop()  # ~ Unindent()+PopID()
  igTreePop()
end

.TreePush(*arg) ⇒ Object

~ Indent()+PushID(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired.



6162
6163
6164
6165
6166
6167
6168
6169
6170
# File 'lib/imgui.rb', line 6162

def self.TreePush(*arg)  # ~ Indent()+PushID(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired.
  # arg: 0:str_id(const char*)
  # ret: void
  return igTreePush_Str(arg[0]) if arg.length == 1 && (arg[0].kind_of?(String))
  # arg: 0:ptr_id(const void*)
  # ret: void
  return igTreePush_Ptr(arg[0]) if arg.length == 1 && (arg[0].kind_of?(FFI::Pointer))
  $stderr.puts("[Warning] TreePush : No matching functions found (#{arg})")
end

.TreePush_Ptr(ptr_id) ⇒ Object

arg: ptr_id(const void*) ret: void



5804
5805
5806
# File 'lib/imgui.rb', line 5804

def self.TreePush_Ptr(ptr_id)
  igTreePush_Ptr(ptr_id)
end

.TreePush_Str(str_id) ⇒ Object

arg: str_id(const char*) ret: void



5798
5799
5800
# File 'lib/imgui.rb', line 5798

def self.TreePush_Str(str_id)
  igTreePush_Str(str_id)
end

.Unindent(indent_w = 0.0) ⇒ Object

arg: indent_w(float) ret: void



5810
5811
5812
# File 'lib/imgui.rb', line 5810

def self.Unindent(indent_w = 0.0)  # Implied indent_w = 0.0f
  igUnindent(indent_w)
end

.Value(*arg) ⇒ Object



6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
# File 'lib/imgui.rb', line 6172

def self.Value(*arg)
  # arg: 0:prefix(const char*), 1:b(bool)
  # ret: void
  return igValue_Bool(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(String) && (arg[1].is_a?(TrueClass) || arg[1].is_a?(FalseClass)))
  # arg: 0:prefix(const char*), 1:v(int)
  # ret: void
  return igValue_Int(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(String) && arg[1].kind_of?(Integer))
  # arg: 0:prefix(const char*), 1:v(unsigned int)
  # ret: void
  return igValue_Uint(arg[0], arg[1]) if arg.length == 2 && (arg[0].kind_of?(String) && arg[1].kind_of?(Integer))
  # arg: 0:prefix(const char*), 1:v(float), 2:float_format(const char*)
  # ret: void
  return igValue_Float(arg[0], arg[1], arg[2]) if arg.length == 3 && (arg[0].kind_of?(String) && arg[1].kind_of?(Float) && arg[2].kind_of?(String))
  $stderr.puts("[Warning] Value : No matching functions found (#{arg})")
end

.Value_Bool(prefix, b) ⇒ Object

arg: prefix(const char*), b(bool) ret: void



5834
5835
5836
# File 'lib/imgui.rb', line 5834

def self.Value_Bool(prefix, b)
  igValue_Bool(prefix, b)
end

.Value_Float(prefix, v, float_format = nil) ⇒ Object

arg: prefix(const char*), v(float), float_format(const char*) ret: void



5852
5853
5854
# File 'lib/imgui.rb', line 5852

def self.Value_Float(prefix, v, float_format = nil)
  igValue_Float(prefix, v, float_format)
end

.Value_Int(prefix, v) ⇒ Object

arg: prefix(const char*), v(int) ret: void



5840
5841
5842
# File 'lib/imgui.rb', line 5840

def self.Value_Int(prefix, v)
  igValue_Int(prefix, v)
end

.Value_Uint(prefix, v) ⇒ Object

arg: prefix(const char*), v(unsigned int) ret: void



5846
5847
5848
# File 'lib/imgui.rb', line 5846

def self.Value_Uint(prefix, v)
  igValue_Uint(prefix, v)
end

.VSliderFloat(label, size, v, v_min, v_max, format = "%.3f", flags = 0) ⇒ Object

arg: label(const char*), size(ImVec2), v(float*), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) ret: bool



5816
5817
5818
# File 'lib/imgui.rb', line 5816

def self.VSliderFloat(label, size, v, v_min, v_max, format = "%.3f", flags = 0)  # Implied format = "%.3f", flags = 0
  igVSliderFloat(label, size, v, v_min, v_max, format, flags)
end

.VSliderInt(label, size, v, v_min, v_max, format = "%d", flags = 0) ⇒ Object

arg: label(const char*), size(ImVec2), v(int*), v_min(int), v_max(int), format(const char*), flags(ImGuiSliderFlags) ret: bool



5822
5823
5824
# File 'lib/imgui.rb', line 5822

def self.VSliderInt(label, size, v, v_min, v_max, format = "%d", flags = 0)  # Implied format = "%d", flags = 0
  igVSliderInt(label, size, v, v_min, v_max, format, flags)
end

.VSliderScalar(label, size, data_type, p_data, p_min, p_max, format = nil, flags = 0) ⇒ Object

arg: label(const char*), size(ImVec2), data_type(ImGuiDataType), p_data(void*), p_min(const void*), p_max(const void*), format(const char*), flags(ImGuiSliderFlags) ret: bool



5828
5829
5830
# File 'lib/imgui.rb', line 5828

def self.VSliderScalar(label, size, data_type, p_data, p_min, p_max, format = nil, flags = 0)  # Implied format = NULL, flags = 0
  igVSliderScalar(label, size, data_type, p_data, p_min, p_max, format, flags)
end