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



2435
2436
2437
# File 'lib/imgui.rb', line 2435

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



2440
2441
2442
# File 'lib/imgui.rb', line 2440

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



2446
2447
2448
# File 'lib/imgui.rb', line 2446

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, this is inconsistent with most 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”.



2465
2466
2467
# File 'lib/imgui.rb', line 2465

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.

  • For each independent axis of ‘size’: ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. ImVec2(0,400).

  • BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. Always call a matching EndChild() for each BeginChild() call, regardless of its return value. [Important: due to legacy reason, this is inconsistent with most 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.]
    


4791
4792
4793
4794
4795
4796
4797
4798
4799
# File 'lib/imgui.rb', line 4791

def self.BeginChild(*arg)
  # arg: 0:str_id(const char*), 1:size(ImVec2), 2:border(bool), 3: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].is_a?(TrueClass) || arg[2].is_a?(FalseClass)) && arg[3].kind_of?(Integer))
  # arg: 0:id(ImGuiID), 1:size(ImVec2), 2:border(bool), 3: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].is_a?(TrueClass) || arg[2].is_a?(FalseClass)) && arg[3].kind_of?(Integer))
  $stderr.puts("[Warning] BeginChild : No matching functions found (#{arg})")
end

.BeginChild_ID(id, size = ImVec2.create(0,0), border = false, flags = 0) ⇒ Object

arg: id(ImGuiID), size(ImVec2), border(bool), flags(ImGuiWindowFlags) ret: bool



2477
2478
2479
# File 'lib/imgui.rb', line 2477

def self.BeginChild_ID(id, size = ImVec2.create(0,0), border = false, flags = 0)
  igBeginChild_ID(id, size, border, flags)
end

.BeginChild_Str(str_id, size = ImVec2.create(0,0), border = false, flags = 0) ⇒ Object

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



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

def self.BeginChild_Str(str_id, size = ImVec2.create(0,0), border = false, flags = 0)
  igBeginChild_Str(str_id, size, border, flags)
end

.BeginChildFrame(id, size, flags = 0) ⇒ Object

arg: id(ImGuiID), size(ImVec2), flags(ImGuiWindowFlags) ret: bool



2483
2484
2485
# File 'lib/imgui.rb', line 2483

