v1.89
版本发布时间: 2022-11-15 22:54:46
ocornut/imgui最新发布版本:v1.91.3(2024-10-04 21:48:34)
1.89: Autumn release!
Reading the changelog is a good way to keep up to date with the things Dear ImGui has to offer, and maybe will give you ideas of some features that you've been ignoring until now!
Homepage: https://github.com/ocornut/imgui Release notes: https://github.com/ocornut/imgui/releases Wiki: https://github.com/ocornut/imgui/wiki for bindings, extensions, links, etc. FAQ: https://www.dearimgui.org/faq/ Issues: https://github.com/ocornut/imgui/issues
Did you know? We have a Wiki! It has sections such as this Useful Extensions Gallery! 👌
📢 Updating from <1.86 and got visual glitches with custom/old backend when using CTRL+Tab or Modal Windows? See 1.86 release note.
Thank you! ❤️
Special thanks to @rokups for their continued work on stuff that are still not visible e.g. regression tests. Special thanks to @PathogenDavid for their continued contributions and helping with github answers. Special thanks to @thedmd for their code reviews and continued exchanges of ideas.
Ongoing work on Dear ImGui is currently financially supported by:
Huge thank you to all past and present supporters! Also thanks to PVS Studio (great static analyzer) for providing us with a license for this project.
Dear ImGui is funded by your contributions and needs them right now. If your company uses Dear ImGui, consider reaching out. See Sponsors page for details.
TL;DR;
Some arbitrary highlights among the 90+ changes:
- Debug Tools: Hovering 0xXXXXXXX ids in Debug Log and Metrics can now visually locate the item. (#5855)
- Popups & Modals: fixed nested Begin() inside a popup being erroneously input-inhibited.
- IO: Mitigate scrolling issues on system sending dual-axis wheel data simultaneously (more fixes coming later).
- IsItemHovered: added
ImGuiHoveredFlags_DelayNormal
andImGuiHoveredFlags_DelayShort
for delayed hover test (work on items that have no persistent identifier e.g. Text items). - InputText: added
ImGuiInputTextFlags_EscapeClearsAll
andio.ConfigInputTextEnterKeepActive
. Added Shift+Click style selection. Improvements for numerical inputs for IME mode sending full-width characters. Other fixes. - Menus: various fixes for menu item inside non-popup root windows. Fixes for keyboard/gamepad navigations.
- TabBar: fixes occasional freezes when feeding non-rounded tab widths.
- Backends: Many fixes: freezing IME on Win32, fix for SDL 2.0.22 auto-capture and drag and drop issues with multi-viewports, fixes corruptions issues with OpenGL and multi-viewports on buggy Intel GPU drivers, OSX support for C++ apps etc.
- Obsoleted variety of old symbols, with backward-compatible redirection for newly obsoleted stuff.
- Internals: added wip internal APIs to allow handling input/shorting routing and key ownership. Things will be moved into public APIs over time, including a
Shortcut()
function that magically handle input routing. - And many more things...
Breaking Changes
(Suggestion: once in a while, add #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
in your imconfig.h
file to make sure you are not using to-be-obsoleted symbols.)
- Layout: Obsoleted using
SetCursorPos()
/SetCursorScreenPos()
to extend parent window/cell boundaries. (#5548) This relates to when moving the cursor position beyond current boundaries WITHOUT submitting an item.- Previously this would make the window content size ~200x200:
Begin(...)
+SetCursorScreenPos(GetCursorScreenPos() + ImVec2(200,200))
+End()
- Instead, please submit an item:
Begin(...)
+SetCursorScreenPos(GetCursorScreenPos() + ImVec2(200,200))
+Dummy(ImVec2(0,0))
+End()
- Or simpler alternative:
Begin(...)
+Dummy(ImVec2(200,200))
+End()
; - Content size is now only extended when submitting an item.
- With
#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
this will now be detected and assert. - Without
#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
this will silently be fixed until we obsolete it. - This incorrect pattern has been mentioned or suggested in: #4510, #3355, #1760, #1490, #4152, #150, threads have been amended to refer to this issue.
- With
- Previously this would make the window content size ~200x200:
- Renamed and merged keyboard modifiers key enums and flags into a same set: (#4921, #456)
-
ImGuiKey_ModCtrl
andImGuiModFlags_Ctrl
->ImGuiMod_Ctrl
-
ImGuiKey_ModShift
andImGuiModFlags_Shift
->ImGuiMod_Shift
-
ImGuiKey_ModAlt
andImGuiModFlags_Alt
->ImGuiMod_Alt
-
ImGuiKey_ModSuper
andImGuiModFlags_Super
->ImGuiMod_Super
Kept inline redirection enums (will obsolete). This change simplifies a few things, reduces confusion, and will facilitate upcoming shortcut/input ownership apis. - (The
ImGuiKey_ModXXX
were introduced in 1.87 and mostly used by backends. TheImGuiModFlags_XXX
have been exposed in imgui.h but not really used by any public api, only by third-party extensions. They were however subject to a recent renameImGuiKeyModFlags_XXX
->ImGuiModFlags_XXX
and we are exceptionally commenting out the olderImGuiKeyModFlags_XXX
names ahead of obsolescence schedule to reduce confusion and because they were not meant to be used anyway.)
-
- Removed
io.NavInputs[]
andImGuiNavInput
enum that were used to feed gamepad inputs. Basically 1.87 already obsoleted them from the backend's point of view, but internally our navigation code still used this array and enum, so they were still present. Not anymore! (#4921, #4858, #787, #1599, #323) Transition guide:- Official backends from 1.87:
- no issue.
- Official backends from 1.60 to 1.86:
- will compile and convert legacy gamepad inputs, unless
IMGUI_DISABLE_OBSOLETE_KEYIO
is defined. Need updating!
- will compile and convert legacy gamepad inputs, unless
- Custom backends not writing to
io.NavInputs[]
(no gamepad support)- no issue.
- Custom backends writing to
io.NavInputs[]
:- will compile and convert legacy gamepad inputs, unless
IMGUI_DISABLE_OBSOLETE_KEYIO
is defined. Need fixing!
- will compile and convert legacy gamepad inputs, unless
- TL;DR: Backends should call
io.AddKeyEvent()
/io.AddKeyAnalogEvent()
withImGuiKey_GamepadXXX
values instead of fillingio.NavInput[]
. The ImGuiNavInput enum was essentially 1.60's attempt to combine keyboard and gamepad inputs with named semantic, but the additional indirection and copy added complexity and got in the way of other incoming work. User's code (other than backends) should not be affected, unless you have custom widgets intercepting navigation events via the named enums (in which case you can upgrade your code).
- Official backends from 1.87:
-
DragInt()
,SliderInt()
: Removed runtime patching of invalid "%f"/"%.0f" types of format strings. This was obsoleted in 1.61 (May 2018). See 1.61 changelog for details. - Changed signature of
ImageButton()
function: (#5533, #4471, #2464, #1390)- Added
const char* str_id
parameter + removedint frame_padding = -1
parameter. - Old signature:
bool ImageButton(ImTextureID tex_id, ImVec2 size, ImVec2 uv0 = ImVec2(0,0), ImVec2 uv1 = ImVec2(1,1), int frame_padding = -1, ImVec4 bg_col = ImVec4(0,0,0,0), ImVec4 tint_col = ImVec4(1,1,1,1));
- used the
ImTextureID
value to create an ID. This was inconsistent with other functions, led to ID conflicts, and caused problems with engines using transient ImTextureID values. - had a
FramePadding
override which was inconsistent with other functions and made the already-long signature even longer.
- used the
- New signature:
bool ImageButton(const char* str_id, ImTextureID tex_id, ImVec2 size, ImVec2 uv0 = ImVec2(0,0), ImVec2 uv1 = ImVec2(1,1), ImVec4 bg_col = ImVec4(0,0,0,0), ImVec4 tint_col = ImVec4(1,1,1,1));
- requires an explicit identifier. You may still use e.g.
PushID()
calls and then pass an empty identifier. - always uses
style.FramePadding
for padding, to be consistent with other buttons. You may usePushStyleVar()
to alter this.
- requires an explicit identifier. You may still use e.g.
- As always we are keeping a redirection function available (will obsolete later).
- Added
- Removed the bizarre legacy default argument for
TreePush(const void* ptr = NULL)
. Must always pass a pointer value explicitly, NULL/nullptr is ok but require cast, e.g.TreePush((void*)nullptr);
If you usedTreePush()
replace withTreePush((void*)NULL);
(#1057) - Commented out redirecting functions/enums names that were marked obsolete in 1.77 and 1.79 (August 2020): (#3361)
-
DragScalar()
,DragScalarN()
,DragFloat()
,DragFloat2()
,DragFloat3()
,DragFloat4()
-
SliderScalar()
,SliderScalarN()
,SliderFloat()
,SliderFloat2()
,SliderFloat3()
,SliderFloat4()
- For old signatures ending with
(..., const char* format, float power = 1.0f)
->use (..., format ImGuiSliderFlags_Logarithmic)
ifpower != 1.0f
.
- For old signatures ending with
-
BeginPopupContextWindow(const char*, ImGuiMouseButton, bool)
-> useBeginPopupContextWindow(const char*, ImGuiPopupFlags)
-
OpenPopupContextItem()
(briefly existed from 1.77 to 1.79) -> useOpenPopupOnItemClick()
-
- Removed support for 1.42-era
IMGUI_DISABLE_INCLUDE_IMCONFIG_H
/IMGUI_INCLUDE_IMCONFIG_H
. They only made sense before we could useIMGUI_USER_CONFIG
. (#255)
Other Changes
- Popups & Modals: fixed nested Begin() inside a popup being erroneously input-inhibited. While it is unusual, you can nest a Begin() inside a popup or modal, it is occasionally useful to achieve certain things (e.g. some ways to implement suggestion popups #718, #4461).
- Inputs: Standard widgets now claim for key/button ownership and test for them.
- Fixes scenario where e.g. a Popup with a Selectable() reacting on mouse down (e.g. double click) closes, and behind it is another window with an item reacting on mouse up. Previously this would lead to both items reacting, now the item in the window behind won't react on the mouse up since the mouse button ownership has already been claimed earlier.
- Internals: There are MANY more aspects to this changes. Added experimental/internal APIs to allow handling input/shorting routing and key ownership. Things will be moved into public APIs over time. For now this release is a way to test the solidity of underlying systems while letting early adopters adopters toy with internals. (#456, #2637, #2620, #2891, #3370, #3724, #4828, #5108, #5242, #5641)
- Scrolling: Tweak mouse-wheel locked window timer so it is shorter but also gets reset whenever scrolling again. Modulate for small (sub-pixel) amounts. (#2604)
- Scrolling: Mitigated issue where multi-axis mouse-wheel inputs (usually from touch pad events) are incorrectly locking scrolling in a parent window. (#4559, #3795, #2604)
- Scrolling: Exposed
SetNextWindowScroll()
in public API. Useful to remove a scrolling delay in some situations where e.g. windows need to be synched. (#1526) - InputText: added experimental
io.ConfigInputTextEnterKeepActive
feature to make pressing Enter keep the input active and select all text. - InputText: numerical fields automatically accept full-width characters (U+FF01..U+FF5E) by converting them to half-width (U+0021..U+007E).
- InputText: added
ImGuiInputTextFlags_EscapeClearsAll
flag: first press on Escape clears text if any, second press deactivate theInputText()
. (#5688, #2620) - InputText: added support for shift+click style selection. (#5619) [@procedural]
- InputText: clarified that callbacks cannot modify buffer when using the
ImGuiInputTextFlags_ReadOnly
flag. - InputText: fixed minor one-frame selection glitch when reverting with Escape.
- ColorEdit3: fixed id collision leading to an assertion. (#5707)
- IsItemHovered: Added
ImGuiHoveredFlags_DelayNormal
andImGuiHoveredFlags_DelayShort
flags, allowing to introduce a shared delay for tooltip idioms. The delays are respectivelyio.HoverDelayNormal
(default to 0.30f) andio.HoverDelayFast
(default to 0.10f). (#1485) - IsItemHovered: Added
ImGuiHoveredFlags_NoSharedDelay
to disable sharing delays between items, so moving from one item to a nearby one will requires delay to elapse again. (#1485) - Tables: activating an ID (e.g. clicking button inside) column doesn't prevent columns output flags from having
ImGuiTableColumnFlags_IsHovered
set. (#2957) - Tables,Columns: fixed a layout issue where
SameLine()
prior to a row change would set the next row in such state where subsequentSameLine()
would move back to previous row. - Tabs: Fixed a crash when closing multiple windows (possible with docking only) with an appended
TabItemButton()
. (#5515, #3291) [@rokups] - Tabs: Fixed shrinking policy leading to infinite loops when fed unrounded tab widths. (#5652)
- Tabs: Fixed shrinking policy sometimes erroneously making right-most tabs stray a little out bar boundaries (bug in 1.88). (#5652).
- Tabs: Enforcing minimum size of 1.0f, fixed asserting on zero-tab widths. (#5572)
- Window: Fixed a potential crash when appending to a child window. (#5515, #3496, #4797) [@rokups]
- Window: Fixed an issue where uncollapsed a window would show a scrollbar for a frame.
- Window: Auto-fit size takes account of work rectangle (menu bars eating from viewport). (#5843)
- Window: Fixed position not being clamped while auto-resizing (fixes appearing windows without .ini data from moving for a frame when using
io.ConfigWindowsMoveFromTitleBarOnly)
. (#5843) - IO: Added
ImGuiMod_Shortcut
which isImGuiMod_Super
on Mac andImGuiMod_Ctrl
otherwise. (#456) - IO: Added
ImGuiKey_MouseXXX
aliases for mouse buttons/wheel so all operations done onImGuiKey
can apply to mouse data as well. (#4921) - IO: Filter duplicate input events during the
AddXXX()
calls. (#5599, #4921) - IO: Fixed
AddFocusEvent(false)
to also clearMouseDown[]
state. (#4921) - Menus: Fixed incorrect sub-menu parent association when opening a menu by closing another. Among other things, it would accidentally break part of the closing heuristic logic when moving towards a sub-menu. (#2517, #5614). [@rokups]
- Menus: Fixed gaps in closing logic which would make child-menu erroneously close when crossing the gap between a menu item inside a window and a child-menu in a secondary viewport. (#5614)
- Menus: Fixed using
IsItemHovered()
/IsItemClicked()
onBeginMenu()
. (#5775) - Menus, Popups: Experimental fix for issue where clicking on an open
BeginMenu()
item called from a window which is neither a popup neither a menu used to incorrectly close and reopen the menu (the fix may have side-effect and is labelled as experimental as we may need to revert). (#5775) - Menus, Nav: Fixed keyboard/gamepad navigation occasionally erroneously landing on menu-item in parent window when the parent is not a popup. (#5730)
- Menus, Nav: Fixed not being able to close a menu with Left arrow when parent is not a popup. (#5730)
- Menus, Nav: Fixed using left/right navigation when appending to an existing menu (multiple
BeginMenu()
call with same names). (#1207) - Menus: Fixed a one-frame issue where
SetNextWindowXXX
data are not consumed by aBeginMenu()
returning false. - Nav: Fixed moving/resizing window with gamepad or keyboard when running at very high framerate.
- Nav: Pressing Space/GamepadFaceDown on a repeating button uses the same repeating rate as a mouse hold.
- Nav: Fixed an issue opening a menu with Right key from a non-menu window.
- Text: Fixed wrapped-text not doing a fast-forward on lines above the clipping region, which would result in an abnormal number of vertices created (was slower and more likely to asserts with 16-bits ImDrawVtx). (#5720)
- Fonts: Added
GetGlyphRangesGreek()
helper for Greek & Coptic glyph range. (#5676, #5727) [@azonenberg] - ImDrawList: Not using
alloca()
, anymore, lift single polygon size limits. (#5704, #1811) - Platform IME: [Windows] Removed call to
ImmAssociateContextEx()
leading to freeze on some setups. (#2589, #5535, #5264, #4972) - Misc:
ImGuiKey
is now a typed enum, allowingImGuiKey_XXX
symbols to be named in debuggers. (#4921) - Misc: better error reporting for
PopStyleColor()
/PopStyleVar()
+ easier to recover. (#1651) - Misc:
io.Framerate
moving average now converge in 60 frames instead of 120. (#5236, #4138) - Debug Tools: Debug Log: Visually locate items when hovering a
0xXXXXXXXX
value. (#5855) - Debug Tools: Debug Log: Added
IO
andClipper
events logging. (#5855) - Debug Tools: Metrics: Visually locate items when hovering a
0xXXXXXXXX
value (in most places). - Debug Tools: Item Picker: Mouse button can be changed by holding Ctrl+Shift, making it easier to use the Item Picker in e.g. menus. (#2673)
- Docs: Fixed various typos in comments and documentations. (#5649, #5675, #5679) [@tocic, @lessigsx]
- Demo: Improved "Constrained-resizing window" example, more clearly showcase aspect-ratio. (#5627)
- Demo: Added more explicit "Center window" mode to "Overlay example". (#5618)
- Demo: Fixed Log & Console from losing scrolling position with Auto-Scroll when child is clipped. (#5721)
- Examples: Added all SDL examples to default VS solution.
- Examples: Win32: Always use
RegisterClassW()
to ensure windows are Unicode. (#5725) - Examples: Android: Enable .ini file loading/saving into application internal data folder. (#5836) [@rewtio]
- Backends: GLFW: Honor
GLFW_CURSOR_DISABLED
by not setting mouse position. (#5625) [@scorpion-26] - Backends: GLFW: Add
glfwGetError()
call on GLFW 3.3 to inhibit missing mouse cursor errors. (#5785) [@mitchellh] - Backends: SDL: Disable SDL 2.0.22 new "auto capture" which prevents drag and drop across windows (e.g. for multi-viewport support) and don't capture mouse when drag and dropping. (#5710)
- Backends: Win32: Convert WM_CHAR values with
MultiByteToWideChar()
when window class was registered as MBCS (not Unicode). (#5725, #1807, #471, #2815, #1060) [@or75, @ocornut] - Backends: OSX: Fixed mouse inputs on flipped views. (#5756) [@Nemirtingas]
- Backends: OSX: Fixed mouse coordinate before clicking on the host window. (#5842) [@maezawa-akira]
- Backends: OSX: Fixes to support full app creation in C++. (#5403) [@stack]
- Backends: OpenGL3: Reverted use of
glBufferSubData()
, too many corruptions issues were reported, and old leaks issues seemingly can't be reproed with Intel drivers nowadays (revert earlier changes). (#4468, #4504, #3381, #2981, #4825, #4832, #5127). - Backends: Metal: Use __bridge for ARC based systems. (#5403) [@stack]
- Backends: Metal: Add dispatch synchronization. (#5447) [@luigifcruz]
- Backends: Metal: Update deprecated property
sampleCount
->rasterSampleCount
. (#5603) [@dcvz] - Backends: Vulkan: Added experimental
ImGui_ImplVulkan_RemoveTexture()
for api symetry. (#914, #5738). - Backends: WebGPU: fixed rendering when a depth buffer is enabled. (#5869) [@brainlag]
Other branches & Beta features!
The Docking and Multi-viewports features are available in the docking branch, they are in beta but actively maintained and being used by many teams already. Your continuous feedback is always appreciated.
Some of changes from 1.88 to 1.89 related to the docking branch (multi-viewport and docking features) include:
- Docking: Fixed incorrect focus highlight on docking node when focusing a menu. (#5702)
- Docking, Nav: Fixed using gamepad/keyboard navigation not being able enter menu layer when it only contained the standard Collapse/Close buttons and no actual menu. (#5463, #4792)
- Docking: Fixed regression introduced in v1.87 when docked window content not rendered while switching between with CTRL+Tab. [@rokups]
- Docking: Fixed amending into an existing tab bar from rendering invisible items. (#5515)
- Docking: Made spacing between dock nodes not a dropping gap. When hovering it only outer-docking drop markers are visible.
- Docking+Viewports: Fixed undocking window node causing parent viewports to become unresponsive in certain situation (e.g. hidden tab bar). (#5503) [@rokups]
- Backends: SDL: Fixed building backend under non-OSX Apple targets (e.g. iPhone). (#5665)
- Backends: SDL: Fixed drag and drop crossing a viewport border losing mouse coordinates. (#5710, #5012)
- Backends: GLFW: Fixed leftover static variable preventing from changing or re-initializing backend while application is running. (#4616, #5434) [@rtoumazet]
There's a CMake branch/PR (#1713) if you prefer a traditional CMake integration over registering sources files in your own project. There's a premake5 branch if you prefer Visual Studio projects generated by premake.
Gallery
Below a selection of screenshots from Gallery threads...
Tooll 3 - A realtime animation toolkit https://github.com/still-scene/t3/
Here's a fancy animated UI that's built with an animation library I've been working on. Although it looks complex and hard to implement, the library handles most of the work. @thedemons
an IDE, Assembler and Emulator for the CPU Intel 8085 https://github.com/FanisDeligiannis/8085_emulator
Erhe by @tksuoran https://github.com/tksuoran/erhe
Castle-Engine by @benanil
imspinner: Set of nice spinners by @dalerank (#5421) https://github.com/dalerank/imspinner
ImExplorer by @immortalx74: "WIP Windows tabbed file explorer replacement. Uses the voidtools Everything SDK for searching and navigating."
Unknown software by @keycccc
Fragmenter - animated loop machine by @keszegh A real-time animation app, using ImGui via the Gideros ImGui plugin: https://longtitle-productions.itch.io/fragmenter
Hazel Engine by @TheCherno https://github.com/TheCherno/Hazel
Earthblade game editor (upcoming game by the makers of Celeste and Towerfall)
Harfang 3D Engine https://github.com/harfang3d/harfang3d
Xpano by @krupkat "I made a tool for stitching photos:" https://github.com/krupkat/xpano
B.A.M. by @berkayylmao "a mod/live editor for older Need for Speed games. It uses Dear ImGui with a simple beautifier layer." https://github.com/berkayylmao/BerkaysAssortedMods
INO3D by @everaldojunior98 "a 3D environment for circuits simulation." https://github.com/everaldojunior98/INO3D
"Hello friends. Our team who is making a game engine in Com2us uses and loves ImGui. It's really helpful to use ImGui to implement various tools as shown in gallery threads of the other engines. we are really appreciated ImGui. thanks!"
Syntacts by @epezent https://www.syntacts.org/
Raytracing off vs. on. All in software, no RTX:p And ImGui for everything UI of course!
Engine by @gboisse
Torch R&D Prototype at Ubisoft La Forge https://twitter.com/Ubisoft/status/1582017652557377537
Raven by @jminor "a user interface for viewing OpenTimelineIO video/audio timelines." https://github.com/jminor/raven
And many more in Gallery Threads
PS: Dear ImGui is funded by your contributions and needs them right now. If your company uses Dear ImGui, consider reaching out today to say hi! See Sponsors page for details.
PS.2: Scroll back up and read that changelog, it is useful!