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



3109
3110
3111
# File 'lib/imgui.rb', line 3109

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



3114
3115
3116
# File 'lib/imgui.rb', line 3114

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



3120
3121
3122
# File 'lib/imgui.rb', line 3120

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”.



3139
3140
3141
# File 'lib/imgui.rb', line 3139

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_Border == 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_Border);
    
  • 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.]
    


5516
5517
5518
5519
5520
5521
5522
5523
5524
# File 'lib/imgui.rb', line 5516

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



3151
3152
3153
# File 'lib/imgui.rb', line 3151

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



3145
3146
3147
# File 'lib/imgui.rb', line 3145

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.



3161
3162
3163
# File 'lib/imgui.rb', line 3161

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)

  • 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.



3172
3173
3174
# File 'lib/imgui.rb', line 3172

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.



3184
3185
3186
# File 'lib/imgui.rb', line 3184

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



3189
3190
3191
# File 'lib/imgui.rb', line 3189

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



3194
3195
3196
# File 'lib/imgui.rb', line 3194

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’.



3204
3205
3206
# File 'lib/imgui.rb', line 3204

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



3217
3218
3219
# File 'lib/imgui.rb', line 3217

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

.BeginMainMenuBarObject

ret: bool



3222
3223
3224
# File 'lib/imgui.rb', line 3222

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



3228
3229
3230
# File 'lib/imgui.rb', line 3228

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.



3239
3240
3241
# File 'lib/imgui.rb', line 3239

def self.BeginMenuBar()  # append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window).
  igBeginMenuBar()
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.


3256
3257
3258
# File 'lib/imgui.rb', line 3256

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.


3268
3269
3270
# File 'lib/imgui.rb', line 3268

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



3274
3275
3276
# File 'lib/imgui.rb', line 3274

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



3280
3281
3282
# File 'lib/imgui.rb', line 3280

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



3286
3287
3288
# File 'lib/imgui.rb', line 3286

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.



3295
3296
3297
# File 'lib/imgui.rb', line 3295

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



3301
3302
3303
# File 'lib/imgui.rb', line 3301

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, column, flags = 0, outer_size = ImVec2.create(0.0,0.0), inner_width = 0.0) ⇒ Object

arg: str_id(const char*), column(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()



3329
3330
3331
# File 'lib/imgui.rb', line 3329

def self.BeginTable(str_id, column, 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, column, 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 a shortcut for the ‘if (BeginTooltip()) { Text(…); EndTooltip(); }’ idiom.



3338
3339
3340
# File 'lib/imgui.rb', line 3338

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

.BulletObject

ret: void



3343
3344
3345
# File 'lib/imgui.rb', line 3343

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



3349
3350
3351
# File 'lib/imgui.rb', line 3349

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.



3359
3360
3361
# File 'lib/imgui.rb', line 3359

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

.CalcItemWidthObject

ret: float



3364
3365
3366
# File 'lib/imgui.rb', line 3364

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



3372
3373
3374
3375
3376
# File 'lib/imgui.rb', line 3372

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



3380
3381
3382
# File 'lib/imgui.rb', line 3380

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

.CheckboxFlags(*arg) ⇒ Object



5526
5527
5528
5529
5530
5531
5532
5533
5534
# File 'lib/imgui.rb', line 5526

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



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

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



3392
3393
3394
# File 'lib/imgui.rb', line 3392

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

.CloseCurrentPopupObject

ret: void



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

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().



5536
5537
5538
5539
5540
5541
5542
5543
5544
# File 'lib/imgui.rb', line 5536

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



3409
3410
3411
# File 'lib/imgui.rb', line 3409

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



3403
3404
3405
# File 'lib/imgui.rb', line 3403

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



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

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



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

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



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

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



3433
3434
3435
# File 'lib/imgui.rb', line 3433

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



3441
3442
3443
3444
3445
# File 'lib/imgui.rb', line 3441

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



3453
3454
3455
# File 'lib/imgui.rb', line 3453

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



3459
3460
3461
# File 'lib/imgui.rb', line 3459

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



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

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



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

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

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

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

Legacy Columns API (prefer using Tables!)

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



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

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

.Combo(*arg) ⇒ Object

Implied popup_max_height_in_items = -1



5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
# File 'lib/imgui.rb', line 5546

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



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

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



3492
3493
3494
# File 'lib/imgui.rb', line 3492

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



3486
3487
3488
# File 'lib/imgui.rb', line 3486

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.



3509
3510
3511
# File 'lib/imgui.rb', line 3509

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



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

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



3521
3522
3523
# File 'lib/imgui.rb', line 3521

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

.DebugStartItemPickerObject

ret: void



3526
3527
3528
# File 'lib/imgui.rb', line 3526

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



3535
3536
3537
# File 'lib/imgui.rb', line 3535

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

.DestroyContext(ctx = nil) ⇒ Object

arg: ctx(ImGuiContext*) ret: void



3541
3542
3543
# File 'lib/imgui.rb', line 3541

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



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

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



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

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



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

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



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

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



3584
3585
3586
# File 'lib/imgui.rb', line 3584

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



3590
3591
3592
# File 'lib/imgui.rb', line 3590

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



3596
3597
3598
# File 'lib/imgui.rb', line 3596

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



3602
3603
3604
# File 'lib/imgui.rb', line 3602

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



3608
3609
3610
# File 'lib/imgui.rb', line 3608

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



3614
3615
3616
# File 'lib/imgui.rb', line 3614

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



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

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



3626
3627
3628
# File 'lib/imgui.rb', line 3626

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



3632
3633
3634
# File 'lib/imgui.rb', line 3632

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



3637
3638
3639
# File 'lib/imgui.rb', line 3637

def self.End()
  igEnd()
end

.EndChildObject

ret: void



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

def self.EndChild()
  igEndChild()
end

.EndComboObject

ret: void



3647
3648
3649
# File 'lib/imgui.rb', line 3647

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

.EndDisabledObject

ret: void



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

def self.EndDisabled()
  igEndDisabled()
end

.EndDragDropSourceObject

ret: void



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

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

.EndDragDropTargetObject

ret: void



3662
3663
3664
# File 'lib/imgui.rb', line 3662

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

.EndFrameObject

ret: void



3667
3668
3669
# File 'lib/imgui.rb', line 3667

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



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

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



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

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

.EndMainMenuBarObject

ret: void



3682
3683
3684
# File 'lib/imgui.rb', line 3682

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

.EndMenuObject

ret: void



3687
3688
3689
# File 'lib/imgui.rb', line 3687

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

.EndMenuBarObject

ret: void



3692
3693
3694
# File 'lib/imgui.rb', line 3692

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

.EndPopupObject

ret: void



3697
3698
3699
# File 'lib/imgui.rb', line 3697

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

.EndTabBarObject

ret: void



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

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

.EndTabItemObject

ret: void



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

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

.EndTableObject

ret: void



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

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

.EndTooltipObject

ret: void



3717
3718
3719
# File 'lib/imgui.rb', line 3717

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



3723
3724
3725
# File 'lib/imgui.rb', line 3723

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



3730
3731
3732
# File 'lib/imgui.rb', line 3730

def self.GetBackgroundDrawList()  # this draw list will be the first rendered one. Useful to quickly draw shapes/text behind dear imgui contents.
  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.



3738
3739
3740
# File 'lib/imgui.rb', line 3738

def self.GetClipboardText()
  igGetClipboardText()
end

.GetColorU32(*arg) ⇒ Object

Implied alpha_mul = 1.0f



5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
# File 'lib/imgui.rb', line 5559

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



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

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



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

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

.GetColorU32_Vec4(col) ⇒ Object

arg: col(ImVec4) ret: uint



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

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

.GetColumnIndexObject

ret: int



3761
3762
3763
# File 'lib/imgui.rb', line 3761

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

.GetColumnOffset(column_index = -1)) ⇒ Object

arg: column_index(int) ret: float



3767
3768
3769
# File 'lib/imgui.rb', line 3767

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



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

def self.GetColumnsCount()
  igGetColumnsCount()
end

.GetColumnWidth(column_index = -1)) ⇒ Object