def self.BeginChildFrame(id, size, flags = 0)  # helper to create a child window / scrolling region that looks like a normal widget frame
  igBeginChildFrame(id, size, 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.



2493
2494
2495
# File 'lib/imgui.rb', line 2493

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.



2504
2505
2506
# File 'lib/imgui.rb', line 2504

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.



2516
2517
2518
# File 'lib/imgui.rb', line 2516

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



2521
2522
2523
# File 'lib/imgui.rb', line 2521

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



2526
2527
2528
# File 'lib/imgui.rb', line 2526

def self.BeginGroup()  # lock horizontal starting position
  igBeginGroup()
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 some stylistic changes.

  • The BeginListBox()/EndListBox() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() or any items.

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



2539
2540
2541
# File 'lib/imgui.rb', line 2539

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

.BeginMainMenuBarObject

ret: bool



2544
2545
2546
# File 'lib/imgui.rb', line 2544

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



2550
2551
2552
# File 'lib/imgui.rb', line 2550

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.



2561
2562
2563
# File 'lib/imgui.rb', line 2561

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: begin/end functions

- BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards. 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.


2571
2572
2573
# File 'lib/imgui.rb', line 2571

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.


2583
2584
2585
# File 'lib/imgui.rb', line 2583

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



2589
2590
2591
# File 'lib/imgui.rb', line 2589

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



2595
2596
2597
# File 'lib/imgui.rb', line 2595

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



2601
2602
2603
# File 'lib/imgui.rb', line 2601

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.



2610
2611
2612
# File 'lib/imgui.rb', line 2610

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



2616
2617
2618
# File 'lib/imgui.rb', line 2616

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



2646
2647
2648
# File 'lib/imgui.rb', line 2646

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

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



2654
2655
2656
# File 'lib/imgui.rb', line 2654

def self.BeginTooltip()  # begin/append a tooltip window. to create full-featured tooltip (with any kind of items).
  igBeginTooltip()
end

.BulletObject

ret: void



2659
2660
2661
# File 'lib/imgui.rb', line 2659

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



2665
2666
2667
# File 'lib/imgui.rb', line 2665

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.



2675
2676
2677
# File 'lib/imgui.rb', line 2675

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

.CalcItemWidthObject

ret: float



2680
2681
2682
# File 'lib/imgui.rb', line 2680

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



2688
2689
2690
2691
2692
# File 'lib/imgui.rb', line 2688

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



2696
2697
2698
# File 'lib/imgui.rb', line 2696

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

.CheckboxFlags(*arg) ⇒ Object



4801
4802
4803
4804
4805
4806
4807
4808
4809
# File 'lib/imgui.rb', line 4801

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



2702
2703
2704
# File 'lib/imgui.rb', line 2702

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



2708
2709
2710
# File 'lib/imgui.rb', line 2708

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

.CloseCurrentPopupObject

ret: void



2713
2714
2715
# File 'lib/imgui.rb', line 2713

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



4811
4812
4813
4814
4815
4816
4817
4818
4819
# File 'lib/imgui.rb', line 4811

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



2725
2726
2727
# File 'lib/imgui.rb', line 2725

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



2719
2720
2721
# File 'lib/imgui.rb', line 2719

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



2731
2732
2733
# File 'lib/imgui.rb', line 2731

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



2737
2738
2739
# File 'lib/imgui.rb', line 2737

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



2743
2744
2745
# File 'lib/imgui.rb', line 2743

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



2749
2750
2751
# File 'lib/imgui.rb', line 2749

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



2757
2758
2759
2760
2761
# File 'lib/imgui.rb', line 2757

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



2769
2770
2771
# File 'lib/imgui.rb', line 2769

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



2775
2776
2777
# File 'lib/imgui.rb', line 2775

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



2781
2782
2783
# File 'lib/imgui.rb', line 2781

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



2787
2788
2789
# File 'lib/imgui.rb', line 2787

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.



2796
2797
2798
# File 'lib/imgui.rb', line 2796

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



4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
# File 'lib/imgui.rb', line 4821

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:items_getter(bool(*)(void* data,int idx,const char** out_text)), 3:data(void*), 4:items_count(int), 5:popup_max_height_in_items(int)
  # ret: bool
  return igCombo_FnBoolPtr(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_FnBoolPtr(label, current_item, items_getter, data, items_count, popup_max_height_in_items = -1)) ⇒ Object

arg: label(const char*), current_item(int*), items_getter(bool(*)(void* data,int idx,const char** out_text)), data(void*), items_count(int), popup_max_height_in_items(int) ret: bool



2814
2815
2816
# File 'lib/imgui.rb', line 2814

def self.Combo_FnBoolPtr(label, current_item, items_getter, data, items_count, popup_max_height_in_items = -1)
  igCombo_FnBoolPtr(label, current_item, items_getter, 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



2808
2809
2810
# File 'lib/imgui.rb', line 2808

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



2802
2803
2804
# File 'lib/imgui.rb', line 2802

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.



2825
2826
2827
# File 'lib/imgui.rb', line 2825

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



2831
2832
2833
# File 'lib/imgui.rb', line 2831

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

.DebugTextEncoding(text) ⇒ Object

arg: text(const char*) ret: void

Debug Utilities



2839
2840
2841
# File 'lib/imgui.rb', line 2839

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

.DestroyContext(ctx = nil) ⇒ Object

arg: ctx(ImGuiContext*) ret: void



2845
2846
2847
# File 'lib/imgui.rb', line 2845

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



2864
2865
2866
# File 'lib/imgui.rb', line 2864

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



2870
2871
2872
# File 'lib/imgui.rb', line 2870

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



2876
2877
2878
# File 'lib/imgui.rb', line 2876

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



2882
2883
2884
# File 'lib/imgui.rb', line 2882

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



2888
2889
2890
# File 'lib/imgui.rb', line 2888

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



2894
2895
2896
# File 'lib/imgui.rb', line 2894

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



2900
2901
2902
# File 'lib/imgui.rb', line 2900

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



2906
2907
2908
# File 'lib/imgui.rb', line 2906

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



2912
2913
2914
# File 'lib/imgui.rb', line 2912

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



2918
2919
2920
# File 'lib/imgui.rb', line 2918

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



2924
2925
2926
# File 'lib/imgui.rb', line 2924

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



2930
2931
2932
# File 'lib/imgui.rb', line 2930

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



2936
2937
2938
# File 'lib/imgui.rb', line 2936

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



2941
2942
2943
# File 'lib/imgui.rb', line 2941

def self.End()
  igEnd()
end

.EndChildObject

ret: void



2946
2947
2948
# File 'lib/imgui.rb', line 2946

def self.EndChild()
  igEndChild()
end

.EndChildFrameObject

ret: void



2951
2952
2953
# File 'lib/imgui.rb', line 2951

def self.EndChildFrame()  # always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)
  igEndChildFrame()
end

.EndComboObject

ret: void



2956
2957
2958
# File 'lib/imgui.rb', line 2956

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

.EndDisabledObject

ret: void



2961
2962
2963
# File 'lib/imgui.rb', line 2961

def self.EndDisabled()
  igEndDisabled()
end

.EndDragDropSourceObject

ret: void



2966
2967
2968
# File 'lib/imgui.rb', line 2966

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

.EndDragDropTargetObject

ret: void



2971
2972
2973
# File 'lib/imgui.rb', line 2971

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

.EndFrameObject

ret: void



2976
2977
2978
# File 'lib/imgui.rb', line 2976

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



2981
2982
2983
# File 'lib/imgui.rb', line 2981

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



2986
2987
2988
# File 'lib/imgui.rb', line 2986

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

.EndMainMenuBarObject

ret: void



2991
2992
2993
# File 'lib/imgui.rb', line 2991

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

.EndMenuObject

ret: void



2996
2997
2998
# File 'lib/imgui.rb', line 2996

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

.EndMenuBarObject

ret: void



3001
3002
3003
# File 'lib/imgui.rb', line 3001

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

.EndPopupObject

ret: void



3006
3007
3008
# File 'lib/imgui.rb', line 3006

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

.EndTabBarObject

ret: void



3011
3012
3013
# File 'lib/imgui.rb', line 3011

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

.EndTabItemObject

ret: void



3016
3017
3018
# File 'lib/imgui.rb', line 3016

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

.EndTableObject

ret: void



3021
3022
3023
# File 'lib/imgui.rb', line 3021

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

.EndTooltipObject

ret: void



3026
3027
3028
# File 'lib/imgui.rb', line 3026

def self.EndTooltip()  # only call EndTooltip() if BeginTooltip() 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



3032
3033
3034
# File 'lib/imgui.rb', line 3032

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



3039
3040
3041
# File 'lib/imgui.rb', line 3039

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.



3047
3048
3049
# File 'lib/imgui.rb', line 3047

def self.GetClipboardText()
  igGetClipboardText()
end

.GetColorU32(*arg) ⇒ Object

Implied alpha_mul = 1.0f



4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
# File 'lib/imgui.rb', line 4834

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)
  # ret: uint
  return igGetColorU32_U32(arg[0]) if arg.length == 1 && (arg[0].kind_of?(Integer))
  $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



3053
3054
3055
# File 'lib/imgui.rb', line 3053

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

.GetColorU32_U32(col) ⇒ Object

arg: col(ImU32) ret: uint



3065
3066
3067
# File 'lib/imgui.rb', line 3065

def self.GetColorU32_U32(col)
  igGetColorU32_U32(col)
end

.GetColorU32_Vec4(col) ⇒ Object

arg: col(ImVec4) ret: uint



3059
3060
3061
# File 'lib/imgui.rb', line 3059

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

.GetColumnIndexObject

ret: int



3070
3071
3072
# File 'lib/imgui.rb', line 3070

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

.GetColumnOffset(column_index = -1)) ⇒ Object

