mirror of
https://github.com/ocornut/imgui.git
synced 2026-04-14 03:26:15 +00:00
Merge branch 'master' into docking
# Conflicts: # docs/CHANGELOG.txt # imgui.cpp # imgui_demo.cpp
This commit is contained in:
@@ -39,6 +39,16 @@ HOW TO UPDATE?
|
||||
VERSION 1.92.7 WIP (In Progress)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Breaking Changes:
|
||||
|
||||
Other Changes:
|
||||
|
||||
- Style: border sizes are now scaled (and rounded) by ScaleAllSizes().
|
||||
- Clipper: clear DisplayStart/DisplayEnd fields when Step() returns false.
|
||||
- Examples:
|
||||
- WGPU: fixed undefined behaviors in example code for requesting adapter
|
||||
and device. (#9246, #9256) [@r-lyeh]
|
||||
|
||||
Docking+Viewports Branch:
|
||||
|
||||
- Viewports:
|
||||
@@ -57,46 +67,46 @@ Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v
|
||||
Breaking Changes:
|
||||
|
||||
- Fonts:
|
||||
- AddFontDefault() now automatically selects an embedded font between:
|
||||
- AddFontDefaultBitmap(): classic pixel-clean font. Recommended at Size 13px with no scaling.
|
||||
- AddFontDefaultVector(): new scalable font. Recommended at any higher size.
|
||||
- `AddFontDefault()` now automatically selects an embedded font between:
|
||||
- `AddFontDefaultBitmap()`: classic pixel-clean font. Recommended at Size 13px with no scaling.
|
||||
- `AddFontDefaultVector()`: new scalable font. Recommended at any higher size.
|
||||
- The default selection is based on (style.FontSizeBase * FontScaleMain * FontScaleDpi)
|
||||
reaching a small threshold, but old codebases may not set any of them properly.
|
||||
As as a result, it is likely that old codebase may still default to AddFontDefaultBitmap().
|
||||
- Prefer explicitly calling either of them based on your own logic!
|
||||
You can call AddFontDefaultBitmap() to ensure legacy behavior.
|
||||
You can call `AddFontDefaultBitmap()` to ensure legacy behavior.
|
||||
- Fixed handling of `ImFontConfig::FontDataOwnedByAtlas = false` which did
|
||||
erroneously make a copy of the font data, essentially defeating the purpose
|
||||
of this flag and wasting memory (undetected since July 2015 and now spotted
|
||||
by @TellowKrinkle, this is perhaps the oldest bug in Dear ImGui history,
|
||||
albeit for a rarely used feature!) (#9086, #8465)
|
||||
HOWEVER, fixing this bug is likely to surface bugs in user/app code:
|
||||
- Prior to 1.92, font data only needs to be available during the atlas->AddFontXXX() call.
|
||||
Since 1.92, font data needs to available until atlas->RemoveFont(), or more typically
|
||||
- Prior to 1.92, font data only needs to be available during the `atlas->AddFontXXX()` call.
|
||||
Since 1.92, font data needs to available until `atlas->RemoveFont()`, or more typically
|
||||
until a shutdown of the owning context or font atlas.
|
||||
- The fact that handling of `FontDataOwnedByAtlas = false` was broken bypassed
|
||||
the issue altogether.
|
||||
- Removed ImFontConfig::PixelSnapV added in 1.92 which turns out is unnecessary
|
||||
(and misdocumented). Post-rescale GlyphOffset is always rounded.
|
||||
- Popups: changed compile-time 'ImGuiPopupFlags popup_flags = 1' default value to be '= 0' for
|
||||
BeginPopupContextItem(), BeginPopupContextWindow(), BeginPopupContextVoid(), OpenPopupOnItemClick().
|
||||
- Removed `ImFontConfig::PixelSnapV` added in 1.92 which turns out is unnecessary
|
||||
(and was mis-documented). Post-rescale `GlyphOffset` is always rounded.
|
||||
- Popups: changed compile-time `ImGuiPopupFlags popup_flags = 1` default value to be `= 0` for
|
||||
`BeginPopupContextItem()`, `BeginPopupContextWindow()`, `BeginPopupContextVoid()`, `OpenPopupOnItemClick()`.
|
||||
The default value has same meaning before and after. (#9157, #9146)
|
||||
- Before this version, those functions had a 'ImGuiPopupFlags popup_flags = 1' default
|
||||
- Before this version, those functions had a `ImGuiPopupFlags popup_flags = 1` default
|
||||
value in their function signature. This was introduced by a change on 2020/06/23 (1.77)
|
||||
while changing the signature from 'int mouse_button' to 'ImGuiPopupFlags popup_flags'
|
||||
while changing the signature from `int mouse_button` to `ImGuiPopupFlags popup_flags`
|
||||
and trying to preserve then-legacy behavior.
|
||||
- We have now changed this behavior to: cleanup a very old API quirk, facilitate use by
|
||||
bindings, and to remove the last and error-prone non-zero default value. Also because we
|
||||
deemed it extremely rare to use those helper functions with the Left mouse button!
|
||||
As using the LMB would generally be triggered via another widget,
|
||||
e.g. a Button() + a OpenPopup()/BeginPopup() call.
|
||||
- Before: The default = 1 means ImGuiPopupFlags_MouseButtonRight.
|
||||
Explicitly passing a literal 0 means ImGuiPopupFlags_MouseButtonLeft.
|
||||
- After: The default = 0 means ImGuiPopupFlags_MouseButtonRight.
|
||||
Explicitly passing a literal 1 also means ImGuiPopupFlags_MouseButtonRight
|
||||
- Before: The default = 1 means `ImGuiPopupFlags_MouseButtonRight`.
|
||||
Explicitly passing a literal 0 means `ImGuiPopupFlags_MouseButtonLeft`.
|
||||
- After: The default = 0 means `ImGuiPopupFlags_MouseButtonRight`.
|
||||
Explicitly passing a literal 1 also means `ImGuiPopupFlags_MouseButtonRight`.
|
||||
(if legacy behavior are enabled) or will assert (if legacy behavior are disabled).
|
||||
- TL;DR: if you don't want to use right mouse button for popups, always specify it
|
||||
explicitly using a named ImGuiPopupFlags_MouseButtonXXXX value.
|
||||
explicitly using a named `ImGuiPopupFlags_MouseButtonXXXX` value.
|
||||
Recap:
|
||||
- BeginPopupContextItem("foo"); // Behavior unchanged (use Right button)
|
||||
- BeginPopupContextItem("foo", ImGuiPopupFlags_MouseButtonLeft); // Behavior unchanged (use Left button)
|
||||
@@ -106,11 +116,11 @@ Breaking Changes:
|
||||
- BeginPopupContextItem("foo", 0); // !! Behavior changed !! Was Left button. Now will defaults to Right button! --> Use ImGuiPopupFlags_MouseButtonLeft.
|
||||
- BeginPopupContextItem("foo", ImGuiPopupFlags_NoReopen); // !! Behavior changed !! Was Left button + flags. Now will defaults to Right button! --> Use ImGuiPopupFlags_MouseButtonLeft | xxx.
|
||||
- Commented out legacy names obsoleted in 1.90 (Sept 2023):
|
||||
- BeginChildFrame() --> BeginChild() with ImGuiChildFlags_FrameStyle flag.
|
||||
- EndChildFrame() --> EndChild().
|
||||
- ShowStackToolWindow() --> ShowIDStackToolWindow().
|
||||
- IM_OFFSETOF() --> offsetof().
|
||||
- IM_FLOOR() --> IM_TRUNC() [internal, for positive values only]
|
||||
- `BeginChildFrame()` --> `BeginChild()` with `ImGuiChildFlags_FrameStyle` flag.
|
||||
- `EndChildFrame()` --> `EndChild()`.
|
||||
- `ShowStackToolWindow()` --> `ShowIDStackToolWindow()`.
|
||||
- `IM_OFFSETOF()` --> `offsetof()`.
|
||||
- `IM_FLOOR()` --> `IM_TRUNC()` [internal, for positive values only]
|
||||
- Hashing: handling of "###" operator to reset to seed within a string identifier
|
||||
doesn't include the "###" characters in the output hash anymore:
|
||||
Before: `GetID("Hello###World") == GetID("###World") != GetID("World")`
|
||||
@@ -119,11 +129,11 @@ Breaking Changes:
|
||||
identifiers using "###", and will allow fixing other dangling issues.
|
||||
- This will invalidate hashes (stored in .ini data) for Tables and Windows
|
||||
that are using the "###" operators. (#713, #1698)
|
||||
- Renamed helper macro IM_ARRAYSIZE() -> IM_COUNTOF(). Kept redirection/legacy name.
|
||||
- Renamed helper macro `IM_ARRAYSIZE()` -> `IM_COUNTOF()`. Kept redirection/legacy name.
|
||||
- Backends:
|
||||
- Vulkan: optional ImGui_ImplVulkanH_DestroyWindow() helper used by our example
|
||||
code does not call vkDestroySurfaceKHR(): because surface is created by caller
|
||||
of ImGui_ImplVulkanH_CreateOrResizeWindow(), it is more consistent. (#9163)
|
||||
- Vulkan: optional `ImGui_ImplVulkanH_DestroyWindow()` helper used by our example
|
||||
code does not call `vkDestroySurfaceKHR()`: because surface is created by caller
|
||||
of `ImGui_ImplVulkanH_CreateOrResizeWindow()`, it is more consistent. (#9163)
|
||||
|
||||
Other Changes:
|
||||
|
||||
@@ -141,22 +151,22 @@ Other Changes:
|
||||
- The font data was carefully subsetted, trimmed and compressed so the embedded
|
||||
data is ~14 KB. Embedding a scalable default font ensures that Dear ImGui can
|
||||
be easily and readily used in all contexts, even without file system access.
|
||||
- Expect minor fixes/improvements in following releases.
|
||||
- As always you can opt-out of the embedded font data if desired.
|
||||
- `AddFontDefault()` now automatically selects an embedded font between
|
||||
the classic pixel-looking one and the new scalable one.
|
||||
Prefer calling `AddFontDefaultVector()` or `AddFontDefaultBitmap()` explicitely.
|
||||
Prefer calling `AddFontDefaultVector()` or `AddFontDefaultBitmap()` explicitly.
|
||||
- Fixed a crash when trying to use `AddFont()` with `MergeMode==true` on a font that
|
||||
has already been rendered. (#9162) [@ocornut, @cyfewlp]
|
||||
- Fixed an issue where using `PushFont()` from the implicit/fallback "Debug" window
|
||||
when its recorded state is collapsed would incorrectly early out. This would break
|
||||
e.g. using direct draw-list calls such as GetForegroundDrawList() with current font.
|
||||
e.g. using direct draw-list calls such as `GetForegroundDrawList()` with current font.
|
||||
(#9210, #8865)
|
||||
- Fixed an issue related to `EllipsisChar` handling, while changing
|
||||
font loader or font loader flags dynamically in Style->Fonts menus.
|
||||
- imgui_freetype: fixed overwriting `ImFontConfig::PixelSnapH` when hinting
|
||||
is enabled, creating side-effects when later disabling hinting or
|
||||
dynamically switching to stb_truetype rasterizer.
|
||||
- Post rescale `ImFontConfig::GlyphOffset` is always rounded.
|
||||
- Adding new fonts after removing all fonts mid-frame properly updates current state.
|
||||
- Textures:
|
||||
- Fixed a building issue when `ImTextureID` is defined as a struct.
|
||||
@@ -167,7 +177,7 @@ Other Changes:
|
||||
- Made navigation into menu-bar auto wrap on X axis. (#9178)
|
||||
- TreeNode:
|
||||
- Fixed highlight position when used inside a line with a large text baseline offset.
|
||||
(never quite worked in this situation; but then most of the time the text
|
||||
(it never quite worked in this situation; but then most of the time the text
|
||||
baseline offset ends up being zero or `FramePadding.y` for a given line).
|
||||
- Tables:
|
||||
- Fixed an issue where a very thin scrolling table would advance parent layout
|
||||
@@ -193,7 +203,7 @@ Other Changes:
|
||||
- ImGuiInputTextCallbackData: Added `ID` and `EventActivated` members. (#9174)
|
||||
- Text, InputText:
|
||||
- Reworked word-wrapping logic:
|
||||
- Try to not wrap in the middle of contiguous punctuations. (#8139, #8439, #9094)
|
||||
- Try to not wrap in the middle of contiguous punctuation. (#8139, #8439, #9094)
|
||||
- Try to not wrap between a punctuation and a digit. (#8503)
|
||||
- Inside `InputTextMultiline()` with WordWrap enabled: prefer keeping blanks at
|
||||
the end of a line rather than at the beginning of next line. (#8990, #3237)
|
||||
@@ -211,7 +221,7 @@ Other Changes:
|
||||
effectively making those actions faster on macOS/iOS retina screens.
|
||||
(changed this to use a style scale factor that's not fully formalized yet)
|
||||
- Fixed an UBSan warning when using in a `ImGuiListClipper` region . (#9160)
|
||||
- Scrollbar: fixed a codepath leading to a divide-by-zero (which would not be
|
||||
- Scrollbar: fixed a code-path leading to a divide-by-zero (which would not be
|
||||
noticeable by user but detected by sanitizers). (#9089) [@judicaelclair]
|
||||
- InvisibleButton: allow calling with size (0,0) to fit to available content
|
||||
size. (#9166, #7623)
|
||||
@@ -232,7 +242,7 @@ Other Changes:
|
||||
- Shortcuts:
|
||||
- IsItemHovered() without `ImGuiHoveredFlags_AllowWhenBlockedByActiveItem`
|
||||
doesn't filter out the signal when activated item is a shortcut remote activation;
|
||||
(which mimicks what's done internally in the `ItemHoverable()` function). (#9138)
|
||||
(which mimics what's done internally in the `ItemHoverable()` function). (#9138)
|
||||
- Fixed tooltip placement being affected for a frame when located over an item
|
||||
activated by `SetNextItemShortcut()`. (#9138)
|
||||
- Error Handling:
|
||||
@@ -270,7 +280,7 @@ Other Changes:
|
||||
- But you can also configure your system or debugger to automatically release
|
||||
mouse grab when crashing/breaking in debugger, e.g.
|
||||
- console: `setxkbmap -option grab:break_actions && xdotool key XF86Ungrab`
|
||||
- or use a GDB script to call SDL_CaptureMouse(false). See #3650.
|
||||
- or use a GDB script to call `SDL_CaptureMouse(false)`. See #3650.
|
||||
- On platforms other than X11 this is unnecessary.
|
||||
- SDL_GPU3: added `SamplerNearest` in `ImGui_ImplSDLGPU3_RenderState`.
|
||||
- SDL_GPU3: macOS version can use MSL shaders in order to support macOS 10.14+
|
||||
|
||||
@@ -55,8 +55,8 @@ if (ImGui::Button("Save"))
|
||||
ImGui::InputText("string", buf, IM_COUNTOF(buf));
|
||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
|
||||
```
|
||||

|
||||

|
||||
<img width="412" height="236" alt="sample code output (dark)" src="https://github.com/user-attachments/assets/f075e2b0-98de-4be8-acb4-99ba0c9966cd" />
|
||||
<img width="412" height="236" alt="sample code output (light)" src="https://github.com/user-attachments/assets/32b838df-6378-498b-84a8-9a79ee6264a7" />
|
||||
|
||||
```cpp
|
||||
// Create a window called "My First Tool", with a menu bar.
|
||||
@@ -90,7 +90,7 @@ for (int n = 0; n < 50; n++)
|
||||
ImGui::EndChild();
|
||||
ImGui::End();
|
||||
```
|
||||

|
||||

|
||||
|
||||
Dear ImGui allows you to **create elaborate tools** as well as very short-lived ones. On the extreme side of short-livedness: using the Edit&Continue (hot code reload) feature of modern compilers you can add a few widgets to tweak variables while your application is running, and remove the code a minute later! Dear ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, an entire game-making editor/framework, etc.
|
||||
|
||||
@@ -116,6 +116,19 @@ Calling the `ImGui::ShowDemoWindow()` function will create a demo window showcas
|
||||
You should be able to build the examples from sources. If you don't, let us know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
|
||||
- [imgui-demo-binaries-20250625.zip](https://www.dearimgui.com/binaries/imgui-demo-binaries-20250625.zip) (Windows, 1.92.0, built 2025/06/25, master) or [older binaries](https://www.dearimgui.com/binaries).
|
||||
|
||||
### Gallery
|
||||
|
||||
Examples projects using Dear ImGui: [Tracy](https://github.com/wolfpld/tracy) (profiler), [ImHex](https://github.com/WerWolv/ImHex) (hex editor/data analysis), [RemedyBG](https://remedybg.itch.io/remedybg) (debugger) and [hundreds of others](https://github.com/ocornut/imgui/wiki/Software-using-Dear-ImGui).
|
||||
|
||||
For more user-submitted screenshots of projects using Dear ImGui, check out the [Gallery Threads](https://github.com/ocornut/imgui/issues?q=label%3Agallery)!
|
||||
|
||||
For a list of third-party widgets and extensions, check out the [Useful Extensions/Widgets](https://github.com/ocornut/imgui/wiki/Useful-Extensions) wiki page.
|
||||
|
||||
| | |
|
||||
|--|--|
|
||||
| Custom engine [erhe](https://github.com/tksuoran/erhe) (docking branch)<BR>[](https://user-images.githubusercontent.com/994606/147875067-a848991e-2ad2-4fd3-bf71-4aeb8a547bcf.png) | Custom engine for [Wonder Boy: The Dragon's Trap](http://www.TheDragonsTrap.com) (2017)<BR>[](https://cloud.githubusercontent.com/assets/8225057/20628927/33e14cac-b329-11e6-80f6-9524e93b048a.png) |
|
||||
| Custom engine (untitled)<BR>[](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/editor_white.png) | Tracy Profiler ([github](https://github.com/wolfpld/tracy))<BR>[](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v176/tracy_profiler.png) |
|
||||
|
||||
### Getting Started & Integration
|
||||
|
||||
See the [Getting Started](https://github.com/ocornut/imgui/wiki/Getting-Started) guide for details.
|
||||
@@ -138,24 +151,13 @@ Officially maintained backends (in repository):
|
||||
- Frameworks: AGS/Adventure Game Studio, Amethyst, Blender, bsf, Cinder, Cocos2d-x, Defold, Diligent Engine, Ebiten, Flexium, GML/Game Maker Studio, GLEQ, Godot, GTK3, Irrlicht Engine, JUCE, LÖVE+LUA, Mach Engine, Magnum, Marmalade, Monogame, NanoRT, nCine, Nim Game Lib, Nintendo 3DS/Switch/WiiU (homebrew), Ogre, openFrameworks, OSG/OpenSceneGraph, Orx, Photoshop, px_render, Qt/QtDirect3D, raylib, SFML, Sokol, Unity, Unreal Engine 4/5, UWP, vtk, VulkanHpp, VulkanSceneGraph, Win32 GDI, WxWidgets.
|
||||
- Many bindings are auto-generated (by good old [cimgui](https://github.com/cimgui/cimgui) or our newer [dear_bindings](https://github.com/dearimgui/dear_bindings)), you can use their metadata output to generate bindings for other languages.
|
||||
|
||||
<img width="878" height="220" alt="Useful extensions" src="https://github.com/user-attachments/assets/e6b0aa7c-bf53-41c5-ac69-bea3098b1dee" />
|
||||
|
||||
[Useful Extensions/Widgets](https://github.com/ocornut/imgui/wiki/Useful-Extensions) wiki page:
|
||||
- Automation/testing, Text editors, node editors, timeline editors, plotting, software renderers, remote network access, memory editors, gizmos, etc. Notable and well supported extensions include [ImPlot](https://github.com/epezent/implot) and [Dear ImGui Test Engine](https://github.com/ocornut/imgui_test_engine).
|
||||
|
||||
Also see [Wiki](https://github.com/ocornut/imgui/wiki) for more links and ideas.
|
||||
|
||||
### Gallery
|
||||
|
||||
Examples projects using Dear ImGui: [Tracy](https://github.com/wolfpld/tracy) (profiler), [ImHex](https://github.com/WerWolv/ImHex) (hex editor/data analysis), [RemedyBG](https://remedybg.itch.io/remedybg) (debugger) and [hundreds of others](https://github.com/ocornut/imgui/wiki/Software-using-Dear-ImGui).
|
||||
|
||||
For more user-submitted screenshots of projects using Dear ImGui, check out the [Gallery Threads](https://github.com/ocornut/imgui/issues?q=label%3Agallery)!
|
||||
|
||||
For a list of third-party widgets and extensions, check out the [Useful Extensions/Widgets](https://github.com/ocornut/imgui/wiki/Useful-Extensions) wiki page.
|
||||
|
||||
| | |
|
||||
|--|--|
|
||||
| Custom engine [erhe](https://github.com/tksuoran/erhe) (docking branch)<BR>[](https://user-images.githubusercontent.com/994606/147875067-a848991e-2ad2-4fd3-bf71-4aeb8a547bcf.png) | Custom engine for [Wonder Boy: The Dragon's Trap](http://www.TheDragonsTrap.com) (2017)<BR>[](https://cloud.githubusercontent.com/assets/8225057/20628927/33e14cac-b329-11e6-80f6-9524e93b048a.png) |
|
||||
| Custom engine (untitled)<BR>[](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/editor_white.png) | Tracy Profiler ([github](https://github.com/wolfpld/tracy))<BR>[](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v176/tracy_profiler.png) |
|
||||
|
||||
### Support, Frequently Asked Questions (FAQ)
|
||||
|
||||
See: [Frequently Asked Questions (FAQ)](https://github.com/ocornut/imgui/blob/master/docs/FAQ.md) where common questions are answered.
|
||||
|
||||
@@ -386,23 +386,29 @@ static WGPUAdapter RequestAdapter(WGPUInstance& instance)
|
||||
{
|
||||
WGPURequestAdapterOptions adapter_options = {};
|
||||
|
||||
WGPUAdapter local_adapter;
|
||||
WGPUAdapter local_adapter = nullptr;
|
||||
WGPURequestAdapterCallbackInfo adapterCallbackInfo = {};
|
||||
adapterCallbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
|
||||
adapterCallbackInfo.callback = handle_request_adapter;
|
||||
adapterCallbackInfo.userdata1 = &local_adapter;
|
||||
|
||||
wgpuInstanceRequestAdapter(instance, &adapter_options, adapterCallbackInfo);
|
||||
WGPUFuture future = wgpuInstanceRequestAdapter(instance, &adapter_options, adapterCallbackInfo);
|
||||
WGPUFutureWaitInfo waitInfo = { future, false };
|
||||
wgpuInstanceWaitAny(instance, 1, &waitInfo, ~0ull);
|
||||
IM_ASSERT(local_adapter && "Error on Adapter request");
|
||||
return local_adapter;
|
||||
}
|
||||
|
||||
static WGPUDevice RequestDevice(WGPUAdapter& adapter)
|
||||
static WGPUDevice RequestDevice(WGPUInstance& instance, WGPUAdapter& adapter)
|
||||
{
|
||||
WGPUDevice local_device;
|
||||
WGPUDevice local_device = nullptr;
|
||||
WGPURequestDeviceCallbackInfo deviceCallbackInfo = {};
|
||||
deviceCallbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
|
||||
deviceCallbackInfo.callback = handle_request_device;
|
||||
deviceCallbackInfo.userdata1 = &local_device;
|
||||
wgpuAdapterRequestDevice(adapter, nullptr, deviceCallbackInfo);
|
||||
WGPUFuture future = wgpuAdapterRequestDevice(adapter, nullptr, deviceCallbackInfo);
|
||||
WGPUFutureWaitInfo waitInfo = { future, false };
|
||||
wgpuInstanceWaitAny(instance, 1, &waitInfo, ~0ull);
|
||||
IM_ASSERT(local_device && "Error on Device request");
|
||||
return local_device;
|
||||
}
|
||||
@@ -450,7 +456,11 @@ bool InitWGPU(GLFWwindow* window)
|
||||
|
||||
// WGPU backend: Adapter and Device acquisition, Surface creation
|
||||
#elif defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
|
||||
wgpu_instance = wgpuCreateInstance(nullptr);
|
||||
WGPUInstanceDescriptor instanceDesc = {};
|
||||
WGPUInstanceFeatureName timedWaitAny = WGPUInstanceFeatureName_TimedWaitAny;
|
||||
instanceDesc.requiredFeatureCount = 1;
|
||||
instanceDesc.requiredFeatures = &timedWaitAny;
|
||||
wgpu_instance = wgpuCreateInstance(&instanceDesc);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
getAdapterAndDeviceViaJS();
|
||||
@@ -477,7 +487,7 @@ bool InitWGPU(GLFWwindow* window)
|
||||
WGPUAdapter adapter = RequestAdapter(wgpu_instance);
|
||||
ImGui_ImplWGPU_DebugPrintAdapterInfo(adapter);
|
||||
|
||||
wgpu_device = RequestDevice(adapter);
|
||||
wgpu_device = RequestDevice(wgpu_instance, adapter);
|
||||
|
||||
// Create the surface.
|
||||
wgpu_surface = CreateWGPUSurface(wgpu_instance, window);
|
||||
|
||||
@@ -369,23 +369,29 @@ static WGPUAdapter RequestAdapter(WGPUInstance& instance)
|
||||
{
|
||||
WGPURequestAdapterOptions adapter_options = {};
|
||||
|
||||
WGPUAdapter local_adapter;
|
||||
WGPUAdapter local_adapter = nullptr;
|
||||
WGPURequestAdapterCallbackInfo adapterCallbackInfo = {};
|
||||
adapterCallbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
|
||||
adapterCallbackInfo.callback = handle_request_adapter;
|
||||
adapterCallbackInfo.userdata1 = &local_adapter;
|
||||
|
||||
wgpuInstanceRequestAdapter(instance, &adapter_options, adapterCallbackInfo);
|
||||
WGPUFuture future = wgpuInstanceRequestAdapter(instance, &adapter_options, adapterCallbackInfo);
|
||||
WGPUFutureWaitInfo waitInfo = { future, false };
|
||||
wgpuInstanceWaitAny(instance, 1, &waitInfo, ~0ull);
|
||||
IM_ASSERT(local_adapter && "Error on Adapter request");
|
||||
return local_adapter;
|
||||
}
|
||||
|
||||
static WGPUDevice RequestDevice(WGPUAdapter& adapter)
|
||||
static WGPUDevice RequestDevice(WGPUInstance& instance, WGPUAdapter& adapter)
|
||||
{
|
||||
WGPUDevice local_device;
|
||||
WGPUDevice local_device = nullptr;
|
||||
WGPURequestDeviceCallbackInfo deviceCallbackInfo = {};
|
||||
deviceCallbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
|
||||
deviceCallbackInfo.callback = handle_request_device;
|
||||
deviceCallbackInfo.userdata1 = &local_device;
|
||||
wgpuAdapterRequestDevice(adapter, nullptr, deviceCallbackInfo);
|
||||
WGPUFuture future = wgpuAdapterRequestDevice(adapter, nullptr, deviceCallbackInfo);
|
||||
WGPUFutureWaitInfo waitInfo = { future, false };
|
||||
wgpuInstanceWaitAny(instance, 1, &waitInfo, ~0ull);
|
||||
IM_ASSERT(local_device && "Error on Device request");
|
||||
return local_device;
|
||||
}
|
||||
@@ -434,7 +440,11 @@ static bool InitWGPU(SDL_Window* window)
|
||||
|
||||
// WGPU backend: Adapter and Device acquisition, Surface creation
|
||||
#elif defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
|
||||
wgpu_instance = wgpuCreateInstance(nullptr);
|
||||
WGPUInstanceDescriptor instanceDesc = {};
|
||||
WGPUInstanceFeatureName timedWaitAny = WGPUInstanceFeatureName_TimedWaitAny;
|
||||
instanceDesc.requiredFeatureCount = 1;
|
||||
instanceDesc.requiredFeatures = &timedWaitAny;
|
||||
wgpu_instance = wgpuCreateInstance(&instanceDesc);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
getAdapterAndDeviceViaJS();
|
||||
@@ -461,7 +471,7 @@ static bool InitWGPU(SDL_Window* window)
|
||||
WGPUAdapter adapter = RequestAdapter(wgpu_instance);
|
||||
ImGui_ImplWGPU_DebugPrintAdapterInfo(adapter);
|
||||
|
||||
wgpu_device = RequestDevice(adapter);
|
||||
wgpu_device = RequestDevice(wgpu_instance, adapter);
|
||||
|
||||
// Create the surface.
|
||||
wgpu_surface = CreateWGPUSurface(wgpu_instance, window);
|
||||
|
||||
@@ -380,23 +380,29 @@ static WGPUAdapter RequestAdapter(WGPUInstance& instance)
|
||||
{
|
||||
WGPURequestAdapterOptions adapter_options = {};
|
||||
|
||||
WGPUAdapter local_adapter;
|
||||
WGPUAdapter local_adapter = nullptr;
|
||||
WGPURequestAdapterCallbackInfo adapterCallbackInfo = {};
|
||||
adapterCallbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
|
||||
adapterCallbackInfo.callback = handle_request_adapter;
|
||||
adapterCallbackInfo.userdata1 = &local_adapter;
|
||||
|
||||
wgpuInstanceRequestAdapter(instance, &adapter_options, adapterCallbackInfo);
|
||||
WGPUFuture future = wgpuInstanceRequestAdapter(instance, &adapter_options, adapterCallbackInfo);
|
||||
WGPUFutureWaitInfo waitInfo = { future, false };
|
||||
wgpuInstanceWaitAny(instance, 1, &waitInfo, ~0ull);
|
||||
IM_ASSERT(local_adapter && "Error on Adapter request");
|
||||
return local_adapter;
|
||||
}
|
||||
|
||||
static WGPUDevice RequestDevice(WGPUAdapter& adapter)
|
||||
static WGPUDevice RequestDevice(WGPUInstance& instance, WGPUAdapter& adapter)
|
||||
{
|
||||
WGPUDevice local_device;
|
||||
WGPUDevice local_device = nullptr;
|
||||
WGPURequestDeviceCallbackInfo deviceCallbackInfo = {};
|
||||
deviceCallbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
|
||||
deviceCallbackInfo.callback = handle_request_device;
|
||||
deviceCallbackInfo.userdata1 = &local_device;
|
||||
wgpuAdapterRequestDevice(adapter, nullptr, deviceCallbackInfo);
|
||||
WGPUFuture future = wgpuAdapterRequestDevice(adapter, nullptr, deviceCallbackInfo);
|
||||
WGPUFutureWaitInfo waitInfo = { future, false };
|
||||
wgpuInstanceWaitAny(instance, 1, &waitInfo, ~0ull);
|
||||
IM_ASSERT(local_device && "Error on Device request");
|
||||
return local_device;
|
||||
}
|
||||
@@ -445,7 +451,11 @@ static bool InitWGPU(SDL_Window* window)
|
||||
|
||||
// WGPU backend: Adapter and Device acquisition, Surface creation
|
||||
#elif defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
|
||||
wgpu_instance = wgpuCreateInstance(nullptr);
|
||||
WGPUInstanceDescriptor instanceDesc = {};
|
||||
WGPUInstanceFeatureName timedWaitAny = WGPUInstanceFeatureName_TimedWaitAny;
|
||||
instanceDesc.requiredFeatureCount = 1;
|
||||
instanceDesc.requiredFeatures = &timedWaitAny;
|
||||
wgpu_instance = wgpuCreateInstance(&instanceDesc);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
getAdapterAndDeviceViaJS();
|
||||
@@ -472,7 +482,7 @@ static bool InitWGPU(SDL_Window* window)
|
||||
WGPUAdapter adapter = RequestAdapter(wgpu_instance);
|
||||
ImGui_ImplWGPU_DebugPrintAdapterInfo(adapter);
|
||||
|
||||
wgpu_device = RequestDevice(adapter);
|
||||
wgpu_device = RequestDevice(wgpu_instance, adapter);
|
||||
|
||||
// Create the surface.
|
||||
wgpu_surface = CreateWGPUSurface(wgpu_instance, window);
|
||||
@@ -513,7 +523,7 @@ static bool InitWGPU(SDL_Window* window)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, SDL_Window* window)
|
||||
WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, SDL_Window* window)
|
||||
{
|
||||
SDL_PropertiesID propertiesID = SDL_GetWindowProperties(window);
|
||||
|
||||
|
||||
11
imgui.cpp
11
imgui.cpp
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.6
|
||||
// dear imgui, v1.92.7 WIP
|
||||
// (main code and documentation)
|
||||
|
||||
// Help:
|
||||
@@ -1560,11 +1560,15 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
||||
_MainScale *= scale_factor;
|
||||
WindowPadding = ImTrunc(WindowPadding * scale_factor);
|
||||
WindowRounding = ImTrunc(WindowRounding * scale_factor);
|
||||
WindowBorderSize = ImTrunc(WindowBorderSize * scale_factor);
|
||||
WindowMinSize = ImTrunc(WindowMinSize * scale_factor);
|
||||
WindowBorderHoverPadding = ImTrunc(WindowBorderHoverPadding * scale_factor);
|
||||
ChildRounding = ImTrunc(ChildRounding * scale_factor);
|
||||
ChildBorderSize = ImTrunc(ChildBorderSize * scale_factor);
|
||||
PopupRounding = ImTrunc(PopupRounding * scale_factor);
|
||||
PopupBorderSize = ImTrunc(PopupBorderSize * scale_factor);
|
||||
FramePadding = ImTrunc(FramePadding * scale_factor);
|
||||
FrameBorderSize = ImTrunc(FrameBorderSize * scale_factor);
|
||||
FrameRounding = ImTrunc(FrameRounding * scale_factor);
|
||||
ItemSpacing = ImTrunc(ItemSpacing * scale_factor);
|
||||
ItemInnerSpacing = ImTrunc(ItemInnerSpacing * scale_factor);
|
||||
@@ -1581,17 +1585,21 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
||||
ImageRounding = ImTrunc(ImageRounding * scale_factor);
|
||||
ImageBorderSize = ImTrunc(ImageBorderSize * scale_factor);
|
||||
TabRounding = ImTrunc(TabRounding * scale_factor);
|
||||
TabBorderSize = ImTrunc(TabBorderSize * scale_factor);
|
||||
TabMinWidthBase = ImTrunc(TabMinWidthBase * scale_factor);
|
||||
TabMinWidthShrink = ImTrunc(TabMinWidthShrink * scale_factor);
|
||||
TabCloseButtonMinWidthSelected = (TabCloseButtonMinWidthSelected > 0.0f && TabCloseButtonMinWidthSelected != FLT_MAX) ? ImTrunc(TabCloseButtonMinWidthSelected * scale_factor) : TabCloseButtonMinWidthSelected;
|
||||
TabCloseButtonMinWidthUnselected = (TabCloseButtonMinWidthUnselected > 0.0f && TabCloseButtonMinWidthUnselected != FLT_MAX) ? ImTrunc(TabCloseButtonMinWidthUnselected * scale_factor) : TabCloseButtonMinWidthUnselected;
|
||||
TabBarBorderSize = ImTrunc(TabBarBorderSize * scale_factor);
|
||||
TabBarOverlineSize = ImTrunc(TabBarOverlineSize * scale_factor);
|
||||
TreeLinesSize = ImTrunc(TreeLinesSize * scale_factor);
|
||||
TreeLinesRounding = ImTrunc(TreeLinesRounding * scale_factor);
|
||||
DragDropTargetRounding = ImTrunc(DragDropTargetRounding * scale_factor);
|
||||
DragDropTargetBorderSize = ImTrunc(DragDropTargetBorderSize * scale_factor);
|
||||
DragDropTargetPadding = ImTrunc(DragDropTargetPadding * scale_factor);
|
||||
ColorMarkerSize = ImTrunc(ColorMarkerSize * scale_factor);
|
||||
SeparatorTextPadding = ImTrunc(SeparatorTextPadding * scale_factor);
|
||||
SeparatorTextBorderSize = ImTrunc(SeparatorTextBorderSize * scale_factor);
|
||||
DockingSeparatorSize = ImTrunc(DockingSeparatorSize * scale_factor);
|
||||
DisplayWindowPadding = ImTrunc(DisplayWindowPadding * scale_factor);
|
||||
DisplaySafeAreaPadding = ImTrunc(DisplaySafeAreaPadding * scale_factor);
|
||||
@@ -3356,6 +3364,7 @@ void ImGuiListClipper::End()
|
||||
}
|
||||
TempData = NULL;
|
||||
}
|
||||
DisplayStart = DisplayEnd = ItemsCount; // Clear this so code which may be reused past last Step() won't trip on a non-empty range.
|
||||
ItemsCount = -1;
|
||||
}
|
||||
|
||||
|
||||
10
imgui.h
10
imgui.h
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.6
|
||||
// dear imgui, v1.92.7 WIP
|
||||
// (headers)
|
||||
|
||||
// Help:
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||
#define IMGUI_VERSION "1.92.6"
|
||||
#define IMGUI_VERSION_NUM 19261
|
||||
#define IMGUI_VERSION "1.92.7 WIP"
|
||||
#define IMGUI_VERSION_NUM 19262
|
||||
#define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000
|
||||
#define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198
|
||||
#define IMGUI_HAS_VIEWPORT // In 'docking' WIP branch.
|
||||
@@ -1353,7 +1353,7 @@ enum ImGuiTreeNodeFlags_
|
||||
ImGuiTreeNodeFlags_DefaultOpen = 1 << 5, // Default node to be open
|
||||
ImGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6, // Open on double-click instead of simple click (default for multi-select unless any _OpenOnXXX behavior is set explicitly). Both behaviors may be combined.
|
||||
ImGuiTreeNodeFlags_OpenOnArrow = 1 << 7, // Open when clicking on the arrow part (default for multi-select unless any _OpenOnXXX behavior is set explicitly). Both behaviors may be combined.
|
||||
ImGuiTreeNodeFlags_Leaf = 1 << 8, // No collapsing, no arrow (use as a convenience for leaf nodes).
|
||||
ImGuiTreeNodeFlags_Leaf = 1 << 8, // No collapsing, no arrow (use as a convenience for leaf nodes). Note: will always open a tree/id scope and return true. If you never use that scope, add ImGuiTreeNodeFlags_NoTreePushOnOpen.
|
||||
ImGuiTreeNodeFlags_Bullet = 1 << 9, // Display a bullet instead of arrow. IMPORTANT: node can still be marked open/close if you don't set the _Leaf flag!
|
||||
ImGuiTreeNodeFlags_FramePadding = 1 << 10, // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding() before the node.
|
||||
ImGuiTreeNodeFlags_SpanAvailWidth = 1 << 11, // Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line without using AllowOverlap mode.
|
||||
@@ -2442,7 +2442,7 @@ struct ImGuiStyle
|
||||
ImGuiHoveredFlags HoverFlagsForTooltipNav; // Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using keyboard/gamepad.
|
||||
|
||||
// [Internal]
|
||||
float _MainScale; // FIXME-WIP: Reference scale, as applied by ScaleAllSizes().
|
||||
float _MainScale; // FIXME-WIP: Reference scale, as applied by ScaleAllSizes(). PLEASE DO NOT USE THIS FOR NOW.
|
||||
float _NextFrameFontSizeBase; // FIXME: Temporary hack until we finish remaining work.
|
||||
|
||||
// Functions
|
||||
|
||||
326
imgui_demo.cpp
326
imgui_demo.cpp
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.6
|
||||
// dear imgui, v1.92.7 WIP
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.6
|
||||
// dear imgui, v1.92.7 WIP
|
||||
// (internal structures/api)
|
||||
|
||||
// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.6
|
||||
// dear imgui, v1.92.7 WIP
|
||||
// (tables and columns code)
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.6
|
||||
// dear imgui, v1.92.7 WIP
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
@@ -6733,6 +6733,8 @@ bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char
|
||||
return TreeNodeBehavior(id, flags, label, label_end);
|
||||
}
|
||||
|
||||
// The reason those two functions are not yet in public API is because I would like to design a more feature-full and generic API for this.
|
||||
// They are otherwise function (cc: #3823, #9251, #7553, #6754, #5423, #2958, #2079, #1947, #1131, #722)
|
||||
bool ImGui::TreeNodeGetOpen(ImGuiID storage_id)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@@ -6740,15 +6742,16 @@ bool ImGui::TreeNodeGetOpen(ImGuiID storage_id)
|
||||
return storage->GetInt(storage_id, 0) != 0;
|
||||
}
|
||||
|
||||
void ImGui::TreeNodeSetOpen(ImGuiID storage_id, bool open)
|
||||
void ImGui::TreeNodeSetOpen(ImGuiID storage_id, bool is_open)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiStorage* storage = g.CurrentWindow->DC.StateStorage;
|
||||
storage->SetInt(storage_id, open ? 1 : 0);
|
||||
storage->SetInt(storage_id, is_open ? 1 : 0);
|
||||
}
|
||||
|
||||
bool ImGui::TreeNodeUpdateNextOpen(ImGuiID storage_id, ImGuiTreeNodeFlags flags)
|
||||
{
|
||||
// Leaf node always open a new tree/id scope. If you never use it, add ImGuiTreeNodeFlags_NoTreePushOnOpen.
|
||||
if (flags & ImGuiTreeNodeFlags_Leaf)
|
||||
return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user