arg: column_index(int) ret: float



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

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

.GetContentRegionAvailObject

ret: void

Content region

  • Retrieve available space from a given point. GetContentRegionAvail() is frequently useful.

  • Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)



3787
3788
3789
3790
3791
# File 'lib/imgui.rb', line 3787

def self.GetContentRegionAvail()  # == GetContentRegionMax() - GetCursorPos()
  pOut = ImVec2.new
  igGetContentRegionAvail(pOut)
  return pOut
end

.GetContentRegionMaxObject

ret: void



3794
3795
3796
3797
3798
# File 'lib/imgui.rb', line 3794

def self.GetContentRegionMax()  # current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
  pOut = ImVec2.new
  igGetContentRegionMax(pOut)
  return pOut
end

.GetCurrentContextObject

ret: pointer



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

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



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

def self.GetCursorPos()  # [window-local] cursor position in window coordinates (relative to window position)
  pOut = ImVec2.new
  igGetCursorPos(pOut)
  return pOut
end

.GetCursorPosXObject

ret: float



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

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

.GetCursorPosYObject

ret: float



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

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.

  • 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(), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), GetContentRegionMax(), GetWindowContentRegion*(), PushTextWrapPos()
    
  • GetCursorScreenPos() = GetCursorPos() + GetWindowPos(). GetWindowPos() is almost only ever useful to convert from window-local to absolute coordinates.



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

def self.GetCursorScreenPos()  # cursor position in absolute coordinates (prefer using this, also more useful to work with ImDrawList API).
  pOut = ImVec2.new
  igGetCursorScreenPos(pOut)
  return pOut
end

.GetCursorStartPosObject

ret: void



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

def self.GetCursorStartPos()  # [window-local] initial cursor position, in window coordinates
  pOut = ImVec2.new
  igGetCursorStartPos(pOut)
  return pOut
end

.GetDragDropPayloadObject

ret: pointer



3846
3847
3848
# File 'lib/imgui.rb', line 3846

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



3851
3852
3853
# File 'lib/imgui.rb', line 3851

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



3856
3857
3858
# File 'lib/imgui.rb', line 3856

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.



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

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

.GetFontSizeObject

ret: float



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

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

.GetFontTexUvWhitePixelObject

ret: void



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

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

.GetForegroundDrawListObject

ret: pointer



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

def self.GetForegroundDrawList()  # this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents.
  igGetForegroundDrawList()
end

.GetFrameCountObject

ret: int



3886
3887
3888
# File 'lib/imgui.rb', line 3886

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

.GetFrameHeightObject

ret: float



3891
3892
3893
# File 'lib/imgui.rb', line 3891

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

.GetFrameHeightWithSpacingObject

ret: float



3896
3897
3898
# File 'lib/imgui.rb', line 3896

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



5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
# File 'lib/imgui.rb', line 5572

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))
  $stderr.puts("[Warning] GetID : No matching functions found (#{arg})")
end

.GetID_Ptr(ptr_id) ⇒ Object

arg: ptr_id(const void*) ret: uint



3914
3915
3916
# File 'lib/imgui.rb', line 3914

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

.GetID_Str(str_id) ⇒ Object

arg: str_id(const char*) ret: uint



3902
3903
3904
# File 'lib/imgui.rb', line 3902

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



3908
3909
3910
# File 'lib/imgui.rb', line 3908

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

.GetIOObject

ret: pointer

Main



3921
3922
3923
# File 'lib/imgui.rb', line 3921

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

.GetItemIDObject

ret: uint



3926
3927
3928
# File 'lib/imgui.rb', line 3926

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

.GetItemRectMaxObject

ret: void



3931
3932
3933
3934
3935
# File 'lib/imgui.rb', line 3931

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



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

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



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

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

.GetKeyIndex(key) ⇒ Object

arg: key(ImGuiKey) ret: int



3953
3954
3955
# File 'lib/imgui.rb', line 3953

def self.GetKeyIndex(key)
  igGetKeyIndex(key)
end

.GetKeyName(key) ⇒ Object

arg: key(ImGuiKey) ret: pointer



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

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



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

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.



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

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

.GetMouseClickedCount(button) ⇒ Object

arg: button(ImGuiMouseButton) ret: int



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

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



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

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



3992
3993
3994
3995
3996
# File 'lib/imgui.rb', line 3992

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

.GetMousePosObject

ret: void



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

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



4006
4007
4008
4009
4010
# File 'lib/imgui.rb', line 4006

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

.GetScrollMaxXObject

ret: float



4013
4014
4015
# File 'lib/imgui.rb', line 4013

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

.GetScrollMaxYObject

ret: float



4018
4019
4020
# File 'lib/imgui.rb', line 4018

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().



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

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

.GetScrollYObject

ret: float



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

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

.GetStateStorageObject

ret: pointer



4037
4038
4039
# File 'lib/imgui.rb', line 4037

def self.GetStateStorage()
  igGetStateStorage()
end

.GetStyleObject

ret: pointer



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

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



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

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



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

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



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

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

.GetTextLineHeightWithSpacingObject

ret: float



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

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

.GetTimeObject

ret: double



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

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

.GetTreeNodeToLabelSpacingObject

ret: float



4074
4075
4076
# File 'lib/imgui.rb', line 4074

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



4079
4080
4081
# File 'lib/imgui.rb', line 4079

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