arg: column_index(int) ret: float



3076
3077
3078
# File 'lib/imgui.rb', line 3076

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



3087
3088
3089
# File 'lib/imgui.rb', line 3087

def self.GetColumnsCount()
  igGetColumnsCount()
end

.GetColumnWidth(column_index = -1)) ⇒ Object

arg: column_index(int) ret: float



3082
3083
3084
# File 'lib/imgui.rb', line 3082

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)



3096
3097
3098
3099
3100
# File 'lib/imgui.rb', line 3096

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

.GetContentRegionMaxObject

ret: void



3103
3104
3105
3106
3107
# File 'lib/imgui.rb', line 3103

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



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

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



3115
3116
3117
3118
3119
# File 'lib/imgui.rb', line 3115

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

.GetCursorPosXObject

ret: float



3122
3123
3124
# File 'lib/imgui.rb', line 3122

def self.GetCursorPosX()  #   (some functions are using window-relative coordinates, such as: GetCursorPos, GetCursorStartPos, GetContentRegionMax, GetWindowContentRegion* etc.
  igGetCursorPosX()
end

.GetCursorPosYObject

ret: float



3127
3128
3129
# File 'lib/imgui.rb', line 3127

def self.GetCursorPosY()  #    other functions such as GetCursorScreenPos or everything in ImDrawList::
  igGetCursorPosY()
end

.GetCursorScreenPosObject

ret: void



3132
3133
3134
3135
3136
# File 'lib/imgui.rb', line 3132

def self.GetCursorScreenPos()  # cursor position in absolute coordinates (useful to work with ImDrawList API). generally top-left == GetMainViewport()->Pos == (0,0) in single viewport mode, and bottom-right == GetMainViewport()->Pos+Size == io.DisplaySize in single-viewport mode.
  pOut = ImVec2.new
  igGetCursorScreenPos(pOut)
  return pOut
end

.GetCursorStartPosObject

ret: void



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

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

.GetDragDropPayloadObject

ret: pointer



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

def self.GetDragDropPayload()  # peek directly into the current payload from anywhere. may return NULL. use ImGuiPayload::IsDataType() to test for the payload type.
  igGetDragDropPayload()
end

.GetDrawDataObject

ret: pointer



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

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



3156
3157
3158
# File 'lib/imgui.rb', line 3156

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.



3164
3165
3166
# File 'lib/imgui.rb', line 3164

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

