From beadf6f2c98de7eee1e5f96c143699befb19a572 Mon Sep 17 00:00:00 2001 From: vaiorabbit Date: Sun, 14 Apr 2024 12:49:26 +0900 Subject: [PATCH] ImGui v1.90.5 --- imgui_dll/build_imgui_macos.sh | 2 +- lib/imgui.rb | 363 ++++----------------------------- 2 files changed, 46 insertions(+), 319 deletions(-) diff --git a/imgui_dll/build_imgui_macos.sh b/imgui_dll/build_imgui_macos.sh index 77806d6..0399db8 100755 --- a/imgui_dll/build_imgui_macos.sh +++ b/imgui_dll/build_imgui_macos.sh @@ -1,5 +1,5 @@ #!/bin/sh -export MACOSX_DEPLOYMENT_TARGET=13.0 +export CMAKE_OSX_DEPLOYMENT_TARGET=14.0 mkdir -p build_x86_64 cd build_x86_64 diff --git a/lib/imgui.rb b/lib/imgui.rb index 79c0bb1..f147b92 100644 --- a/lib/imgui.rb +++ b/lib/imgui.rb @@ -21,7 +21,6 @@ FFI.typedef :int, :ImGuiConfigFlags FFI.typedef :int, :ImGuiDataType FFI.typedef :int, :ImGuiDir -FFI.typedef :int, :ImGuiDockNodeFlags FFI.typedef :int, :ImGuiDragDropFlags FFI.typedef :int, :ImGuiFocusedFlags FFI.typedef :int, :ImGuiHoveredFlags @@ -97,14 +96,11 @@ # ImGuiBackendFlags_ # Backend capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom backend. -ImGuiBackendFlags_None = 0 # 0 -ImGuiBackendFlags_HasGamepad = 1 # 1 << 0 # Backend Platform supports gamepad and currently has one connected. -ImGuiBackendFlags_HasMouseCursors = 2 # 1 << 1 # Backend Platform supports honoring GetMouseCursor() value to change the OS cursor shape. -ImGuiBackendFlags_HasSetMousePos = 4 # 1 << 2 # Backend Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set). -ImGuiBackendFlags_RendererHasVtxOffset = 8 # 1 << 3 # Backend Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices. -ImGuiBackendFlags_PlatformHasViewports = 1024 # 1 << 10 # Backend Platform supports multiple viewports. -ImGuiBackendFlags_HasMouseHoveredViewport = 2048 # 1 << 11 # Backend Platform supports calling io.AddMouseViewportEvent() with the viewport under the mouse. IF POSSIBLE, ignore viewports with the ImGuiViewportFlags_NoInputs flag (Win32 backend, GLFW 3.30+ backend can do this, SDL backend cannot). If this cannot be done, Dear ImGui needs to use a flawed heuristic to find the viewport under. -ImGuiBackendFlags_RendererHasViewports = 4096 # 1 << 12 # Backend Renderer supports multiple viewports. +ImGuiBackendFlags_None = 0 # 0 +ImGuiBackendFlags_HasGamepad = 1 # 1 << 0 # Backend Platform supports gamepad and currently has one connected. +ImGuiBackendFlags_HasMouseCursors = 2 # 1 << 1 # Backend Platform supports honoring GetMouseCursor() value to change the OS cursor shape. +ImGuiBackendFlags_HasSetMousePos = 4 # 1 << 2 # Backend Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set). +ImGuiBackendFlags_RendererHasVtxOffset = 8 # 1 << 3 # Backend Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices. # ImGuiButtonFlags_ # Flags for InvisibleButton() [extended in imgui_internal.h] @@ -175,24 +171,22 @@ ImGuiCol_TabActive = 35 # 35 ImGuiCol_TabUnfocused = 36 # 36 ImGuiCol_TabUnfocusedActive = 37 # 37 -ImGuiCol_DockingPreview = 38 # 38 # Preview overlay color when about to docking something -ImGuiCol_DockingEmptyBg = 39 # 39 # Background color for empty node (e.g. CentralNode with no window docked into it) -ImGuiCol_PlotLines = 40 # 40 -ImGuiCol_PlotLinesHovered = 41 # 41 -ImGuiCol_PlotHistogram = 42 # 42 -ImGuiCol_PlotHistogramHovered = 43 # 43 -ImGuiCol_TableHeaderBg = 44 # 44 # Table header background -ImGuiCol_TableBorderStrong = 45 # 45 # Table outer and header borders (prefer using Alpha=1.0 here) -ImGuiCol_TableBorderLight = 46 # 46 # Table inner borders (prefer using Alpha=1.0 here) -ImGuiCol_TableRowBg = 47 # 47 # Table row background (even rows) -ImGuiCol_TableRowBgAlt = 48 # 48 # Table row background (odd rows) -ImGuiCol_TextSelectedBg = 49 # 49 -ImGuiCol_DragDropTarget = 50 # 50 # Rectangle highlighting a drop target -ImGuiCol_NavHighlight = 51 # 51 # Gamepad/keyboard: current highlighted item -ImGuiCol_NavWindowingHighlight = 52 # 52 # Highlight window when using CTRL+TAB -ImGuiCol_NavWindowingDimBg = 53 # 53 # Darken/colorize entire screen behind the CTRL+TAB window list, when active -ImGuiCol_ModalWindowDimBg = 54 # 54 # Darken/colorize entire screen behind a modal window, when one is active -ImGuiCol_COUNT = 55 # 55 +ImGuiCol_PlotLines = 38 # 38 +ImGuiCol_PlotLinesHovered = 39 # 39 +ImGuiCol_PlotHistogram = 40 # 40 +ImGuiCol_PlotHistogramHovered = 41 # 41 +ImGuiCol_TableHeaderBg = 42 # 42 # Table header background +ImGuiCol_TableBorderStrong = 43 # 43 # Table outer and header borders (prefer using Alpha=1.0 here) +ImGuiCol_TableBorderLight = 44 # 44 # Table inner borders (prefer using Alpha=1.0 here) +ImGuiCol_TableRowBg = 45 # 45 # Table row background (even rows) +ImGuiCol_TableRowBgAlt = 46 # 46 # Table row background (odd rows) +ImGuiCol_TextSelectedBg = 47 # 47 +ImGuiCol_DragDropTarget = 48 # 48 # Rectangle highlighting a drop target +ImGuiCol_NavHighlight = 49 # 49 # Gamepad/keyboard: current highlighted item +ImGuiCol_NavWindowingHighlight = 50 # 50 # Highlight window when using CTRL+TAB +ImGuiCol_NavWindowingDimBg = 51 # 51 # Darken/colorize entire screen behind the CTRL+TAB window list, when active +ImGuiCol_ModalWindowDimBg = 52 # 52 # Darken/colorize entire screen behind a modal window, when one is active +ImGuiCol_COUNT = 53 # 53 # ImGuiColorEditFlags_ # Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton() @@ -251,19 +245,15 @@ # ImGuiConfigFlags_ # Configuration flags stored in io.ConfigFlags. Set by user/application. -ImGuiConfigFlags_None = 0 # 0 -ImGuiConfigFlags_NavEnableKeyboard = 1 # 1 << 0 # Master keyboard navigation enable flag. Enable full Tabbing + directional arrows + space/enter to activate. -ImGuiConfigFlags_NavEnableGamepad = 2 # 1 << 1 # Master gamepad navigation enable flag. Backend also needs to set ImGuiBackendFlags_HasGamepad. -ImGuiConfigFlags_NavEnableSetMousePos = 4 # 1 << 2 # Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your backend, otherwise ImGui will react as if the mouse is jumping around back and forth. -ImGuiConfigFlags_NavNoCaptureKeyboard = 8 # 1 << 3 # Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set. -ImGuiConfigFlags_NoMouse = 16 # 1 << 4 # Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the backend. -ImGuiConfigFlags_NoMouseCursorChange = 32 # 1 << 5 # Instruct backend to not alter mouse cursor shape and visibility. Use if the backend cursor changes are interfering with yours and you don't want to use SetMouseCursor() to change mouse cursor. You may want to honor requests from imgui by reading GetMouseCursor() yourself instead. -ImGuiConfigFlags_DockingEnable = 64 # 1 << 6 # Docking enable flags. -ImGuiConfigFlags_ViewportsEnable = 1024 # 1 << 10 # Viewport enable flags (require both ImGuiBackendFlags_PlatformHasViewports + ImGuiBackendFlags_RendererHasViewports set by the respective backends) -ImGuiConfigFlags_DpiEnableScaleViewports = 16384 # 1 << 14 # [BETA: Don't use] FIXME-DPI: Reposition and resize imgui windows when the DpiScale of a viewport changed (mostly useful for the main viewport hosting other window). Note that resizing the main window itself is up to your application. -ImGuiConfigFlags_DpiEnableScaleFonts = 32768 # 1 << 15 # [BETA: Don't use] FIXME-DPI: Request bitmap-scaled fonts to match DpiScale. This is a very low-quality workaround. The correct way to handle DPI is _currently_ to replace the atlas and/or fonts in the Platform_OnChangedViewport callback, but this is all early work in progress. -ImGuiConfigFlags_IsSRGB = 1048576 # 1 << 20 # Application is SRGB-aware. -ImGuiConfigFlags_IsTouchScreen = 2097152 # 1 << 21 # Application is using a touch screen instead of a mouse. +ImGuiConfigFlags_None = 0 # 0 +ImGuiConfigFlags_NavEnableKeyboard = 1 # 1 << 0 # Master keyboard navigation enable flag. Enable full Tabbing + directional arrows + space/enter to activate. +ImGuiConfigFlags_NavEnableGamepad = 2 # 1 << 1 # Master gamepad navigation enable flag. Backend also needs to set ImGuiBackendFlags_HasGamepad. +ImGuiConfigFlags_NavEnableSetMousePos = 4 # 1 << 2 # Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your backend, otherwise ImGui will react as if the mouse is jumping around back and forth. +ImGuiConfigFlags_NavNoCaptureKeyboard = 8 # 1 << 3 # Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set. +ImGuiConfigFlags_NoMouse = 16 # 1 << 4 # Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the backend. +ImGuiConfigFlags_NoMouseCursorChange = 32 # 1 << 5 # Instruct backend to not alter mouse cursor shape and visibility. Use if the backend cursor changes are interfering with yours and you don't want to use SetMouseCursor() to change mouse cursor. You may want to honor requests from imgui by reading GetMouseCursor() yourself instead. +ImGuiConfigFlags_IsSRGB = 1048576 # 1 << 20 # Application is SRGB-aware. +ImGuiConfigFlags_IsTouchScreen = 2097152 # 1 << 21 # Application is using a touch screen instead of a mouse. # ImGuiDataType_ # A primary data type @@ -288,19 +278,6 @@ ImGuiDir_Down = 3 # 3 ImGuiDir_COUNT = 4 # 4 -# ImGuiDockNodeFlags_ -# Flags for ImGui::DockSpace(), shared/inherited by child nodes. -# (Some flags can be applied to individual nodes directly) -# FIXME-DOCK: Also see ImGuiDockNodeFlagsPrivate_ which may involve using the WIP and internal DockBuilder api. -ImGuiDockNodeFlags_None = 0 # 0 -ImGuiDockNodeFlags_KeepAliveOnly = 1 # 1 << 0 # // Don't display the dockspace node but keep it alive. Windows docked into this dockspace node won't be undocked. -ImGuiDockNodeFlags_NoDockingOverCentralNode = 4 # 1 << 2 # // Disable docking over the Central Node, which will be always kept empty. -ImGuiDockNodeFlags_PassthruCentralNode = 8 # 1 << 3 # // Enable passthru dockspace: 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2) When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background. See demo for details. -ImGuiDockNodeFlags_NoDockingSplit = 16 # 1 << 4 # // Disable other windows/nodes from splitting this node. -ImGuiDockNodeFlags_NoResize = 32 # 1 << 5 # Saved // Disable resizing node using the splitter/separators. Useful with programmatically setup dockspaces. -ImGuiDockNodeFlags_AutoHideTabBar = 64 # 1 << 6 # // Tab bar will automatically hide when there is a single window in the dock node. -ImGuiDockNodeFlags_NoUndocking = 128 # 1 << 7 # // Disable undocking this node. - # ImGuiDragDropFlags_ # Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload() ImGuiDragDropFlags_None = 0 # 0 @@ -322,7 +299,6 @@ ImGuiFocusedFlags_RootWindow = 2 # 1 << 1 # Test from root window (top most parent of the current hierarchy) ImGuiFocusedFlags_AnyWindow = 4 # 1 << 2 # Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ! ImGuiFocusedFlags_NoPopupHierarchy = 8 # 1 << 3 # Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow) -ImGuiFocusedFlags_DockHierarchy = 16 # 1 << 4 # Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow) ImGuiFocusedFlags_RootAndChildWindows = 3 # ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows # ImGuiHoveredFlags_ @@ -334,7 +310,6 @@ ImGuiHoveredFlags_RootWindow = 2 # 1 << 1 # IsWindowHovered() only: Test from root window (top most parent of the current hierarchy) ImGuiHoveredFlags_AnyWindow = 4 # 1 << 2 # IsWindowHovered() only: Return true if any window is hovered ImGuiHoveredFlags_NoPopupHierarchy = 8 # 1 << 3 # IsWindowHovered() only: Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow) -ImGuiHoveredFlags_DockHierarchy = 16 # 1 << 4 # IsWindowHovered() only: Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow) ImGuiHoveredFlags_AllowWhenBlockedByPopup = 32 # 1 << 5 # Return true even if a popup window is normally blocking access to this item/window ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 128 # 1 << 7 # Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. ImGuiHoveredFlags_AllowWhenOverlappedByItem = 256 # 1 << 8 # IsItemHovered() only: Return true even if the item uses AllowOverlap mode and is overlapped by another hoverable item. @@ -674,8 +649,7 @@ ImGuiStyleVar_SeparatorTextBorderSize = 28 # 28 # float SeparatorTextBorderSize ImGuiStyleVar_SeparatorTextAlign = 29 # 29 # ImVec2 SeparatorTextAlign ImGuiStyleVar_SeparatorTextPadding = 30 # 30 # ImVec2 SeparatorTextPadding -ImGuiStyleVar_DockingSeparatorSize = 31 # 31 # float DockingSeparatorSize -ImGuiStyleVar_COUNT = 32 # 32 +ImGuiStyleVar_COUNT = 31 # 31 # ImGuiTabBarFlags_ # Flags for ImGui::BeginTabBar() @@ -838,21 +812,10 @@ # ImGuiViewportFlags_ # Flags stored in ImGuiViewport::Flags, giving indications to the platform backends. -ImGuiViewportFlags_None = 0 # 0 -ImGuiViewportFlags_IsPlatformWindow = 1 # 1 << 0 # Represent a Platform Window -ImGuiViewportFlags_IsPlatformMonitor = 2 # 1 << 1 # Represent a Platform Monitor (unused yet) -ImGuiViewportFlags_OwnedByApp = 4 # 1 << 2 # Platform Window: Was created/managed by the user application? (rather than our backend) -ImGuiViewportFlags_NoDecoration = 8 # 1 << 3 # Platform Window: Disable platform decorations: title bar, borders, etc. (generally set all windows, but if ImGuiConfigFlags_ViewportsDecoration is set we only set this on popups/tooltips) -ImGuiViewportFlags_NoTaskBarIcon = 16 # 1 << 4 # Platform Window: Disable platform task bar icon (generally set on popups/tooltips, or all windows if ImGuiConfigFlags_ViewportsNoTaskBarIcon is set) -ImGuiViewportFlags_NoFocusOnAppearing = 32 # 1 << 5 # Platform Window: Don't take focus when created. -ImGuiViewportFlags_NoFocusOnClick = 64 # 1 << 6 # Platform Window: Don't take focus when clicked on. -ImGuiViewportFlags_NoInputs = 128 # 1 << 7 # Platform Window: Make mouse pass through so we can drag this window while peaking behind it. -ImGuiViewportFlags_NoRendererClear = 256 # 1 << 8 # Platform Window: Renderer doesn't need to clear the framebuffer ahead (because we will fill it entirely). -ImGuiViewportFlags_NoAutoMerge = 512 # 1 << 9 # Platform Window: Avoid merging this window into another host window. This can only be set via ImGuiWindowClass viewport flags override (because we need to now ahead if we are going to create a viewport in the first place!). -ImGuiViewportFlags_TopMost = 1024 # 1 << 10 # Platform Window: Display on top (for tooltips only). -ImGuiViewportFlags_CanHostOtherWindows = 2048 # 1 << 11 # Viewport can host multiple imgui windows (secondary viewports are associated to a single window). // FIXME: In practice there's still probably code making the assumption that this is always and only on the MainViewport. Will fix once we add support for "no main viewport". -ImGuiViewportFlags_IsMinimized = 4096 # 1 << 12 # Platform Window: Window is minimized, can skip render. When minimized we tend to avoid using the viewport pos/size for clipping window or testing if they are contained in the viewport. -ImGuiViewportFlags_IsFocused = 8192 # 1 << 13 # Platform Window: Window is focused (last call to Platform_GetWindowFocus() returned true) +ImGuiViewportFlags_None = 0 # 0 +ImGuiViewportFlags_IsPlatformWindow = 1 # 1 << 0 # Represent a Platform Window +ImGuiViewportFlags_IsPlatformMonitor = 2 # 1 << 1 # Represent a Platform Monitor (unused yet) +ImGuiViewportFlags_OwnedByApp = 4 # 1 << 2 # Platform Window: Was created/managed by the user application? (rather than our backend) # ImGuiWindowFlags_ # Flags for ImGui::Begin() @@ -877,7 +840,6 @@ ImGuiWindowFlags_NoNavInputs = 65536 # 1 << 16 # No gamepad/keyboard navigation within the window ImGuiWindowFlags_NoNavFocus = 131072 # 1 << 17 # No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB) ImGuiWindowFlags_UnsavedDocument = 262144 # 1 << 18 # Display a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar. -ImGuiWindowFlags_NoDocking = 524288 # 1 << 19 # Disable docking of this window ImGuiWindowFlags_NoNav = 196608 # ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus ImGuiWindowFlags_NoDecoration = 43 # ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse ImGuiWindowFlags_NoInputs = 197120 # ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus @@ -887,7 +849,6 @@ ImGuiWindowFlags_Popup = 67108864 # 1 << 26 # Don't use! For internal use by BeginPopup() ImGuiWindowFlags_Modal = 134217728 # 1 << 27 # Don't use! For internal use by BeginPopupModal() ImGuiWindowFlags_ChildMenu = 268435456 # 1 << 28 # Don't use! For internal use by BeginMenu() -ImGuiWindowFlags_DockNodeHost = 536870912 # 1 << 29 # Don't use! For internal use by Begin()/NewFrame() class ImVec2 < FFI::Struct @@ -1506,17 +1467,7 @@ class ImGuiViewport < FFI::Struct :Size, ImVec2.by_value, :WorkPos, ImVec2.by_value, :WorkSize, ImVec2.by_value, - :DpiScale, :float, - :ParentViewportId, :uint, - :DrawData, ImDrawData.ptr, - :RendererUserData, :pointer, - :PlatformUserData, :pointer, - :PlatformHandle, :pointer, - :PlatformHandleRaw, :pointer, - :PlatformWindowCreated, :bool, - :PlatformRequestMove, :bool, - :PlatformRequestResize, :bool, - :PlatformRequestClose, :bool + :PlatformHandleRaw, :pointer ) def GetCenter() @@ -1835,14 +1786,6 @@ class ImGuiIO < FFI::Struct :FontAllowUserScaling, :bool, :FontDefault, ImFont.ptr, :DisplayFramebufferScale, ImVec2.by_value, - :ConfigDockingNoSplit, :bool, - :ConfigDockingWithShift, :bool, - :ConfigDockingAlwaysTabBar, :bool, - :ConfigDockingTransparentPayload, :bool, - :ConfigViewportsNoAutoMerge, :bool, - :ConfigViewportsNoTaskBarIcon, :bool, - :ConfigViewportsNoDecoration, :bool, - :ConfigViewportsNoDefaultParent, :bool, :MouseDrawCursor, :bool, :ConfigMacOSXBehaviors, :bool, :ConfigInputTrickleEventQueue, :bool, @@ -1891,7 +1834,6 @@ class ImGuiIO < FFI::Struct :MouseWheel, :float, :MouseWheelH, :float, :MouseSource, :int, - :MouseHoveredViewport, :uint, :KeyCtrl, :bool, :KeyShift, :bool, :KeyAlt, :bool, @@ -1912,7 +1854,6 @@ class ImGuiIO < FFI::Struct :MouseWheelRequestAxisSwap, :bool, :MouseDownDuration, [:float, 5], :MouseDownDurationPrev, [:float, 5], - :MouseDragMaxDistanceAbs, [ImVec2.by_value, 5], :MouseDragMaxDistanceSqr, [:float, 5], :PenPressure, :float, :AppFocusLost, :bool, @@ -1959,10 +1900,6 @@ def AddMouseSourceEvent(source) ImGui::ImGuiIO_AddMouseSourceEvent(self, source) end - def AddMouseViewportEvent(id) - ImGui::ImGuiIO_AddMouseViewportEvent(self, id) - end - def AddMouseWheelEvent(wheel_x, wheel_y) ImGui::ImGuiIO_AddMouseWheelEvent(self, wheel_x, wheel_y) end @@ -2167,28 +2104,6 @@ def destroy() end -# (Optional) This is required when enabling multi-viewport. Represent the bounds of each connected monitor/display and their DPI. -# We use this information for multiple DPI support + clamping the position of popups and tooltips so they don't straddle multiple monitors. -class ImGuiPlatformMonitor < FFI::Struct - layout( - :MainPos, ImVec2.by_value, - :MainSize, ImVec2.by_value, - :WorkPos, ImVec2.by_value, - :WorkSize, ImVec2.by_value, - :DpiScale, :float, - :PlatformHandle, :pointer - ) - - def self.create() - return ImGuiPlatformMonitor.new(ImGui::ImGuiPlatformMonitor_ImGuiPlatformMonitor()) - end - - def destroy() - ImGui::ImGuiPlatformMonitor_destroy(self) - end - -end - # Resizing callback data to apply custom constraint. As enabled by SetNextWindowSizeConstraints(). Callback is called during the next Begin(). # NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough. class ImGuiSizeCallbackData < FFI::Struct @@ -2316,14 +2231,13 @@ class ImGuiStyle < FFI::Struct :SeparatorTextPadding, ImVec2.by_value, :DisplayWindowPadding, ImVec2.by_value, :DisplaySafeAreaPadding, ImVec2.by_value, - :DockingSeparatorSize, :float, :MouseCursorScale, :float, :AntiAliasedLines, :bool, :AntiAliasedLinesUseTex, :bool, :AntiAliasedFill, :bool, :CurveTessellationTol, :float, :CircleTessellationMaxError, :float, - :Colors, [ImVec4.by_value, 55], + :Colors, [ImVec4.by_value, 53], :HoverStationaryDelay, :float, :HoverDelayShort, :float, :HoverDelayNormal, :float, @@ -2504,36 +2418,6 @@ def split(separator, out) end -# [ALPHA] Rarely used / very advanced uses only. Use with SetNextWindowClass() and DockSpace() functions. -# Important: the content of this class is still highly WIP and likely to change and be refactored -# before we stabilize Docking features. Please be mindful if using this. -# Provide hints: -# - To the platform backend via altered viewport flags (enable/disable OS decoration, OS task bar icons, etc.) -# - To the platform backend for OS level parent/child relationships of viewport. -# - To the docking system for various options and filtering. -class ImGuiWindowClass < FFI::Struct - layout( - :ClassId, :uint, - :ParentViewportId, :uint, - :FocusRouteParentWindowId, :uint, - :ViewportFlagsOverrideSet, :int, - :ViewportFlagsOverrideClear, :int, - :TabItemFlagsOverrideSet, :int, - :DockNodeFlagsOverrideSet, :int, - :DockingAlwaysTabBar, :bool, - :DockingAllowUnclassed, :bool - ) - - def self.create() - return ImGuiWindowClass.new(ImGui::ImGuiWindowClass_ImGuiWindowClass()) - end - - def destroy() - ImGui::ImGuiWindowClass_destroy(self) - end - -end - class ImGuiStoragePair < FFI::Struct layout( :key, :uint, @@ -2764,7 +2648,6 @@ def self.import_symbols(output_error = false) [:ImGuiIO_AddMouseButtonEvent, [:pointer, :int, :bool], :void], [:ImGuiIO_AddMousePosEvent, [:pointer, :float, :float], :void], [:ImGuiIO_AddMouseSourceEvent, [:pointer, :int], :void], - [:ImGuiIO_AddMouseViewportEvent, [:pointer, :uint], :void], [:ImGuiIO_AddMouseWheelEvent, [:pointer, :float, :float], :void], [:ImGuiIO_ClearEventsQueue, [:pointer], :void], [:ImGuiIO_ClearInputKeys, [:pointer], :void], @@ -2794,12 +2677,8 @@ def self.import_symbols(output_error = false) [:ImGuiPayload_IsDelivery, [:pointer], :bool], [:ImGuiPayload_IsPreview, [:pointer], :bool], [:ImGuiPayload_destroy, [:pointer], :void], - [:ImGuiPlatformIO_ImGuiPlatformIO, [], :pointer], - [:ImGuiPlatformIO_destroy, [:pointer], :void], [:ImGuiPlatformImeData_ImGuiPlatformImeData, [], :pointer], [:ImGuiPlatformImeData_destroy, [:pointer], :void], - [:ImGuiPlatformMonitor_ImGuiPlatformMonitor, [], :pointer], - [:ImGuiPlatformMonitor_destroy, [:pointer], :void], [:ImGuiStoragePair_ImGuiStoragePair_Int, [:uint, :int], :pointer], [:ImGuiStoragePair_ImGuiStoragePair_Float, [:uint, :float], :pointer], [:ImGuiStoragePair_ImGuiStoragePair_Ptr, [:uint, :pointer], :pointer], @@ -2853,8 +2732,6 @@ def self.import_symbols(output_error = false) [:ImGuiViewport_GetWorkCenter, [:pointer, :pointer], :void], [:ImGuiViewport_ImGuiViewport, [], :pointer], [:ImGuiViewport_destroy, [:pointer], :void], - [:ImGuiWindowClass_ImGuiWindowClass, [], :pointer], - [:ImGuiWindowClass_destroy, [:pointer], :void], [:igAcceptDragDropPayload, [:pointer, :int], :pointer], [:igAlignTextToFramePadding, [], :void], [:igArrowButton, [:pointer, :int], :bool], @@ -2910,9 +2787,6 @@ def self.import_symbols(output_error = false) [:igDebugStartItemPicker, [], :void], [:igDebugTextEncoding, [:pointer], :void], [:igDestroyContext, [:pointer], :void], - [:igDestroyPlatformWindows, [], :void], - [:igDockSpace, [:uint, ImVec2.by_value, :int, :pointer], :uint], - [:igDockSpaceOverViewport, [:pointer, :int, :pointer], :uint], [: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], @@ -2943,11 +2817,8 @@ def self.import_symbols(output_error = false) [:igEndTabItem, [], :void], [:igEndTable, [], :void], [:igEndTooltip, [], :void], - [:igFindViewportByID, [:uint], :pointer], - [:igFindViewportByPlatformHandle, [:pointer], :pointer], [:igGetAllocatorFunctions, [:pointer, :pointer, :pointer], :void], - [:igGetBackgroundDrawList_Nil, [], :pointer], - [:igGetBackgroundDrawList_ViewportPtr, [:pointer], :pointer], + [:igGetBackgroundDrawList, [], :pointer], [:igGetClipboardText, [], :pointer], [:igGetColorU32_Col, [:int, :float], :uint], [:igGetColorU32_Vec4, [ImVec4.by_value], :uint], @@ -2970,8 +2841,7 @@ def self.import_symbols(output_error = false) [:igGetFont, [], :pointer], [:igGetFontSize, [], :float], [:igGetFontTexUvWhitePixel, [:pointer], :void], - [:igGetForegroundDrawList_Nil, [], :pointer], - [:igGetForegroundDrawList_ViewportPtr, [:pointer], :pointer], + [:igGetForegroundDrawList, [], :pointer], [:igGetFrameCount, [], :int], [:igGetFrameHeight, [], :float], [:igGetFrameHeightWithSpacing, [], :float], @@ -2991,7 +2861,6 @@ def self.import_symbols(output_error = false) [:igGetMouseDragDelta, [:pointer, :int, :float], :void], [:igGetMousePos, [:pointer], :void], [:igGetMousePosOnOpeningCurrentPopup, [:pointer], :void], - [:igGetPlatformIO, [], :pointer], [:igGetScrollMaxX, [], :float], [:igGetScrollMaxY, [], :float], [:igGetScrollX, [], :float], @@ -3007,13 +2876,10 @@ def self.import_symbols(output_error = false) [:igGetVersion, [], :pointer], [:igGetWindowContentRegionMax, [:pointer], :void], [:igGetWindowContentRegionMin, [:pointer], :void], - [:igGetWindowDockID, [], :uint], - [:igGetWindowDpiScale, [], :float], [:igGetWindowDrawList, [], :pointer], [:igGetWindowHeight, [], :float], [:igGetWindowPos, [:pointer], :void], [:igGetWindowSize, [:pointer], :void], - [:igGetWindowViewport, [], :pointer], [: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], @@ -3063,7 +2929,6 @@ def self.import_symbols(output_error = false) [:igIsRectVisible_Vec2, [ImVec2.by_value, ImVec2.by_value], :bool], [:igIsWindowAppearing, [], :bool], [:igIsWindowCollapsed, [], :bool], - [:igIsWindowDocked, [], :bool], [:igIsWindowFocused, [:int], :bool], [:igIsWindowHovered, [:int], :bool], [:igLabelText, [:pointer, :pointer, :varargs], :void], @@ -3118,7 +2983,6 @@ def self.import_symbols(output_error = false) [:igRadioButton_Bool, [:pointer, :bool], :bool], [:igRadioButton_IntPtr, [:pointer, :pointer, :int], :bool], [:igRender, [], :void], - [:igRenderPlatformWindowsDefault, [:pointer, :pointer], :void], [:igResetMouseDragDelta, [:int], :void], [:igSameLine, [:float, :float], :void], [:igSaveIniSettingsToDisk, [:pointer], :void], @@ -3148,16 +3012,13 @@ def self.import_symbols(output_error = false) [:igSetNextItemOpen, [:bool, :int], :void], [:igSetNextItemWidth, [:float], :void], [:igSetNextWindowBgAlpha, [:float], :void], - [:igSetNextWindowClass, [:pointer], :void], [:igSetNextWindowCollapsed, [:bool, :int], :void], [:igSetNextWindowContentSize, [ImVec2.by_value], :void], - [:igSetNextWindowDockID, [:uint, :int], :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], - [:igSetNextWindowViewport, [:uint], :void], [:igSetScrollFromPosX, [:float, :float], :void], [:igSetScrollFromPosY, [:float, :float], :void], [:igSetScrollHereX, [:float], :void], @@ -3233,7 +3094,6 @@ def self.import_symbols(output_error = false) [:igTreePush_Str, [:pointer], :void], [:igTreePush_Ptr, [:pointer], :void], [:igUnindent, [:float], :void], - [:igUpdatePlatformWindows, [], :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], @@ -3694,37 +3554,6 @@ def self.DestroyContext(ctx = nil) # NULL = destroy current context igDestroyContext(ctx) end - # ret: void - def self.DestroyPlatformWindows() # call DestroyWindow platform functions for all viewports. call from backend Shutdown() if you need to close platform windows before imgui shutdown. otherwise will be called by DestroyContext(). - igDestroyPlatformWindows() - end - - # arg: id(ImGuiID), size(ImVec2), flags(ImGuiDockNodeFlags), window_class(const ImGuiWindowClass*) - # ret: uint - # - # Docking - # [BETA API] Enable with io.ConfigFlags |= ImGuiConfigFlags_DockingEnable. - # Note: You can use most Docking facilities without calling any API. You DO NOT need to call DockSpace() to use Docking! - # - Drag from window title bar or their tab to dock/undock. Hold SHIFT to disable docking. - # - Drag from window menu button (upper-left button) to undock an entire node (all windows). - # - When io.ConfigDockingWithShift == true, you instead need to hold SHIFT to enable docking. - # About dockspaces: - # - Use DockSpaceOverViewport() to create an explicit dock node covering the screen or a specific viewport. - # This is often used with ImGuiDockNodeFlags_PassthruCentralNode to make it transparent. - # - Use DockSpace() to create an explicit dock node _within_ an existing window. See Docking demo for details. - # - Important: Dockspaces need to be submitted _before_ any window they can host. Submit it early in your frame! - # - Important: Dockspaces need to be kept alive if hidden, otherwise windows docked into it will be undocked. - # e.g. if you have multiple tabs with a dockspace inside each tab: submit the non-visible dockspaces with ImGuiDockNodeFlags_KeepAliveOnly. - def self.DockSpace(id, size = ImVec2.create(0,0), flags = 0, window_class = nil) # Implied size = ImVec2(0, 0), flags = 0, window_class = NULL - igDockSpace(id, size, flags, window_class) - end - - # arg: viewport(const ImGuiViewport*), flags(ImGuiDockNodeFlags), window_class(const ImGuiWindowClass*) - # ret: uint - def self.DockSpaceOverViewport(viewport = nil, flags = 0, window_class = nil) # Implied viewport = NULL, flags = 0, window_class = NULL - igDockSpaceOverViewport(viewport, flags, window_class) - end - # arg: label(const char*), v(float*), v_speed(float), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) # ret: bool # @@ -3901,18 +3730,6 @@ def self.EndTooltip() # only call EndTooltip() if BeginTooltip()/BeginItemToolt igEndTooltip() end - # arg: id(ImGuiID) - # ret: pointer - def self.FindViewportByID(id) # this is a helper for backends. - igFindViewportByID(id) - end - - # arg: platform_handle(void*) - # ret: pointer - def self.FindViewportByPlatformHandle(platform_handle) # this is a helper for backends. the type platform_handle is decided by the backend (e.g. HWND, MyWindow*, GLFWwindow* etc.) - igFindViewportByPlatformHandle(platform_handle) - end - # arg: p_alloc_func(ImGuiMemAllocFunc*), p_free_func(ImGuiMemFreeFunc*), p_user_data(void**) # ret: void def self.GetAllocatorFunctions(p_alloc_func, p_free_func, p_user_data) @@ -3920,14 +3737,10 @@ def self.GetAllocatorFunctions(p_alloc_func, p_free_func, p_user_data) end # ret: pointer - def self.GetBackgroundDrawList_Nil() - igGetBackgroundDrawList_Nil() - end - - # arg: viewport(ImGuiViewport*) - # ret: pointer - def self.GetBackgroundDrawList_ViewportPtr(viewport) - igGetBackgroundDrawList_ViewportPtr(viewport) + # + # Background/Foreground Draw Lists + def self.GetBackgroundDrawList() # get background draw list for the viewport associated to the current window. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents. + igGetBackgroundDrawList() end # ret: pointer @@ -4077,14 +3890,8 @@ def self.GetFontTexUvWhitePixel() # get UV coordinate for a while pixel, useful end # ret: pointer - def self.GetForegroundDrawList_Nil() - igGetForegroundDrawList_Nil() - end - - # arg: viewport(ImGuiViewport*) - # ret: pointer - def self.GetForegroundDrawList_ViewportPtr(viewport) - igGetForegroundDrawList_ViewportPtr(viewport) + def self.GetForegroundDrawList() # get foreground draw list for the viewport associated to the current window. this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents. + igGetForegroundDrawList() end # ret: int @@ -4208,15 +4015,6 @@ def self.GetMousePosOnOpeningCurrentPopup() # retrieve mouse position at the ti return pOut end - # ret: pointer - # - # (Optional) Platform/OS interface for multi-viewport support - # Read comments around the ImGuiPlatformIO structure for more details. - # Note: You may use GetWindowViewport() to get the current viewport of the current window. - def self.GetPlatformIO() # platform/renderer functions, for backend to setup + viewports list. - igGetPlatformIO() - end - # ret: float def self.GetScrollMaxX() # get maximum scrolling amount ~~ ContentSize.x - WindowSize.x - DecorationsSize.x igGetScrollMaxX() @@ -4302,16 +4100,6 @@ def self.GetWindowContentRegionMin() # content boundaries min for the full wind return pOut end - # ret: uint - def self.GetWindowDockID() - igGetWindowDockID() - end - - # ret: float - def self.GetWindowDpiScale() # get DPI scale currently associated to the current window's viewport. - igGetWindowDpiScale() - end - # ret: pointer def self.GetWindowDrawList() # get draw list associated to the current window, to append your own drawing primitives igGetWindowDrawList() @@ -4336,11 +4124,6 @@ def self.GetWindowSize() # get current window size (note: it is unlikely you ne return pOut end - # ret: pointer - def self.GetWindowViewport() # get viewport currently associated to the current window. - igGetWindowViewport() - end - # ret: float def self.GetWindowWidth() # get current window width (shortcut for GetWindowSize().x) igGetWindowWidth() @@ -4652,11 +4435,6 @@ def self.IsWindowCollapsed() igIsWindowCollapsed() end - # ret: bool - def self.IsWindowDocked() # is current window docked into another window? - igIsWindowDocked() - end - # arg: flags(ImGuiFocusedFlags) # ret: bool def self.IsWindowFocused(flags = 0) # is current window focused? or its root/child, depending on flags. see flags for options. @@ -4983,12 +4761,6 @@ def self.Render() # ends the Dear ImGui frame, finalize the draw data. You can igRender() end - # arg: platform_render_arg(void*), renderer_render_arg(void*) - # ret: void - def self.RenderPlatformWindowsDefault(platform_render_arg = nil, renderer_render_arg = nil) # Implied platform_render_arg = NULL, renderer_render_arg = NULL - igRenderPlatformWindowsDefault(platform_render_arg, renderer_render_arg) - end - # arg: button(ImGuiMouseButton) # ret: void def self.ResetMouseDragDelta(button = 0) # Implied button = 0 @@ -5172,12 +4944,6 @@ def self.SetNextWindowBgAlpha(alpha) # set next window background color alpha. igSetNextWindowBgAlpha(alpha) end - # arg: window_class(const ImGuiWindowClass*) - # ret: void - def self.SetNextWindowClass(window_class) # set next window class (control docking compatibility + provide hints to platform backend via custom viewport flags and platform parent/child relationship) - igSetNextWindowClass(window_class) - end - # arg: collapsed(bool), cond(ImGuiCond) # ret: void def self.SetNextWindowCollapsed(collapsed, cond = 0) # set next window collapsed state. call before Begin() @@ -5190,12 +4956,6 @@ def self.SetNextWindowContentSize(size) # set next window content size (~ scrol igSetNextWindowContentSize(size) end - # arg: dock_id(ImGuiID), cond(ImGuiCond) - # ret: void - def self.SetNextWindowDockID(dock_id, cond = 0) # set next window dock id - igSetNextWindowDockID(dock_id, cond) - end - # ret: void def self.SetNextWindowFocus() # set next window to be focused / top-most. call before Begin() igSetNextWindowFocus() @@ -5228,12 +4988,6 @@ def self.SetNextWindowSizeConstraints(size_min, size_max, custom_callback = nil, igSetNextWindowSizeConstraints(size_min, size_max, custom_callback, custom_callback_data) end - # arg: viewport_id(ImGuiID) - # ret: void - def self.SetNextWindowViewport(viewport_id) # set next window viewport - igSetNextWindowViewport(viewport_id) - end - # arg: local_x(float), center_x_ratio(float) # ret: void 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. @@ -5702,11 +5456,6 @@ def self.Unindent(indent_w = 0.0) # Implied indent_w = 0.0f igUnindent(indent_w) end - # ret: void - def self.UpdatePlatformWindows() # call in main loop. will call CreateWindow/ResizeWindow/etc. platform functions for each secondary viewport, and DestroyWindow for each inactive viewport. - igUpdatePlatformWindows() - end - # arg: label(const char*), size(ImVec2), v(float*), v_min(float), v_max(float), format(const char*), flags(ImGuiSliderFlags) # ret: bool def self.VSliderFloat(label, size, v, v_min, v_max, format = "%.3f", flags = 0) # Implied format = "%.3f", flags = 0 @@ -5813,18 +5562,6 @@ def self.Combo(*arg) # Implied popup_max_height_in_items = -1 $stderr.puts("[Warning] Combo : No matching functions found (#{arg})") end - # - # Background/Foreground Draw Lists - def self.GetBackgroundDrawList(*arg) # get background draw list for the viewport associated to the current window. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents. - # arg: - # ret: pointer - return igGetBackgroundDrawList_Nil() if arg.length == 0 && () - # arg: 0:viewport(ImGuiViewport*) - # ret: pointer - return igGetBackgroundDrawList_ViewportPtr(arg[0]) if arg.length == 1 && (arg[0].kind_of?(FFI::Pointer)) - $stderr.puts("[Warning] GetBackgroundDrawList : No matching functions found (#{arg})") - end - def self.GetColorU32(*arg) # Implied alpha_mul = 1.0f # arg: 0:idx(ImGuiCol), 1:alpha_mul(float) # ret: uint @@ -5838,16 +5575,6 @@ def self.GetColorU32(*arg) # Implied alpha_mul = 1.0f $stderr.puts("[Warning] GetColorU32 : No matching functions found (#{arg})") end - def self.GetForegroundDrawList(*arg) # get foreground draw list for the viewport associated to the current window. this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents. - # arg: - # ret: pointer - return igGetForegroundDrawList_Nil() if arg.length == 0 && () - # arg: 0:viewport(ImGuiViewport*) - # ret: pointer - return igGetForegroundDrawList_ViewportPtr(arg[0]) if arg.length == 1 && (arg[0].kind_of?(FFI::Pointer)) - $stderr.puts("[Warning] GetForegroundDrawList : No matching functions found (#{arg})") - end - 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