.GetWindowContentRegionMaxObject

ret: void



4084
4085
4086
4087
4088
# File 'lib/imgui.rb', line 4084

def self.GetWindowContentRegionMax()  # content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be overridden with SetNextWindowContentSize(), in window coordinates
  pOut = ImVec2.new
  igGetWindowContentRegionMax(pOut)
  return pOut
end

.GetWindowContentRegionMinObject

ret: void



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

def self.GetWindowContentRegionMin()  # content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates
  pOut = ImVec2.new
  igGetWindowContentRegionMin(pOut)
  return pOut
end

.GetWindowDrawListObject

ret: pointer



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

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

.GetWindowHeightObject

ret: float



4103
4104
4105
# File 'lib/imgui.rb', line 4103

def self.GetWindowHeight()  # get current window height (shortcut for GetWindowSize().y)
  igGetWindowHeight()
end

.GetWindowPosObject

ret: void



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

def self.GetWindowPos()  # get current window position in screen space (note: it is unlikely you need to use this. Consider using current layout pos instead, GetCursorScreenPos())
  pOut = ImVec2.new
  igGetWindowPos(pOut)
  return pOut
end

.GetWindowSizeObject

ret: void



4115
4116
4117
4118
4119
# File 'lib/imgui.rb', line 4115

def self.GetWindowSize()  # get current window size (note: it is unlikely you need to use this. Consider using GetCursorScreenPos() and e.g. GetContentRegionAvail() instead)
  pOut = ImVec2.new
  igGetWindowSize(pOut)
  return pOut
end

.GetWindowWidthObject

ret: float



4122
4123
4124
# File 'lib/imgui.rb', line 4122

def self.GetWindowWidth()  # get current window width (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



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

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



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

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 = "  uniform mat4 ProjMtx;\n  attribute vec2 Position;\n  attribute vec2 UV;\n  attribute vec4 Color;\n  varying vec2 Frag_UV;\n  varying vec4 Frag_Color;\n  void main()\n  {\n      Frag_UV = UV;\n      Frag_Color = Color;\n      gl_Position = ProjMtx * vec4(Position.xy,0,1);\n  }\n  SRC\n\n  vertex_shader_glsl_130 = <<-'SRC'\n  uniform mat4 ProjMtx;\n  in vec2 Position;\n  in vec2 UV;\n  in vec4 Color;\n  out vec2 Frag_UV;\n  out vec4 Frag_Color;\n  void main()\n  {\n      Frag_UV = UV;\n      Frag_Color = Color;\n      gl_Position = ProjMtx * vec4(Position.xy,0,1);\n  }\n  SRC\n\n  vertex_shader_glsl_300_es = <<-'SRC'\n  precision mediump float;\n  layout (location = 0) in vec2 Position;\n  layout (location = 1) in vec2 UV;\n  layout (location = 2) in vec4 Color;\n  uniform mat4 ProjMtx;\n  out vec2 Frag_UV;\n  out vec4 Frag_Color;\n  void main()\n  {\n      Frag_UV = UV;\n      Frag_Color = Color;\n      gl_Position = ProjMtx * vec4(Position.xy,0,1);\n  }\n  SRC\n\n  vertex_shader_glsl_410_core = <<-'SRC'\n  layout (location = 0) in vec2 Position;\n  layout (location = 1) in vec2 UV;\n  layout (location = 2) in vec4 Color;\n  uniform mat4 ProjMtx;\n  out vec2 Frag_UV;\n  out vec4 Frag_Color;\n  void main()\n  {\n      Frag_UV = UV;\n      Frag_Color = Color;\n      gl_Position = ProjMtx * vec4(Position.xy,0,1);\n  }\n  SRC\n\n  fragment_shader_glsl_120 = <<-'SRC'\n  #ifdef GL::ES\n      precision mediump float;\n  #endif\n  uniform sampler2D Texture;\n  varying vec2 Frag_UV;\n  varying vec4 Frag_Color;\n  void main()\n  {\n      gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);\n  }\n  SRC\n\n  fragment_shader_glsl_130 = <<-'SRC'\n  uniform sampler2D Texture;\n  in vec2 Frag_UV;\n  in vec4 Frag_Color;\n  out vec4 Out_Color;\n  void main()\n  {\n      Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n  }\n  SRC\n\n  fragment_shader_glsl_300_es = <<-'SRC'\n  precision mediump float;\n  uniform sampler2D Texture;\n  in vec2 Frag_UV;\n  in vec4 Frag_Color;\n  layout (location = 0) out vec4 Out_Color;\n  void main()\n  {\n      Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n  }\n  SRC\n\n  fragment_shader_glsl_410_core = <<-'SRC'\n  in vec2 Frag_UV;\n  in vec4 Frag_Color;\n  uniform sampler2D Texture;\n  layout (location = 0) out vec4 Out_Color;\n  void main()\n  {\n      Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n  }\n  SRC\n\n  vertex_shader, fragment_shader = if glsl_version < 130\n                                     [vertex_shader_glsl_120, fragment_shader_glsl_120]\n                                   elsif glsl_version >= 410\n                                     [vertex_shader_glsl_410_core, fragment_shader_glsl_410_core]\n                                   elsif glsl_version == 300\n                                     [vertex_shader_glsl_300_es, fragment_shader_glsl_300_es]\n                                   else\n                                     [vertex_shader_glsl_130, fragment_shader_glsl_130]\n                                   end\n\n  vertex_shader.prepend(@@g_GlslVersionString + \"\\n\")\n  vert_handle = GL.CreateShader(GL::VERTEX_SHADER)\n  GL.ShaderSource(vert_handle, 1, [vertex_shader].pack('p'), nil)\n  GL.CompileShader(vert_handle)\n  PrintShaderCompileStatus(vert_handle)\n\n  fragment_shader.prepend(@@g_GlslVersionString + \"\\n\")\n  frag_handle = GL.CreateShader(GL::FRAGMENT_SHADER)\n  GL.ShaderSource(frag_handle, 1, [fragment_shader].pack('p'), [fragment_shader.size].pack('I'))\n  GL.CompileShader(frag_handle)\n  PrintShaderCompileStatus(frag_handle)\n\n  @@g_ShaderHandle = GL.CreateProgram()\n  GL.AttachShader(@@g_ShaderHandle, vert_handle)\n  GL.AttachShader(@@g_ShaderHandle, frag_handle)\n  GL.LinkProgram(@@g_ShaderHandle)\n  PrintProgramLinkStatus(@@g_ShaderHandle)\n\n  GL.DetachShader(@@g_ShaderHandle, vert_handle)\n  GL.DetachShader(@@g_ShaderHandle, frag_handle)\n  GL.DeleteShader(vert_handle)\n  GL.DeleteShader(frag_handle)\n\n  @@g_AttribLocationTex = GL.GetUniformLocation(@@g_ShaderHandle, \"Texture\")\n  @@g_AttribLocationProjMtx = GL.GetUniformLocation(@@g_ShaderHandle, \"ProjMtx\")\n\n  @@g_AttribLocationVtxPos = GL.GetAttribLocation(@@g_ShaderHandle, \"Position\")\n  @@g_AttribLocationVtxUV = GL.GetAttribLocation(@@g_ShaderHandle, \"UV\")\n  @@g_AttribLocationVtxColor = GL.GetAttribLocation(@@g_ShaderHandle, \"Color\")\n\n  # Create buffers\n  posBuf = ' ' * 4\n  GL.GenBuffers(1, posBuf)\n  GL.BindBuffer(GL::ARRAY_BUFFER, posBuf.unpack('L')[0])\n\n  @@g_VboHandle, @@g_ElementsHandle = ' ' * 4, ' ' * 4\n  GL.GenBuffers(1, @@g_VboHandle)\n  GL.GenBuffers(1, @@g_ElementsHandle)\n  @@g_VboHandle = @@g_VboHandle.unpack1('L')\n  @@g_ElementsHandle = @@g_ElementsHandle.unpack1('L')\n\n  ImplOpenGL3_CreateFontsTexture()\n\n  # Restore modified GL state\n  GL.BindTexture(GL::TEXTURE_2D, last_texture)\n  GL.BindBuffer(GL::ARRAY_BUFFER, last_array_buffer)\n  GL.BindVertexArray(last_vertex_array)\n\n  return true\nend\n"