.GetFontSizeObject

ret: float



3169
3170
3171
# File 'lib/imgui.rb', line 3169

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

.GetFontTexUvWhitePixelObject

ret: void



3174
3175
3176
3177
3178
# File 'lib/imgui.rb', line 3174

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



3181
3182
3183
# File 'lib/imgui.rb', line 3181

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



3186
3187
3188
# File 'lib/imgui.rb', line 3186

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

.GetFrameHeightObject

ret: float



3191
3192
3193
# File 'lib/imgui.rb', line 3191

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

.GetFrameHeightWithSpacingObject

ret: float



3196
3197
3198
# File 'lib/imgui.rb', line 3196

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



4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
# File 'lib/imgui.rb', line 4847

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



3214
3215
3216
# File 'lib/imgui.rb', line 3214

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

.GetID_Str(str_id) ⇒ Object

arg: str_id(const char*) ret: uint



3202
3203
3204
# File 'lib/imgui.rb', line 3202

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



3208
3209
3210
# File 'lib/imgui.rb', line 3208

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

.GetIOObject

ret: pointer

Main



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

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

.GetItemIDObject

ret: uint



3226
3227
3228
# File 'lib/imgui.rb', line 3226

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

.GetItemRectMaxObject

ret: void



3231
3232
3233
3234
3235
# File 'lib/imgui.rb', line 3231

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



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

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



3245
3246
3247
3248
3249
# File 'lib/imgui.rb', line 3245

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

.GetKeyIndex(key) ⇒ Object

arg: key(ImGuiKey) ret: int



3253
3254
3255
# File 'lib/imgui.rb', line 3253

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

.GetKeyName(key) ⇒ Object

arg: key(ImGuiKey) ret: pointer



3259
3260
3261
# File 'lib/imgui.rb', line 3259

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



3265
3266
3267
# File 'lib/imgui.rb', line 3265

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.



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

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

.GetMouseClickedCount(button) ⇒ Object

arg: button(ImGuiMouseButton) ret: int



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

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



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

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



3292
3293
3294
3295
3296
# File 'lib/imgui.rb', line 3292

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



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

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



3306
3307
3308
3309
3310
# File 'lib/imgui.rb', line 3306

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



3313
3314
3315
# File 'lib/imgui.rb', line 3313

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

.GetScrollMaxYObject

ret: float



3318
3319
3320
# File 'lib/imgui.rb', line 3318

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



3327
3328
3329
# File 'lib/imgui.rb', line 3327

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

.GetScrollYObject

ret: float



3332
3333
3334
# File 'lib/imgui.rb', line 3332

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

.GetStateStorageObject

ret: pointer



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

def self.GetStateStorage()
  igGetStateStorage()
end

.GetStyleObject

ret: pointer



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

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

.GetStyleColorName(idx) ⇒ Object

arg: idx(ImGuiCol) ret: pointer



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

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



3354
3355
3356
# File 'lib/imgui.rb', line 3354

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



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

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

.GetTextLineHeightWithSpacingObject

ret: float



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

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

.GetTimeObject

ret: double



3369
3370
3371
# File 'lib/imgui.rb', line 3369

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

.GetTreeNodeToLabelSpacingObject

ret: float



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

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



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

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



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

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



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

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



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

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

.GetWindowHeightObject

ret: float



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

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

.GetWindowPosObject

ret: void



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

def self.GetWindowPos()  # get current window position in screen space (useful if you want to do your own drawing via the DrawList API)
  pOut = ImVec2.new
  igGetWindowPos(pOut)
  return pOut
end

.GetWindowSizeObject

ret: void



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

def self.GetWindowSize()  # get current window size
  pOut = ImVec2.new
  igGetWindowSize(pOut)
  return pOut
end

.GetWindowWidthObject

ret: float



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

def self.GetWindowWidth()  # get current window width (shortcut for GetWindowSize().x)
  igGetWindowWidth()
end

.Image(user_texture_id, 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), size(ImVec2), uv0(ImVec2), uv1(ImVec2), tint_col(ImVec4), border_col(ImVec4) ret: void

Widgets: Images



3431
3432
3433
# File 'lib/imgui.rb', line 3431

def self.Image(user_texture_id, 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, size, uv0, uv1, tint_col, border_col)
end

.ImageButton(str_id, user_texture_id, 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), size(ImVec2), uv0(ImVec2), uv1(ImVec2), bg_col(ImVec4), tint_col(ImVec4) ret: bool



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

def self.ImageButton(str_id, user_texture_id, 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, 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].pointer + 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].pointer + 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].pointer + 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].pointer + 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



1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
# File 'lib/imgui.rb', line 1909

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

entries = [
  [: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_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_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],
  [: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],
  [: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_ClearInputCharacters, [: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],
  [:ImGuiStyle_ImGuiStyle, [], :pointer],
  [:ImGuiStyle_ScaleAllSizes, [:pointer, :float], :void],
  [:ImGuiStyle_destroy, [:pointer], :void],
  [: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],
  [:igAcceptDragDropPayload, [:pointer, :int], :pointer],
  [:igAlignTextToFramePadding, [], :void],
  [:igArrowButton, [:pointer, :int], :bool],
  [:igBegin, [:pointer, :pointer, :int], :bool],
  [:igBeginChild_Str, [:pointer, ImVec2.by_value, :bool, :int], :bool],
  [:igBeginChild_ID, [:uint, ImVec2.by_value, :bool, :int], :bool],
  [:igBeginChildFrame, [:uint, ImVec2.by_value, :int], :bool],
  [:igBeginCombo, [:pointer, :pointer, :int], :bool],
  [:igBeginDisabled, [:bool], :void],
  [:igBeginDragDropSource, [:int], :bool],
  [:igBeginDragDropTarget, [], :bool],
  [:igBeginGroup, [], :void],
  [: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_FnBoolPtr, [: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],
  [: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],
  [:igEndChildFrame, [], :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], :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],
  [: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_FnBoolPtr, [: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],
  [:igSetItemAllowOverlap, [], :void],
  [:igSetItemDefaultFocus, [], :void],
  [:igSetKeyboardFocusHere, [:int], :void],
  [:igSetMouseCursor, [:int], :void],
  [:igSetNextFrameWantCaptureKeyboard, [:bool], :void],
  [:igSetNextFrameWantCaptureMouse, [:bool], :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],
  [:igShowMetricsWindow, [:pointer], :void],
  [:igShowStackToolWindow, [: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],
  [: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



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

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



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

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



3455
3456
3457
# File 'lib/imgui.rb', line 3455

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



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

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



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

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



3473
3474
3475
# File 'lib/imgui.rb', line 3473

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



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

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



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

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



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

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



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

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



3503
3504
3505
# File 'lib/imgui.rb', line 3503

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



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

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.



3519
3520
3521
# File 'lib/imgui.rb', line 3519

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



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

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



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

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



3537
3538
3539
# File 'lib/imgui.rb', line 3537

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



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

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

.IsAnyItemFocusedObject

ret: bool



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

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

.IsAnyItemHoveredObject

ret: bool



3552
3553
3554
# File 'lib/imgui.rb', line 3552

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

.IsAnyMouseDownObject

ret: bool



3557
3558
3559
# File 'lib/imgui.rb', line 3557

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



3562
3563
3564
# File 'lib/imgui.rb', line 3562

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

.IsItemActiveObject

ret: bool



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

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



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

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

.IsItemDeactivatedObject

ret: bool



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

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



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

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



3588
3589
3590
# File 'lib/imgui.rb', line 3588

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



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

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.



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

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



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

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

.IsItemVisibleObject

ret: bool



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

def self.IsItemVisible()  # is the last item visible? (items may be out of sight because of clipping/scrolling)
  igIsItemVisible()
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).



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

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

.IsKeyPressed(key, repeat = true) ⇒ Object

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



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

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

.IsKeyReleased(key) ⇒ Object

arg: key(ImGuiKey) ret: bool



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

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



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

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

.IsMouseDoubleClicked(button) ⇒ Object

arg: button(ImGuiMouseButton) ret: bool



3649
3650
3651
# File 'lib/imgui.rb', line 3649

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



3660
3661
3662
# File 'lib/imgui.rb', line 3660

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



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

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



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

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



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

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



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

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.


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

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.



4860
4861
4862
4863
4864
4865
4866
4867
4868
# File 'lib/imgui.rb', line 4860

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



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

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



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

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.



3715
3716
3717
# File 'lib/imgui.rb', line 3715

def self.IsWindowAppearing()
  igIsWindowAppearing()
end

.IsWindowCollapsedObject

ret: bool



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

def self.IsWindowCollapsed()
  igIsWindowCollapsed()
end

.IsWindowFocused(flags = 0) ⇒ Object

arg: flags(ImGuiFocusedFlags) ret: bool



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

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



3732
3733
3734
# File 'lib/imgui.rb', line 3732

def self.IsWindowHovered(flags = 0)  # is current window hovered (and typically: not blocked by a popup/modal)? see flags for options. NB: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that! Please read the FAQ!
  igIsWindowHovered(flags)
end

.LabelText(label, fmt, *varargs) ⇒ Object

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



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

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



4870
4871
4872
4873
4874
4875
4876
4877
4878
# File 'lib/imgui.rb', line 4870

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:items_getter(bool(*)(void* data,int idx,const char** out_text)), 3:data(void*), 4:items_count(int), 5:height_in_items(int)
  # ret: bool
  return igListBox_FnBoolPtr(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_FnBoolPtr(label, current_item, items_getter, data, items_count, height_in_items = -1)) ⇒ Object

arg: label(const char*), current_item(int*), items_getter(bool(*)(void* data,int idx,const char** out_text)), data(void*), items_count(int), height_in_items(int) ret: bool



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

def self.ListBox_FnBoolPtr(label, current_item, items_getter, data, items_count, height_in_items = -1)
  igListBox_FnBoolPtr(label, current_item, items_getter, 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



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

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



1903
1904
1905
1906
1907
# File 'lib/imgui.rb', line 1903

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



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

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



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

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



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

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

.LogFinishObject

ret: void



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

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

.LogText(fmt, *varargs) ⇒ Object

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



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

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



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

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



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

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.



3804
3805
3806
# File 'lib/imgui.rb', line 3804

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



3810
3811
3812
# File 'lib/imgui.rb', line 3810

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

.MemFree(ptr) ⇒ Object

arg: ptr(void*) ret: void



3816
3817
3818
# File 'lib/imgui.rb', line 3816

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

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



4880
4881
4882
4883
4884
4885
4886
4887
4888
# File 'lib/imgui.rb', line 4880

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



3822
3823
3824
# File 'lib/imgui.rb', line 3822

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



3828
3829
3830
# File 'lib/imgui.rb', line 3828

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

.NewFrameObject

ret: void



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

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



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

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

.NextColumnObject

ret: void



3843
3844
3845
# File 'lib/imgui.rb', line 3843

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


4899
4900
4901
4902
4903
4904
4905
4906
4907
# File 'lib/imgui.rb', line 4899

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



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

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



3849
3850
3851
# File 'lib/imgui.rb', line 3849

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



3861
3862
3863
# File 'lib/imgui.rb', line 3861

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)



4909
4910
4911
4912
4913
4914
4915
4916
4917
# File 'lib/imgui.rb', line 4909

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



3867
3868
3869
# File 'lib/imgui.rb', line 3867

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



3873
3874
3875
# File 'lib/imgui.rb', line 3873

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



4922
4923
4924
4925
4926
4927
4928
4929
4930
# File 'lib/imgui.rb', line 4922

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



3879
3880
3881
# File 'lib/imgui.rb', line 3879

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



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

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



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

def self.PopButtonRepeat()
  igPopButtonRepeat()
end

.PopClipRectObject

ret: void



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

def self.PopClipRect()
  igPopClipRect()
end

.PopFontObject

ret: void



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

def self.PopFont()
  igPopFont()
end

.PopIDObject

ret: void



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

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

.PopItemWidthObject

ret: void



3910
3911
3912
# File 'lib/imgui.rb', line 3910

def self.PopItemWidth()
  igPopItemWidth()
end

.PopStyleColor(count = 1) ⇒ Object

arg: count(int) ret: void



3916
3917
3918
# File 'lib/imgui.rb', line 3916

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

.PopStyleVar(count = 1) ⇒ Object

arg: count(int) ret: void



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

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

.PopTabStopObject

ret: void



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

def self.PopTabStop()
  igPopTabStop()
end

.PopTextWrapPosObject

ret: void



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

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



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

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



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

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.



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

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)



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

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.



4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
# File 'lib/imgui.rb', line 4944

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



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

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

.PushID_Ptr(ptr_id) ⇒ Object

arg: ptr_id(const void*) ret: void



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

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

.PushID_Str(str_id) ⇒ Object

arg: str_id(const char*) ret: void



3967
3968
3969
# File 'lib/imgui.rb', line 3967

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



3973
3974
3975
# File 'lib/imgui.rb', line 3973

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)



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

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



4960
4961
4962
4963
4964
4965
4966
4967
4968
# File 'lib/imgui.rb', line 4960

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



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

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

.PushStyleColor_Vec4(idx, col) ⇒ Object

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



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

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



4970
4971
4972
4973
4974
4975
4976
4977
4978
# File 'lib/imgui.rb', line 4970

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



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

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

.PushStyleVar_Vec2(idx, val) ⇒ Object

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



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

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

.PushTabStop(tab_stop) ⇒ Object

arg: tab_stop(bool) ret: void



4023
4024
4025
# File 'lib/imgui.rb', line 4023

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



4029
4030
4031
# File 'lib/imgui.rb', line 4029

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



4980
4981
4982
4983
4984
4985
4986
4987
4988
# File 'lib/imgui.rb', line 4980

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



4035
4036
4037
# File 'lib/imgui.rb', line 4035

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



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

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

.RenderObject

ret: void



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

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



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

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



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

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



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

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



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

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.



4994
4995
4996
4997
4998
4999
5000
5001
5002
# File 'lib/imgui.rb', line 4994

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



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

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



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

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

Cursor / Layout

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

    Window-local coordinates:   SameLine(), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), GetContentRegionMax(), GetWindowContentRegion*(), PushTextWrapPos()
    Absolute coordinate:        GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions.
    


4095
4096
4097
# File 'lib/imgui.rb', line 4095

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



4101
4102
4103
# File 'lib/imgui.rb', line 4101

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.



4112
4113
4114
# File 'lib/imgui.rb', line 4112

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



4118
4119
4120
# File 'lib/imgui.rb', line 4118

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

.SetColorEditOptions(flags) ⇒ Object

arg: flags(ImGuiColorEditFlags) ret: void



4124
4125
4126
# File 'lib/imgui.rb', line 4124

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



4130
4131
4132
# File 'lib/imgui.rb', line 4130

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



4136
4137
4138
# File 'lib/imgui.rb', line 4136

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



4142
4143
4144
# File 'lib/imgui.rb', line 4142

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

.SetCursorPos(local_pos) ⇒ Object

arg: local_pos(ImVec2) ret: void



4148
4149
4150
# File 'lib/imgui.rb', line 4148

def self.SetCursorPos(local_pos)  #    are using the main, absolute coordinate system.
  igSetCursorPos(local_pos)
end

.SetCursorPosX(local_x) ⇒ Object

arg: local_x(float) ret: void



4154
4155
4156
# File 'lib/imgui.rb', line 4154

def self.SetCursorPosX(local_x)  #    GetWindowPos() + GetCursorPos() == GetCursorScreenPos() etc.)
  igSetCursorPosX(local_x)
end

.SetCursorPosY(local_y) ⇒ Object

arg: local_y(float) ret: void



4160
4161
4162
# File 'lib/imgui.rb', line 4160

def self.SetCursorPosY(local_y)  #
  igSetCursorPosY(local_y)
end

.SetCursorScreenPos(pos) ⇒ Object

arg: pos(ImVec2) ret: void



4166
4167
4168
# File 'lib/imgui.rb', line 4166

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



4172
4173
4174
# File 'lib/imgui.rb', line 4172

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

.SetItemAllowOverlapObject

ret: void



4177
4178
4179
# File 'lib/imgui.rb', line 4177

def self.SetItemAllowOverlap()  # allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.
  igSetItemAllowOverlap()
end

.SetItemDefaultFocusObject

ret: void

Focus, Activation

  • Prefer using “SetItemDefaultFocus()” over “if (IsWindowAppearing()) SetScrollHereY()” when applicable to signify “this is the default item”



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

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

.SetKeyboardFocusHere(offset = 0) ⇒ Object

arg: offset(int) ret: void



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

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

.SetMouseCursor(cursor_type) ⇒ Object

arg: cursor_type(ImGuiMouseCursor) ret: void



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

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



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

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



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

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

.SetNextItemOpen(is_open, cond = 0) ⇒ Object

arg: is_open(bool), cond(ImGuiCond) ret: void



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



4271
4272
4273
# File 'lib/imgui.rb', line 4271

def self.SetNextWindowSizeConstraints(size_min, size_max, custom_callback = nil, custom_callback_data = nil)  # set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints.
  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



4277
4278
4279
# File 'lib/imgui.rb', line 4277

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



4283
4284
4285
# File 'lib/imgui.rb', line 4283

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



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

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



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

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



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

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

.SetScrollY(scroll_y) ⇒ Object

arg: scroll_y(float) ret: void



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

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

.SetStateStorage(storage) ⇒ Object

arg: storage(ImGuiStorage*) ret: void



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

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



4319
4320
4321
# File 'lib/imgui.rb', line 4319

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



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

def self.SetTooltip(fmt, *varargs)  # set a text-only tooltip, typically use with ImGui::IsItemHovered(). override any previous call to SetTooltip().
  igSetTooltip(fmt, *varargs)
end

.SetWindowCollapsed(*arg) ⇒ Object

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



5004
5005
5006
5007
5008
5009
5010
5011
5012
# File 'lib/imgui.rb', line 5004

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



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

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



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

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



5014
5015
5016
5017
5018
5019
5020
5021
5022
# File 'lib/imgui.rb', line 5014

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



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

def self.SetWindowFocus_Nil()
  igSetWindowFocus_Nil()
end

.SetWindowFocus_Str(name) ⇒ Object

arg: name(const char*) ret: void



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

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

.SetWindowFontScale(scale) ⇒ Object

arg: scale(float) ret: void



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

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.



5024
5025
5026
5027
5028
5029
5030
5031
5032
# File 'lib/imgui.rb', line 5024

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



4366
4367
4368
# File 'lib/imgui.rb', line 4366

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



4360
4361
4362
# File 'lib/imgui.rb', line 4360

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.



5034
5035
5036
5037
5038
5039
5040
5041
5042
# File 'lib/imgui.rb', line 5034

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



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

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



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

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

.ShowAboutWindow(p_open = nil) ⇒ Object

arg: p_open(bool*) ret: void



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

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



4390
4391
4392
# File 'lib/imgui.rb', line 4390

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



4398
4399
4400
# File 'lib/imgui.rb', line 4398

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



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

def self.ShowFontSelector(label)  # add font selector block (not a window), essentially a combo listing the loaded fonts.
  igShowFontSelector(label)
end

.ShowMetricsWindow(p_open = nil) ⇒ Object

arg: p_open(bool*) ret: void



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

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

.ShowStackToolWindow(p_open = nil) ⇒ Object

arg: p_open(bool*) ret: void



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

def self.ShowStackToolWindow(p_open = nil)  # create Stack Tool window. hover items with mouse to query information about the source of their unique ID.
  igShowStackToolWindow(p_open)
end

.ShowStyleEditor(ref = nil) ⇒ Object

arg: ref(ImGuiStyle*) ret: void



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

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



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

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

.ShowUserGuideObject

ret: void



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

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



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

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



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

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



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

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



4464
4465
4466
# File 'lib/imgui.rb', line 4464

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



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

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



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

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



4482
4483
4484
# File 'lib/imgui.rb', line 4482

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



4488
4489
4490
# File 'lib/imgui.rb', line 4488

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



4494
4495
4496
# File 'lib/imgui.rb', line 4494

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



4500
4501
4502
# File 'lib/imgui.rb', line 4500

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



4506
4507
4508
# File 'lib/imgui.rb', line 4506

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



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

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

.SpacingObject

ret: void



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

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

.StyleColorsClassic(dst = nil) ⇒ Object

arg: dst(ImGuiStyle*) ret: void



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

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

.StyleColorsDark(dst = nil) ⇒ Object

arg: dst(ImGuiStyle*) ret: void

Styles



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

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

.StyleColorsLight(dst = nil) ⇒ Object

arg: dst(ImGuiStyle*) ret: void



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

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



4543
4544
4545
# File 'lib/imgui.rb', line 4543

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

.TableGetColumnCountObject

ret: int



4548
4549
4550
# File 'lib/imgui.rb', line 4548

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

.TableGetColumnFlags(column_n = -1)) ⇒ Object