.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



2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
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
# File 'lib/imgui.rb', line 2477

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_AddConvexPolyFilled, [:pointer, :pointer, :int, :uint], :void],
  [:ImDrawList_AddDrawCmd, [:pointer], :void],
  [:ImDrawList_AddEllipse, [:pointer, ImVec2.by_value, :float, :float, :uint, :float, :int, :float], :void],
  [:ImDrawList_AddEllipseFilled, [:pointer, ImVec2.by_value, :float, :float, :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, :float, :float, :float, :float, :float, :int], :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__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_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_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],
  [:ImGuiPlatformImeData_ImGuiPlatformImeData, [], :pointer],
  [:ImGuiPlatformImeData_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],
  [: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],
  [: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],
  [: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],
  [:igGetContentRegionMax, [: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],
  [:igGetIO, [], :pointer],
  [:igGetItemID, [], :uint],
  [:igGetItemRectMax, [:pointer], :void],
  [:igGetItemRectMin, [:pointer], :void],
  [:igGetItemRectSize, [:pointer], :void],
  [:igGetKeyIndex, [:int], :int],
  [: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],
  [: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],
  [:igGetWindowContentRegionMax, [:pointer], :void],
  [:igGetWindowContentRegionMin, [:pointer], :void],
  [: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],
  [: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],
  [:igPopButtonRepeat, [], :void],
  [:igPopClipRect, [], :void],
  [:igPopFont, [], :void],
  [:igPopID, [], :void],
  [:igPopItemWidth, [], :void],
  [:igPopStyleColor, [:int], :void],
  [:igPopStyleVar, [:int], :void],
  [:igPopTabStop, [], :void],
  [:igPopTextWrapPos, [], :void],
  [:igProgressBar, [:float, ImVec2.by_value, :pointer], :void],
  [:igPushButtonRepeat, [:bool], :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],
  [: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],
  [:igPushTabStop, [:bool], :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],
  [:igSetItemTooltip, [:pointer, :varargs], :void],
  [:igSetKeyboardFocusHere, [:int], :void],
  [:igSetMouseCursor, [:int], :void],
  [:igSetNextFrameWantCaptureKeyboard, [:bool], :void],
  [:igSetNextFrameWantCaptureMouse, [:bool], :void],
  [:igSetNextItemAllowOverlap, [], :void],
  [:igSetNextItemOpen, [:bool, :int], :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],
  [: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],
  [: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],
  [: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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



4187
4188
4189
# File 'lib/imgui.rb', line 4187

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



4193
4194
4195
# File 'lib/imgui.rb', line 4193

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



4199
4200
4201
# File 'lib/imgui.rb', line 4199

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



4205
4206
4207
# File 'lib/imgui.rb', line 4205

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



4211
4212
4213
# File 'lib/imgui.rb', line 4211

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.



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

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



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

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



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

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



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

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



4244
4245
4246
# File 'lib/imgui.rb', line 4244

def self.IsAnyItemActive()  # is any item active?
  igIsAnyItemActive()
end

.IsAnyItemFocusedObject

ret: bool



4249
4250
4251
# File 'lib/imgui.rb', line 4249

def self.IsAnyItemFocused()  # is any item focused?
  igIsAnyItemFocused()
end

.IsAnyItemHoveredObject

ret: bool



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

def self.IsAnyItemHovered()  # is any item hovered?
  igIsAnyItemHovered()
end

.IsAnyMouseDownObject

ret: bool



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

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



4264
4265
4266
# File 'lib/imgui.rb', line 4264

def self.IsItemActivated()  # was the last item just made active (item was previously inactive).
  igIsItemActivated()
end

.IsItemActiveObject

ret: bool



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

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



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

def self.IsItemClicked(mouse_button = 0)  # Implied mouse_button = 0
  igIsItemClicked(mouse_button)
end

.IsItemDeactivatedObject

ret: bool



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

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



4285
4286
4287
# File 'lib/imgui.rb', line 4285

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



4290
4291
4292
# File 'lib/imgui.rb', line 4290

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



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

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.



4305
4306
4307
# File 'lib/imgui.rb', line 4305

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



4310
4311
4312
# File 'lib/imgui.rb', line 4310

def self.IsItemToggledOpen()  # was the last item open state toggled? set by TreeNode().
  igIsItemToggledOpen()
end

.IsItemVisibleObject

ret: bool



4315
4316
4317
# File 'lib/imgui.rb', line 4315

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



4321
4322
4323
# File 'lib/imgui.rb', line 4321

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).



4333
4334
4335
# File 'lib/imgui.rb', line 4333

def self.IsKeyDown(key)  # is key being held.
  igIsKeyDown(key)
end

.IsKeyPressed(key, repeat = true) ⇒ Object

arg: key(ImGuiKey), repeat(bool) ret: bool



4339
4340
4341
# File 'lib/imgui.rb', line 4339

def self.IsKeyPressed(key, repeat = true)  # Implied repeat = true
  igIsKeyPressed(key, repeat)
end

.IsKeyReleased(key) ⇒ Object

arg: key(ImGuiKey) ret: bool



4345
4346
4347
# File 'lib/imgui.rb', line 4345

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



4351
4352
4353
# File 'lib/imgui.rb', line 4351

def self.IsMouseClicked(button, repeat = false)  # Implied repeat = false
  igIsMouseClicked(button, repeat)
end

.IsMouseDoubleClicked(button) ⇒ Object

arg: button(ImGuiMouseButton) ret: bool



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

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’)



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

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



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

def self.IsMouseDragging(button, lock_threshold = -1.0)  # is mouse dragging? (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold)
  igIsMouseDragging(button, lock_threshold)
end

.IsMouseHoveringRect(r_min, r_max, clip = true) ⇒ Object

arg: r_min(ImVec2), r_max(ImVec2), clip(bool) ret: bool



4380
4381
4382
# File 'lib/imgui.rb', line 4380

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



4386
4387
4388
# File 'lib/imgui.rb', line 4386

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



4392
4393
4394
# File 'lib/imgui.rb', line 4392

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.


4403
4404
4405
# File 'lib/imgui.rb', line 4403

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.



5585
5586
5587
5588
5589
5590
5591
5592
5593
# File 'lib/imgui.rb', line 5585

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



4409
4410
4411
# File 'lib/imgui.rb', line 4409

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



4415
4416
4417
# File 'lib/imgui.rb', line 4415

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.



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

def self.IsWindowAppearing()
  igIsWindowAppearing()
end

.IsWindowCollapsedObject

ret: bool



4428
4429
4430
# File 'lib/imgui.rb', line 4428

def self.IsWindowCollapsed()
  igIsWindowCollapsed()
end

.IsWindowFocused(flags = 0) ⇒ Object

arg: flags(ImGuiFocusedFlags) ret: bool



4434
4435
4436
# File 'lib/imgui.rb', line 4434

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



4440
4441
4442
# File 'lib/imgui.rb', line 4440

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



4446
4447
4448
# File 'lib/imgui.rb', line 4446

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



5595
5596
5597
5598
5599
5600
5601
5602
5603
# File 'lib/imgui.rb', line 5595

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



4458
4459
4460
# File 'lib/imgui.rb', line 4458

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



4452
4453
4454
# File 'lib/imgui.rb', line 4452

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



2471
2472
2473
2474
2475
# File 'lib/imgui.rb', line 2471

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).



4469
4470
4471
# File 'lib/imgui.rb', line 4469

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



4475
4476
4477
# File 'lib/imgui.rb', line 4475

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



4480
4481
4482
# File 'lib/imgui.rb', line 4480

def self.LogButtons()  # helper to display buttons for logging to tty/file/clipboard
  igLogButtons()
end

.LogFinishObject

ret: void



4485
4486
4487
# File 'lib/imgui.rb', line 4485

def self.LogFinish()  # stop logging (close file, etc.)
  igLogFinish()
end

.LogText(fmt, *varargs) ⇒ Object

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



4491
4492
4493
# File 'lib/imgui.rb', line 4491

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



4497
4498
4499
# File 'lib/imgui.rb', line 4497

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



4503
4504
4505
# File 'lib/imgui.rb', line 4503

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.



4512
4513
4514
# File 'lib/imgui.rb', line 4512

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



4518
4519
4520
# File 'lib/imgui.rb', line 4518

def self.MemAlloc(size)
  igMemAlloc(size)
end

.MemFree(ptr) ⇒ Object

arg: ptr(void*) ret: void



4524
4525
4526
# File 'lib/imgui.rb', line 4524

def self.MemFree(ptr)
  igMemFree(ptr)
end

Implied shortcut = NULL, selected = false, enabled = true



5605
5606
5607
5608
5609
5610
5611
5612
5613
# File 'lib/imgui.rb', line 5605

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



4530
4531
4532
# File 'lib/imgui.rb', line 4530

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



4536
4537
4538
# File 'lib/imgui.rb', line 4536

def self.MenuItem_BoolPtr(label, shortcut, p_selected, enabled = true)
  igMenuItem_BoolPtr(label, shortcut, p_selected, enabled)
end

.NewFrameObject

ret: void



4541
4542
4543
# File 'lib/imgui.rb', line 4541

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



4546
4547
4548
# File 'lib/imgui.rb', line 4546

def self.NewLine()  # undo a SameLine() or force a new line when in a horizontal-layout context.
  igNewLine()
end

.NextColumnObject

ret: void



4551
4552
4553
# File 'lib/imgui.rb', line 4551

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


5624
5625
5626
5627
5628
5629
5630
5631
5632
# File 'lib/imgui.rb', line 5624

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



4563
4564
4565
# File 'lib/imgui.rb', line 4563

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



4557
4558
4559
# File 'lib/imgui.rb', line 4557

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



4569
4570
4571
# File 'lib/imgui.rb', line 4569

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)



5634
5635
5636
5637
5638
5639
5640
5641
5642
# File 'lib/imgui.rb', line 5634

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



4575
4576
4577
# File 'lib/imgui.rb', line 4575

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



4581
4582
4583
# File 'lib/imgui.rb', line 4581

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



5647
5648
5649
5650
5651
5652
5653
5654
5655
# File 'lib/imgui.rb', line 5647

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



4587
4588
4589
# File 'lib/imgui.rb', line 4587

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



4593
4594
4595
# File 'lib/imgui.rb', line 4593

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

.PopButtonRepeatObject

ret: void



4598
4599
4600
# File 'lib/imgui.rb', line 4598

def self.PopButtonRepeat()
  igPopButtonRepeat()
end

.PopClipRectObject

ret: void



4603
4604
4605
# File 'lib/imgui.rb', line 4603

def self.PopClipRect()
  igPopClipRect()
end

.PopFontObject

ret: void



4608
4609
4610
# File 'lib/imgui.rb', line 4608

def self.PopFont()
  igPopFont()
end

.PopIDObject

ret: void



4613
4614
4615
# File 'lib/imgui.rb', line 4613

def self.PopID()  # pop from the ID stack.
  igPopID()
end

.PopItemWidthObject

ret: void



4618
4619
4620
# File 'lib/imgui.rb', line 4618

def self.PopItemWidth()
  igPopItemWidth()
end

.PopStyleColor(count = 1) ⇒ Object

arg: count(int) ret: void



4624
4625
4626
# File 'lib/imgui.rb', line 4624

def self.PopStyleColor(count = 1)  # Implied count = 1
  igPopStyleColor(count)
end

.PopStyleVar(count = 1) ⇒ Object

arg: count(int) ret: void



4630
4631
4632
# File 'lib/imgui.rb', line 4630

def self.PopStyleVar(count = 1)  # Implied count = 1
  igPopStyleVar(count)
end

.PopTabStopObject

ret: void



4635
4636
4637
# File 'lib/imgui.rb', line 4635