arg: column_n(int) ret: int



4554
4555
4556
# File 'lib/imgui.rb', line 4554

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



4559
4560
4561
# File 'lib/imgui.rb', line 4559

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

.TableGetColumnName(column_n = -1)) ⇒ Object

arg: column_n(int) ret: pointer



4565
4566
4567
# File 'lib/imgui.rb', line 4565

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



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

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.



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

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



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

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

.TableHeadersRowObject

ret: void



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

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

.TableNextColumnObject

ret: bool



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

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



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

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



4610
4611
4612
# File 'lib/imgui.rb', line 4610

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



4616
4617
4618
# File 'lib/imgui.rb', line 4616

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



4622
4623
4624
# File 'lib/imgui.rb', line 4622

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.



4637
4638
4639
# File 'lib/imgui.rb', line 4637

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



4643
4644
4645
# File 'lib/imgui.rb', line 4643

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



4649
4650
4651
# File 'lib/imgui.rb', line 4649

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

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

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



4655
4656
4657
# File 'lib/imgui.rb', line 4655

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



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

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



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

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



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

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.



5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
# File 'lib/imgui.rb', line 5047

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



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

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



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

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



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

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

.TreeNodeEx(*arg) ⇒ Object



5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
# File 'lib/imgui.rb', line 5060

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