def self.PopTabStop()
  igPopTabStop()
end

.PopTextWrapPosObject

ret: void



4640
4641
4642
# File 'lib/imgui.rb', line 4640

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



4646
4647
4648
# File 'lib/imgui.rb', line 4646

def self.ProgressBar(fraction, size_arg = ImVec2.create(-FLT_MIN,0), overlay = nil)
  igProgressBar(fraction, size_arg, overlay)
end

.PushButtonRepeat(repeat) ⇒ Object

arg: repeat(bool) ret: void



4652
4653
4654
# File 'lib/imgui.rb', line 4652

def self.PushButtonRepeat(repeat)  # in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame.
  igPushButtonRepeat(repeat)
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.



4661
4662
4663
# File 'lib/imgui.rb', line 4661

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)



4669
4670
4671
# File 'lib/imgui.rb', line 4669

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.



5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
# File 'lib/imgui.rb', line 5669

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



4693
4694
4695
# File 'lib/imgui.rb', line 4693

def self.PushID_Int(int_id)
  igPushID_Int(int_id)
end

.PushID_Ptr(ptr_id) ⇒ Object

arg: ptr_id(const void*) ret: void



4687
4688
4689
# File 'lib/imgui.rb', line 4687

def self.PushID_Ptr(ptr_id)
  igPushID_Ptr(ptr_id)
end

.PushID_Str(str_id) ⇒ Object

arg: str_id(const char*) ret: void



4675
4676
4677
# File 'lib/imgui.rb', line 4675

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



4681
4682
4683
# File 'lib/imgui.rb', line 4681

def self.PushID_StrStr(str_id_begin, str_id_end)
  igPushID_StrStr(str_id_begin, str_id_end)
end

.PushItemWidth(item_width) ⇒ Object

arg: item_width(float) ret: void

Parameters stacks (current window)



4701
4702
4703
# File 'lib/imgui.rb', line 4701

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().



5685
5686
5687
5688
5689
5690
5691
5692
5693
# File 'lib/imgui.rb', line 5685

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



4707
4708
4709
# File 'lib/imgui.rb', line 4707

def self.PushStyleColor_U32(idx, col)
  igPushStyleColor_U32(idx, col)
end

.PushStyleColor_Vec4(idx, col) ⇒ Object

arg: idx(ImGuiCol), col(ImVec4) ret: void



4713
4714
4715
# File 'lib/imgui.rb', line 4713

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().



5695
5696
5697
5698
5699
5700
5701
5702
5703
# File 'lib/imgui.rb', line 5695

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



4719
4720
4721
# File 'lib/imgui.rb', line 4719

def self.PushStyleVar_Float(idx, val)
  igPushStyleVar_Float(idx, val)
end

.PushStyleVar_Vec2(idx, val) ⇒ Object

arg: idx(ImGuiStyleVar), val(ImVec2) ret: void



4725
4726
4727
# File 'lib/imgui.rb', line 4725

def self.PushStyleVar_Vec2(idx, val)
  igPushStyleVar_Vec2(idx, val)
end

.PushTabStop(tab_stop) ⇒ Object

arg: tab_stop(bool) ret: void



4731
4732
4733
# File 'lib/imgui.rb', line 4731

def self.PushTabStop(tab_stop)  # == tab stop enable. Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets
  igPushTabStop(tab_stop)
end

.PushTextWrapPos(wrap_local_pos_x = 0.0) ⇒ Object

arg: wrap_local_pos_x(float) ret: void



4737
4738
4739
# File 'lib/imgui.rb', line 4737

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; }



5705
5706
5707
5708
5709
5710
5711
5712
5713
# File 'lib/imgui.rb', line 5705

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



4743
4744
4745
# File 'lib/imgui.rb', line 4743

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



4749
4750
4751
# File 'lib/imgui.rb', line 4749

def self.RadioButton_IntPtr(label, v, v_button)
  igRadioButton_IntPtr(label, v, v_button)
end

.RenderObject

ret: void



4754
4755
4756
# File 'lib/imgui.rb', line 4754

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



4760
4761
4762
# File 'lib/imgui.rb', line 4760

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



4766
4767
4768
# File 'lib/imgui.rb', line 4766

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



4772
4773
4774
# File 'lib/imgui.rb', line 4772

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



4778
4779
4780
# File 'lib/imgui.rb', line 4778

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.



5719
5720
5721
5722
5723
5724
5725
5726
5727
# File 'lib/imgui.rb', line 5719

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



4784
4785
4786
# File 'lib/imgui.rb', line 4784

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



4790
4791
4792
# File 'lib/imgui.rb', line 4790

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



4797
4798
4799
# File 'lib/imgui.rb', line 4797

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



4803
4804
4805
# File 'lib/imgui.rb', line 4803

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.



4814
4815
4816
# File 'lib/imgui.rb', line 4814

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



4820
4821
4822
# File 'lib/imgui.rb', line 4820

def self.SetClipboardText(text)
  igSetClipboardText(text)
end

.SetColorEditOptions(flags) ⇒ Object

arg: flags(ImGuiColorEditFlags) ret: void



4826
4827
4828
# File 'lib/imgui.rb', line 4826

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



4832
4833
4834
# File 'lib/imgui.rb', line 4832

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



4838
4839
4840
# File 'lib/imgui.rb', line 4838

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



4844
4845
4846
# File 'lib/imgui.rb', line 4844

def self.SetCurrentContext(ctx)
  igSetCurrentContext(ctx)
end

.SetCursorPos(local_pos) ⇒ Object

arg: local_pos(ImVec2) ret: void



4850
4851
4852
# File 'lib/imgui.rb', line 4850

def self.SetCursorPos(local_pos)  # [window-local] "
  igSetCursorPos(local_pos)
end

.SetCursorPosX(local_x) ⇒ Object

arg: local_x(float) ret: void



4856
4857
4858
# File 'lib/imgui.rb', line 4856

def self.SetCursorPosX(local_x)  # [window-local] "
  igSetCursorPosX(local_x)
end

.SetCursorPosY(local_y) ⇒ Object

arg: local_y(float) ret: void



4862
4863
4864
# File 'lib/imgui.rb', line 4862

def self.SetCursorPosY(local_y)  # [window-local] "
  igSetCursorPosY(local_y)
end

.SetCursorScreenPos(pos) ⇒ Object

arg: pos(ImVec2) ret: void



4868
4869
4870
# File 'lib/imgui.rb', line 4868

def self.SetCursorScreenPos(pos)  # cursor position in absolute coordinates
  igSetCursorScreenPos(pos)
end

.SetDragDropPayload(type, data, sz, cond = 0) ⇒ Object

arg: type(const char*), data(const void*), sz(size_t), cond(ImGuiCond) ret: bool



4874
4875
4876
# File 'lib/imgui.rb', line 4874

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”



4882
4883
4884
# File 'lib/imgui.rb', line 4882

def self.SetItemDefaultFocus()  # make last item the default focused item of a window.
  igSetItemDefaultFocus()
end

.SetItemTooltip(fmt, *varargs) ⇒ Object

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



4888
4889
4890
# File 'lib/imgui.rb', line 4888

def self.SetItemTooltip(fmt, *varargs)  # set a text-only tooltip if preceeding item was hovered. override any previous call to SetTooltip().
  igSetItemTooltip(fmt, *varargs)
end

.SetKeyboardFocusHere(offset = 0) ⇒ Object

arg: offset(int) ret: void



4894
4895
4896
# File 'lib/imgui.rb', line 4894

def self.SetKeyboardFocusHere(offset = 0)  # Implied offset = 0
  igSetKeyboardFocusHere(offset)
end

.SetMouseCursor(cursor_type) ⇒ Object

arg: cursor_type(ImGuiMouseCursor) ret: void



4900
4901
4902
# File 'lib/imgui.rb', line 4900

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



4906
4907
4908
# File 'lib/imgui.rb', line 4906

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



4912
4913
4914
# File 'lib/imgui.rb', line 4912

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



4919
4920
4921
# File 'lib/imgui.rb', line 4919

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



4925
4926
4927
# File 'lib/imgui.rb', line 4925

def self.SetNextItemOpen(is_open, cond = 0)  # set next TreeNode/CollapsingHeader open state.
  igSetNextItemOpen(is_open, cond)
end

.SetNextItemWidth(item_width) ⇒ Object

arg: item_width(float) ret: void



4931
4932
4933
# File 'lib/imgui.rb', line 4931

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



4937
4938
4939
# File 'lib/imgui.rb', line 4937

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



4943
4944
4945
# File 'lib/imgui.rb', line 4943

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



4949
4950
4951
# File 'lib/imgui.rb', line 4949

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



4954
4955
4956
# File 'lib/imgui.rb', line 4954

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).



4963
4964
4965
# File 'lib/imgui.rb', line 4963

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



4969
4970
4971
# File 'lib/imgui.rb', line 4969

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



4975
4976
4977
# File 'lib/imgui.rb', line 4975

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



4981
4982
4983
# File 'lib/imgui.rb', line 4981

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



4987
4988
4989
# File 'lib/imgui.rb', line 4987

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



4993
4994
4995
# File 'lib/imgui.rb', line 4993

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



4999
5000
5001
# File 'lib/imgui.rb', line 4999

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



5005
5006
5007
# File 'lib/imgui.rb', line 5005

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



5011
5012
5013
# File 'lib/imgui.rb', line 5011

def self.SetScrollX(scroll_x)  # set scrolling amount [0 .. GetScrollMaxX()]
  igSetScrollX(scroll_x)
end

.SetScrollY(scroll_y) ⇒ Object

arg: scroll_y(float) ret: void



5017
5018
5019
# File 'lib/imgui.rb', line 5017

def self.SetScrollY(scroll_y)  # set scrolling amount [0 .. GetScrollMaxY()]
  igSetScrollY(scroll_y)
end

.SetStateStorage(storage) ⇒ Object

arg: storage(ImGuiStorage*) ret: void



5023
5024
5025
# File 'lib/imgui.rb', line 5023

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



5029
5030
5031
# File 'lib/imgui.rb', line 5029

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



5035
5036
5037
# File 'lib/imgui.rb', line 5035

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().



5729
5730
5731
5732
5733
5734
5735
5736
5737
# File 'lib/imgui.rb', line 5729

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



5041
5042
5043
# File 'lib/imgui.rb', line 5041

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



5047
5048
5049
# File 'lib/imgui.rb', line 5047

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().



5739
5740
5741
5742
5743
5744
5745
5746
5747
# File 'lib/imgui.rb', line 5739

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



5052
5053
5054
# File 'lib/imgui.rb', line 5052

def self.SetWindowFocus_Nil()
  igSetWindowFocus_Nil()
end

.SetWindowFocus_Str(name) ⇒ Object

arg: name(const char*) ret: void



5058
5059
5060
# File 'lib/imgui.rb', line 5058

def self.SetWindowFocus_Str(name)
  igSetWindowFocus_Str(name)
end

.SetWindowFontScale(scale) ⇒ Object

arg: scale(float) ret: void



5064
5065
5066
# File 'lib/imgui.rb', line 5064

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.



5749
5750
5751
5752
5753
5754
5755
5756
5757
# File 'lib/imgui.rb', line 5749

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



5076
5077
5078
# File 'lib/imgui.rb', line 5076

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



5070
5071
5072
# File 'lib/imgui.rb', line 5070

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.



5759
5760
5761
5762
5763
5764
5765
5766
5767
# File 'lib/imgui.rb', line 5759

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



5088
5089
5090
# File 'lib/imgui.rb', line 5088

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



5082
5083
5084
# File 'lib/imgui.rb', line 5082

def self.SetWindowSize_Vec2(size, cond = 0)
  igSetWindowSize_Vec2(size, cond)
end

.ShowAboutWindow(p_open = nil) ⇒ Object

arg: p_open(bool*) ret: void



5094
5095
5096
# File 'lib/imgui.rb', line 5094

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



5100
5101
5102
# File 'lib/imgui.rb', line 5100

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



5108
5109
5110
# File 'lib/imgui.rb', line 5108

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



5114
5115
5116
# File 'lib/imgui.rb', line 5114

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



5120
5121
5122
# File 'lib/imgui.rb', line 5120

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



5126
5127
5128
# File 'lib/imgui.rb', line 5126

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



5132
5133
5134
# File 'lib/imgui.rb', line 5132

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



5138
5139
5140
# File 'lib/imgui.rb', line 5138

def self.ShowStyleSelector(label)  # add style selector block (not a window), essentially a combo listing the default styles.
  igShowStyleSelector(label)
end

.ShowUserGuideObject

ret: void



5143
5144
5145
# File 'lib/imgui.rb', line 5143

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



5149
5150
5151
# File 'lib/imgui.rb', line 5149

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



5162
5163
5164
# File 'lib/imgui.rb', line 5162

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



5168
5169
5170
# File 'lib/imgui.rb', line 5168

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



5174
5175
5176
# File 'lib/imgui.rb', line 5174

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



5180
5181
5182
# File 'lib/imgui.rb', line 5180

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



5186
5187
5188
# File 'lib/imgui.rb', line 5186

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



5192
5193
5194
# File 'lib/imgui.rb', line 5192

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



5198
5199
5200
# File 'lib/imgui.rb', line 5198

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