4711
4712
4713
# File 'lib/imgui.rb', line 4711

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



4699
4700
4701
# File 'lib/imgui.rb', line 4699

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



4705
4706
4707
# File 'lib/imgui.rb', line 4705

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

.TreePopObject

ret: void



4716
4717
4718
# File 'lib/imgui.rb', line 4716

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.



5073
5074
5075
5076
5077
5078
5079
5080
5081
# File 'lib/imgui.rb', line 5073

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



4728
4729
4730
# File 'lib/imgui.rb', line 4728

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

.TreePush_Str(str_id) ⇒ Object

arg: str_id(const char*) ret: void



4722
4723
4724
# File 'lib/imgui.rb', line 4722

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

.Unindent(indent_w = 0.0) ⇒ Object

arg: indent_w(float) ret: void



4734
4735
4736
# File 'lib/imgui.rb', line 4734

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

.Value(*arg) ⇒ Object



5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
# File 'lib/imgui.rb', line 5083

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



4758
4759
4760
# File 'lib/imgui.rb', line 4758

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



4776
4777
4778
# File 'lib/imgui.rb', line 4776

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



4764
4765
4766
# File 'lib/imgui.rb', line 4764

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



4770
4771
4772
# File 'lib/imgui.rb', line 4770

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



4740
4741
4742
# File 'lib/imgui.rb', line 4740

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



4746
4747
4748
# File 'lib/imgui.rb', line 4746

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



4752
4753
4754
# File 'lib/imgui.rb', line 4752

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