5204
5205
5206
# File 'lib/imgui.rb', line 5204

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



5210
5211
5212
# File 'lib/imgui.rb', line 5210

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



5216
5217
5218
# File 'lib/imgui.rb', line 5216

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



5222
5223
5224
# File 'lib/imgui.rb', line 5222

def self.SmallButton(label)  # button with (FramePadding.y == 0) to easily embed within text
  igSmallButton(label)
end

.SpacingObject

ret: void



5227
5228
5229
# File 'lib/imgui.rb', line 5227

def self.Spacing()  # add vertical spacing.
  igSpacing()
end

.StyleColorsClassic(dst = nil) ⇒ Object

arg: dst(ImGuiStyle*) ret: void



5233
5234
5235
# File 'lib/imgui.rb', line 5233

def self.StyleColorsClassic(dst = nil)  # classic imgui style
  igStyleColorsClassic(dst)
end

.StyleColorsDark(dst = nil) ⇒ Object

arg: dst(ImGuiStyle*) ret: void

Styles



5241
5242
5243
# File 'lib/imgui.rb', line 5241

def self.StyleColorsDark(dst = nil)  # new, recommended style (default)
  igStyleColorsDark(dst)
end

.StyleColorsLight(dst = nil) ⇒ Object

arg: dst(ImGuiStyle*) ret: void



5247
5248
5249
# File 'lib/imgui.rb', line 5247

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



5253
5254
5255
# File 'lib/imgui.rb', line 5253

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



5258
5259
5260
# File 'lib/imgui.rb', line 5258

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



5263
5264
5265
# File 'lib/imgui.rb', line 5263

def self.TableGetColumnCount()  # return number of columns (value passed to BeginTable)
  igTableGetColumnCount()
end

.TableGetColumnFlags(column_n = -1)) ⇒ Object

arg: column_n(int) ret: int



5269
5270
5271
# File 'lib/imgui.rb', line 5269

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



5274
5275
5276
# File 'lib/imgui.rb', line 5274

def self.TableGetColumnIndex()  # return current column index.
  igTableGetColumnIndex()
end

.TableGetColumnName(column_n = -1)) ⇒ Object

arg: column_n(int) ret: pointer



5280
5281
5282
# File 'lib/imgui.rb', line 5280

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

.TableGetRowIndexObject

ret: int



5285
5286
5287
# File 'lib/imgui.rb', line 5285

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.



5297
5298
5299
# File 'lib/imgui.rb', line 5297

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



5303
5304
5305
# File 'lib/imgui.rb', line 5303

def self.TableHeader(label)  # submit one header cell manually (rarely used)
  igTableHeader(label)
end

.TableHeadersRowObject

ret: void



5308
5309
5310
# File 'lib/imgui.rb', line 5308

def self.TableHeadersRow()  # submit a row with headers cells based on data provided to TableSetupColumn() + submit context menu
  igTableHeadersRow()
end

.TableNextColumnObject

ret: bool



5313
5314
5315
# File 'lib/imgui.rb', line 5313

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



5319
5320
5321
# File 'lib/imgui.rb', line 5319

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



5325
5326
5327
# File 'lib/imgui.rb', line 5325

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



5331
5332
5333
# File 'lib/imgui.rb', line 5331

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



5337
5338
5339
# File 'lib/imgui.rb', line 5337

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.



5352
5353
5354
# File 'lib/imgui.rb', line 5352

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



5358
5359
5360
# File 'lib/imgui.rb', line 5358

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



5364
5365
5366
# File 'lib/imgui.rb', line 5364

def self.Text(fmt, *varargs)  # formatted text
  igText(fmt, *varargs)
end

.TextColored(col, fmt, *varargs) ⇒ Object

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



5370
5371
5372
# File 'lib/imgui.rb', line 5370

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



5376
5377
5378
# File 'lib/imgui.rb', line 5376

def self.TextDisabled(fmt, *varargs)  # shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor();
  igTextDisabled(fmt, *varargs)
end

.TextUnformatted(text, text_end = nil) ⇒ Object

arg: text(const char*), text_end(const char*) ret: void

Widgets: Text



5384
5385
5386
# File 'lib/imgui.rb', line 5384

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



5390
5391
5392
# File 'lib/imgui.rb', line 5390

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.



5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
# File 'lib/imgui.rb', line 5772

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



5408
5409
5410
# File 'lib/imgui.rb', line 5408

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



5396
5397
5398
# File 'lib/imgui.rb', line 5396

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



5402
5403
5404
# File 'lib/imgui.rb', line 5402

def self.TreeNode_StrStr(str_id, fmt, *varargs)
  igTreeNode_StrStr(str_id, fmt, *varargs)
end

.TreeNodeEx(*arg) ⇒ Object



5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
# File 'lib/imgui.rb', line 5785

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



5426
5427
5428
# File 'lib/imgui.rb', line 5426

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



5414
5415
5416
# File 'lib/imgui.rb', line 5414

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



5420
5421
5422
# File 'lib/imgui.rb', line 5420

def self.TreeNodeEx_StrStr(str_id, flags, fmt, *varargs)
  igTreeNodeEx_StrStr(str_id, flags, fmt, *varargs)
end

.TreePopObject

ret: void



5431
5432
5433
# File 'lib/imgui.rb', line 5431

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.



5798
5799
5800
5801
5802
5803
5804
5805
5806
# File 'lib/imgui.rb', line 5798

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



5443
5444
5445
# File 'lib/imgui.rb', line 5443

def self.TreePush_Ptr(ptr_id)
  igTreePush_Ptr(ptr_id)
end

.TreePush_Str(str_id) ⇒ Object

arg: str_id(const char*) ret: void



5437
5438
5439
# File 'lib/imgui.rb', line 5437

def self.TreePush_Str(str_id)
  igTreePush_Str(str_id)
end

.Unindent(indent_w = 0.0) ⇒ Object

arg: indent_w(float) ret: void



5449
5450
5451
# File 'lib/imgui.rb', line 5449

def self.Unindent(indent_w = 0.0)  # Implied indent_w = 0.0f
  igUnindent(indent_w)
end

.Value(*arg) ⇒ Object



5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
# File 'lib/imgui.rb', line 5808

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



5473
5474
5475
# File 'lib/imgui.rb', line 5473

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



5491
5492
5493
# File 'lib/imgui.rb', line 5491

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



5479
5480
5481
# File 'lib/imgui.rb', line 5479

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



5485
5486
5487
# File 'lib/imgui.rb', line 5485

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



5455
5456
5457
# File 'lib/imgui.rb', line 5455

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



5461
5462
5463
# File 'lib/imgui.rb', line 5461

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



5467
5468
5469
# File 'lib/imgui.rb', line 5467

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