|
|
@@ -1,4 +1,4 @@
|
|
|
-// dear imgui, v1.89.7 WIP
|
|
|
+// dear imgui, v1.89.8 WIP
|
|
|
// (main code and documentation)
|
|
|
|
|
|
// Help:
|
|
|
@@ -9,22 +9,26 @@
|
|
|
|
|
|
// Resources:
|
|
|
// - FAQ http://dearimgui.com/faq
|
|
|
-// - Homepage & latest https://github.com/ocornut/imgui
|
|
|
+// - Homepage https://github.com/ocornut/imgui
|
|
|
// - Releases & changelog https://github.com/ocornut/imgui/releases
|
|
|
// - Gallery https://github.com/ocornut/imgui/issues/6478 (please post your screenshots/video there!)
|
|
|
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
|
|
+// - Getting Started https://github.com/ocornut/imgui/wiki/Getting-Started
|
|
|
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
|
|
// - Issues & support https://github.com/ocornut/imgui/issues
|
|
|
+// - Tests & Automation https://github.com/ocornut/imgui_test_engine
|
|
|
|
|
|
// Getting Started?
|
|
|
-// - For first-time users having issues compiling/linking/running or issues loading fonts:
|
|
|
+// - Read https://github.com/ocornut/imgui/wiki/Getting-Started
|
|
|
+// - For first-time users having issues compiling/linking/running/loading fonts:
|
|
|
// please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above.
|
|
|
|
|
|
// Developed by Omar Cornut and every direct or indirect contributors to the GitHub.
|
|
|
// See LICENSE.txt for copyright and licensing details (standard MIT License).
|
|
|
// This library is free but needs your support to sustain development and maintenance.
|
|
|
-// Businesses: you can support continued development via invoiced technical support, maintenance and sponsoring contracts. Please reach out to "contact AT dearimgui.com".
|
|
|
-// Individuals: you can support continued development via donations. See docs/README or web page.
|
|
|
+// Businesses: you can support continued development via B2B invoiced technical support, maintenance and sponsoring contracts.
|
|
|
+// PLEASE reach out at contact AT dearimgui DOT com. See https://github.com/ocornut/imgui/wiki/Sponsors
|
|
|
+// Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine.
|
|
|
|
|
|
// It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library.
|
|
|
// Note that 'ImGui::' being a namespace, you can add functions into the namespace from your own source files, without
|
|
|
@@ -107,9 +111,10 @@ CODE
|
|
|
- Portable, minimize dependencies, run on target (consoles, phones, etc.).
|
|
|
- Efficient runtime and memory consumption.
|
|
|
|
|
|
- Designed for developers and content-creators, not the typical end-user! Some of the current weaknesses includes:
|
|
|
+ Designed primarily for developers and content-creators, not the typical end-user!
|
|
|
+ Some of the current weaknesses (which we aim to address in the future) includes:
|
|
|
|
|
|
- - Doesn't look fancy, doesn't animate.
|
|
|
+ - Doesn't look fancy.
|
|
|
- Limited layout features, intricate layouts are typically crafted in code.
|
|
|
|
|
|
|
|
|
@@ -188,9 +193,11 @@ CODE
|
|
|
READ FIRST
|
|
|
----------
|
|
|
- Remember to check the wonderful Wiki (https://github.com/ocornut/imgui/wiki)
|
|
|
- - Your code creates the UI, if your code doesn't run the UI is gone! The UI can be highly dynamic, there are no construction or
|
|
|
- destruction steps, less superfluous data retention on your side, less state duplication, less state synchronization, fewer bugs.
|
|
|
+ - Your code creates the UI every frame of your application loop, if your code doesn't run the UI is gone!
|
|
|
+ The UI can be highly dynamic, there are no construction or destruction steps, less superfluous
|
|
|
+ data retention on your side, less state duplication, less state synchronization, fewer bugs.
|
|
|
- Call and read ImGui::ShowDemoWindow() for demo code demonstrating most features.
|
|
|
+ Or browse https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html for interactive web version.
|
|
|
- The library is designed to be built from sources. Avoid pre-compiled binaries and packaged versions. See imconfig.h to configure your build.
|
|
|
- Dear ImGui is an implementation of the IMGUI paradigm (immediate-mode graphical user interface, a term coined by Casey Muratori).
|
|
|
You can learn about IMGUI principles at http://www.johno.se/book/imgui.html, http://mollyrocket.com/861 & more links in Wiki.
|
|
|
@@ -198,18 +205,38 @@ CODE
|
|
|
For every application frame, your UI code will be called only once. This is in contrast to e.g. Unity's implementation of an IMGUI,
|
|
|
where the UI code is called multiple times ("multiple passes") from a single entry point. There are pros and cons to both approaches.
|
|
|
- Our origin is on the top-left. In axis aligned bounding boxes, Min = top-left, Max = bottom-right.
|
|
|
- - This codebase is also optimized to yield decent performances with typical "Debug" builds settings.
|
|
|
- Please make sure you have asserts enabled (IM_ASSERT redirects to assert() by default, but can be redirected).
|
|
|
If you get an assert, read the messages and comments around the assert.
|
|
|
- - C++: this is a very C-ish codebase: we don't rely on C++11, we don't include any C++ headers, and ImGui:: is a namespace.
|
|
|
- - C++: ImVec2/ImVec4 do not expose math operators by default, because it is expected that you use your own math types.
|
|
|
- See FAQ "How can I use my own math types instead of ImVec2/ImVec4?" for details about setting up imconfig.h for that.
|
|
|
- However, imgui_internal.h can optionally export math operators for ImVec2/ImVec4, which we use in this codebase.
|
|
|
- - C++: pay attention that ImVector<> manipulates plain-old-data and does not honor construction/destruction (avoid using it in your code!).
|
|
|
+ - This codebase aims to be highly optimized:
|
|
|
+ - A typical idle frame should never call malloc/free.
|
|
|
+ - We rely on a maximum of constant-time or O(N) algorithms. Limiting searches/scans as much as possible.
|
|
|
+ - We put particular energy in making sure performances are decent with typical "Debug" build settings as well.
|
|
|
+ Which mean we tend to avoid over-relying on "zero-cost abstraction" as they aren't zero-cost at all.
|
|
|
+ - This codebase aims to be both highly opinionated and highly flexible:
|
|
|
+ - This code works because of the things it choose to solve or not solve.
|
|
|
+ - C++: this is a pragmatic C-ish codebase: we don't use fancy C++ features, we don't include C++ headers,
|
|
|
+ and ImGui:: is a namespace. We rarely use member functions (and when we did, I am mostly regretting it now).
|
|
|
+ This is to increase compatibility, increase maintainability and facilitate use from other languages.
|
|
|
+ - C++: ImVec2/ImVec4 do not expose math operators by default, because it is expected that you use your own math types.
|
|
|
+ See FAQ "How can I use my own math types instead of ImVec2/ImVec4?" for details about setting up imconfig.h for that.
|
|
|
+ We can can optionally export math operators for ImVec2/ImVec4 using IMGUI_DEFINE_MATH_OPERATORS, which we use internally.
|
|
|
+ - C++: pay attention that ImVector<> manipulates plain-old-data and does not honor construction/destruction
|
|
|
+ (so don't use ImVector in your code or at our own risk!).
|
|
|
+ - Building: We don't use nor mandate a build system for the main library.
|
|
|
+ This is in an effort to ensure that it works in the real world aka with any esoteric build setup.
|
|
|
+ This is also because providing a build system for the main library would be of little-value.
|
|
|
+ The build problems are almost never coming from the main library but from specific backends.
|
|
|
|
|
|
|
|
|
HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI
|
|
|
----------------------------------------------
|
|
|
+ - Update submodule or copy/overwrite every file.
|
|
|
+ - About imconfig.h:
|
|
|
+ - You may modify your copy of imconfig.h, in this case don't overwrite it.
|
|
|
+ - or you may locally branch to modify imconfig.h and merge/rebase latest.
|
|
|
+ - or you may '#define IMGUI_USER_CONFIG "my_config_file.h"' globally from your build system to
|
|
|
+ specify a custom path for your imconfig.h file and instead not have to modify the default one.
|
|
|
+
|
|
|
- Overwrite all the sources files except for imconfig.h (if you have modified your copy of imconfig.h)
|
|
|
- Or maintain your own branch where you have imconfig.h modified as a top-most commit which you can regularly rebase over "master".
|
|
|
- You can also use '#define IMGUI_USER_CONFIG "my_config_file.h" to redirect configuration to your own file.
|
|
|
@@ -218,11 +245,12 @@ CODE
|
|
|
from the public API. If you have a problem with a missing function/symbols, search for its name in the code, there will
|
|
|
likely be a comment about it. Please report any issue to the GitHub page!
|
|
|
- To find out usage of old API, you can add '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in your configuration file.
|
|
|
- - Try to keep your copy of Dear ImGui reasonably up to date.
|
|
|
+ - Try to keep your copy of Dear ImGui reasonably up to date!
|
|
|
|
|
|
|
|
|
GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE
|
|
|
---------------------------------------------------------------
|
|
|
+ - See https://github.com/ocornut/imgui/wiki/Getting-Started.
|
|
|
- Run and study the examples and demo in imgui_demo.cpp to get acquainted with the library.
|
|
|
- In the majority of cases you should be able to use unmodified backends files available in the backends/ folder.
|
|
|
- Add the Dear ImGui source files + selected backend source files to your projects or using your preferred build system.
|
|
|
@@ -397,6 +425,7 @@ CODE
|
|
|
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
|
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
|
|
|
|
+ - 2023/07/12 (1.89.8) - ImDrawData: CmdLists now owned, changed from ImDrawList** to ImVector<ImDrawList*>. Majority of users shouldn't be affected, but you cannot compare to NULL nor reassign manually anymore. Instead use AddDrawList(). (#6406, #4879, #1878)
|
|
|
- 2023/06/28 (1.89.7) - overlapping items: obsoleted 'SetItemAllowOverlap()' (called after item) in favor of calling 'SetNextItemAllowOverlap()' (called before item). 'SetItemAllowOverlap()' didn't and couldn't work reliably since 1.89 (2022-11-15).
|
|
|
- 2023/06/28 (1.89.7) - overlapping items: renamed 'ImGuiTreeNodeFlags_AllowItemOverlap' to 'ImGuiTreeNodeFlags_AllowOverlap', 'ImGuiSelectableFlags_AllowItemOverlap' to 'ImGuiSelectableFlags_AllowOverlap'. Kept redirecting enums (will obsolete).
|
|
|
- 2023/06/28 (1.89.7) - overlapping items: IsItemHovered() now by default return false when querying an item using AllowOverlap mode which is being overlapped. Use ImGuiHoveredFlags_AllowWhenOverlappedByItem to revert to old behavior.
|
|
|
@@ -803,11 +832,12 @@ CODE
|
|
|
|
|
|
Q: Where is the documentation?
|
|
|
A: This library is poorly documented at the moment and expects the user to be acquainted with C/C++.
|
|
|
- - Run the examples/ and explore them.
|
|
|
+ - Run the examples/ applications and explore them.
|
|
|
+ - Read Getting Started (https://github.com/ocornut/imgui/wiki/Getting-Started) guide.
|
|
|
- See demo code in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function.
|
|
|
- The demo covers most features of Dear ImGui, so you can read the code and see its output.
|
|
|
- See documentation and comments at the top of imgui.cpp + effectively imgui.h.
|
|
|
- - Dozens of standalone example applications using e.g. OpenGL/DirectX are provided in the
|
|
|
+ - 20+ standalone example applications using e.g. OpenGL/DirectX are provided in the
|
|
|
examples/ folder to explain how to integrate Dear ImGui with your own engine/application.
|
|
|
- The Wiki (https://github.com/ocornut/imgui/wiki) has many resources and links.
|
|
|
- The Glossary (https://github.com/ocornut/imgui/wiki/Glossary) page also may be useful.
|
|
|
@@ -823,14 +853,14 @@ CODE
|
|
|
================
|
|
|
|
|
|
Q: How to get started?
|
|
|
- A: Read 'PROGRAMMER GUIDE' above. Read examples/README.txt.
|
|
|
+ A: Read https://github.com/ocornut/imgui/wiki/Getting-Started. Read 'PROGRAMMER GUIDE' above. Read examples/README.txt.
|
|
|
|
|
|
Q: How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?
|
|
|
A: You should read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags!
|
|
|
>> See https://www.dearimgui.com/faq for a fully detailed answer. You really want to read this.
|
|
|
|
|
|
- Q. How can I enable keyboard controls?
|
|
|
- Q: How can I use this without a mouse, without a keyboard or without a screen? (gamepad, input share, remote display)
|
|
|
+ Q. How can I enable keyboard or gamepad controls?
|
|
|
+ Q: How can I use this on a machine without mouse, keyboard or screen? (input share, remote display)
|
|
|
Q: I integrated Dear ImGui in my engine and little squares are showing instead of text...
|
|
|
Q: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...
|
|
|
Q: I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...
|
|
|
@@ -845,7 +875,7 @@ CODE
|
|
|
- How can I have multiple widgets with the same label?
|
|
|
- How can I have multiple windows with the same label?
|
|
|
Q: How can I display an image? What is ImTextureID, how does it work?
|
|
|
- Q: How can I use my own math types instead of ImVec2/ImVec4?
|
|
|
+ Q: How can I use my own math types instead of ImVec2?
|
|
|
Q: How can I interact with standard C++ types (such as std::string and std::vector)?
|
|
|
Q: How can I display custom shapes? (using low-level ImDrawList API)
|
|
|
>> See https://www.dearimgui.com/faq
|
|
|
@@ -875,10 +905,10 @@ CODE
|
|
|
Q: How can I help?
|
|
|
A: - Businesses: please reach out to "contact AT dearimgui.com" if you work in a place using Dear ImGui!
|
|
|
We can discuss ways for your company to fund development via invoiced technical support, maintenance or sponsoring contacts.
|
|
|
- This is among the most useful thing you can do for Dear ImGui. With increased funding, we can hire more people working on this project.
|
|
|
- - Individuals: you can support continued development via PayPal donations. See README.
|
|
|
- - If you are experienced with Dear ImGui and C++, look at the GitHub issues, look at the Wiki, read docs/TODO.txt
|
|
|
- and see how you want to help and can help!
|
|
|
+ This is among the most useful thing you can do for Dear ImGui. With increased funding, we sustain and grow work on this project.
|
|
|
+ Also see https://github.com/ocornut/imgui/wiki/Sponsors
|
|
|
+ - Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine.
|
|
|
+ - If you are experienced with Dear ImGui and C++, look at the GitHub issues, look at the Wiki, and see how you want to help and can help!
|
|
|
- Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.
|
|
|
You may post screenshot or links in the gallery threads. Visuals are ideal as they inspire other programmers.
|
|
|
But even without visuals, disclosing your use of dear imgui helps the library grow credibility, and help other teams and programmers with taking decisions.
|
|
|
@@ -904,11 +934,7 @@ CODE
|
|
|
|
|
|
// System includes
|
|
|
#include <stdio.h> // vsnprintf, sscanf, printf
|
|
|
-#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
|
|
-#include <stddef.h> // intptr_t
|
|
|
-#else
|
|
|
#include <stdint.h> // intptr_t
|
|
|
-#endif
|
|
|
|
|
|
// [Windows] On non-Visual Studio compilers, we default to IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS unless explicitly enabled
|
|
|
#if defined(_WIN32) && !defined(_MSC_VER) && !defined(IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)
|
|
|
@@ -1011,7 +1037,6 @@ static void FindHoveredWindow();
|
|
|
static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags);
|
|
|
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window);
|
|
|
|
|
|
-static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list);
|
|
|
static void AddWindowToSortBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, ImGuiWindow* window);
|
|
|
|
|
|
// Settings
|
|
|
@@ -1341,13 +1366,15 @@ void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// FIXME: Perhaps we could clear queued events as well?
|
|
|
-void ImGuiIO::ClearInputCharacters()
|
|
|
+// Clear all incoming events.
|
|
|
+void ImGuiIO::ClearEventsQueue()
|
|
|
{
|
|
|
- InputQueueCharacters.resize(0);
|
|
|
+ IM_ASSERT(Ctx != NULL);
|
|
|
+ ImGuiContext& g = *Ctx;
|
|
|
+ g.InputEventsQueue.clear();
|
|
|
}
|
|
|
|
|
|
-// FIXME: Perhaps we could clear queued events as well?
|
|
|
+// Clear current keyboard/mouse/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons.
|
|
|
void ImGuiIO::ClearInputKeys()
|
|
|
{
|
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
|
|
@@ -1368,8 +1395,18 @@ void ImGuiIO::ClearInputKeys()
|
|
|
MouseDownDuration[n] = MouseDownDurationPrev[n] = -1.0f;
|
|
|
}
|
|
|
MouseWheel = MouseWheelH = 0.0f;
|
|
|
+ InputQueueCharacters.resize(0); // Behavior of old ClearInputCharacters().
|
|
|
}
|
|
|
|
|
|
+// Removed this as it is ambiguous/misleading and generally incorrect to use with the existence of a higher-level input queue.
|
|
|
+// Current frame character buffer is now also cleared by ClearInputKeys().
|
|
|
+#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
|
+void ImGuiIO::ClearInputCharacters()
|
|
|
+{
|
|
|
+ InputQueueCharacters.resize(0);
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
static ImGuiInputEvent* FindLatestInputEvent(ImGuiContext* ctx, ImGuiInputEventType type, int arg = -1)
|
|
|
{
|
|
|
ImGuiContext& g = *ctx;
|
|
|
@@ -2906,7 +2943,7 @@ static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper)
|
|
|
const bool is_nav_request = (g.NavMoveScoringItems && g.NavWindow && g.NavWindow->RootWindowForNav == window->RootWindowForNav);
|
|
|
if (is_nav_request)
|
|
|
data->Ranges.push_back(ImGuiListClipperRange::FromPositions(g.NavScoringNoClipRect.Min.y, g.NavScoringNoClipRect.Max.y, 0, 0));
|
|
|
- if (is_nav_request && (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) && g.NavTabbingDir == -1)
|
|
|
+ if (is_nav_request && (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) && g.NavTabbingDir == -1)
|
|
|
data->Ranges.push_back(ImGuiListClipperRange::FromIndices(clipper->ItemsCount - 1, clipper->ItemsCount));
|
|
|
|
|
|
// Add focused/active item
|
|
|
@@ -4771,47 +4808,12 @@ static void AddWindowToSortBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, Im
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list)
|
|
|
-{
|
|
|
- if (draw_list->CmdBuffer.Size == 0)
|
|
|
- return;
|
|
|
- if (draw_list->CmdBuffer.Size == 1 && draw_list->CmdBuffer[0].ElemCount == 0 && draw_list->CmdBuffer[0].UserCallback == NULL)
|
|
|
- return;
|
|
|
-
|
|
|
- // Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc.
|
|
|
- // May trigger for you if you are using PrimXXX functions incorrectly.
|
|
|
- IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);
|
|
|
- IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);
|
|
|
- if (!(draw_list->Flags & ImDrawListFlags_AllowVtxOffset))
|
|
|
- IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);
|
|
|
-
|
|
|
- // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per ImDrawList = per window)
|
|
|
- // If this assert triggers because you are drawing lots of stuff manually:
|
|
|
- // - First, make sure you are coarse clipping yourself and not trying to draw many things outside visible bounds.
|
|
|
- // Be mindful that the ImDrawList API doesn't filter vertices. Use the Metrics/Debugger window to inspect draw list contents.
|
|
|
- // - If you want large meshes with more than 64K vertices, you can either:
|
|
|
- // (A) Handle the ImDrawCmd::VtxOffset value in your renderer backend, and set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset'.
|
|
|
- // Most example backends already support this from 1.71. Pre-1.71 backends won't.
|
|
|
- // Some graphics API such as GL ES 1/2 don't have a way to offset the starting vertex so it is not supported for them.
|
|
|
- // (B) Or handle 32-bit indices in your renderer backend, and uncomment '#define ImDrawIdx unsigned int' line in imconfig.h.
|
|
|
- // Most example backends already support this. For example, the OpenGL example code detect index size at compile-time:
|
|
|
- // glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);
|
|
|
- // Your own engine or render API may use different parameters or function calls to specify index sizes.
|
|
|
- // 2 and 4 bytes indices are generally supported by most graphics API.
|
|
|
- // - If for some reason neither of those solutions works for you, a workaround is to call BeginChild()/EndChild() before reaching
|
|
|
- // the 64K limit to split your draw commands in multiple draw lists.
|
|
|
- if (sizeof(ImDrawIdx) == 2)
|
|
|
- IM_ASSERT(draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above");
|
|
|
-
|
|
|
- out_list->push_back(draw_list);
|
|
|
-}
|
|
|
-
|
|
|
static void AddWindowToDrawData(ImGuiWindow* window, int layer)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiViewportP* viewport = g.Viewports[0];
|
|
|
g.IO.MetricsRenderWindows++;
|
|
|
- AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[layer], window->DrawList);
|
|
|
+ ImGui::AddDrawListToDrawDataEx(&viewport->DrawDataP, viewport->DrawDataBuilder.Layers[layer], window->DrawList);
|
|
|
for (int i = 0; i < window->DC.ChildWindows.Size; i++)
|
|
|
{
|
|
|
ImGuiWindow* child = window->DC.ChildWindows[i];
|
|
|
@@ -4831,42 +4833,41 @@ static inline void AddRootWindowToDrawData(ImGuiWindow* window)
|
|
|
AddWindowToDrawData(window, GetWindowDisplayLayer(window));
|
|
|
}
|
|
|
|
|
|
-void ImDrawDataBuilder::FlattenIntoSingleLayer()
|
|
|
+static void FlattenDrawDataIntoSingleLayer(ImDrawDataBuilder* builder)
|
|
|
{
|
|
|
- int n = Layers[0].Size;
|
|
|
- int size = n;
|
|
|
- for (int i = 1; i < IM_ARRAYSIZE(Layers); i++)
|
|
|
- size += Layers[i].Size;
|
|
|
- Layers[0].resize(size);
|
|
|
- for (int layer_n = 1; layer_n < IM_ARRAYSIZE(Layers); layer_n++)
|
|
|
+ int n = builder->Layers[0]->Size;
|
|
|
+ int full_size = n;
|
|
|
+ for (int i = 1; i < IM_ARRAYSIZE(builder->Layers); i++)
|
|
|
+ full_size += builder->Layers[i]->Size;
|
|
|
+ builder->Layers[0]->resize(full_size);
|
|
|
+ for (int layer_n = 1; layer_n < IM_ARRAYSIZE(builder->Layers); layer_n++)
|
|
|
{
|
|
|
- ImVector<ImDrawList*>& layer = Layers[layer_n];
|
|
|
- if (layer.empty())
|
|
|
+ ImVector<ImDrawList*>* layer = builder->Layers[layer_n];
|
|
|
+ if (layer->empty())
|
|
|
continue;
|
|
|
- memcpy(&Layers[0][n], &layer[0], layer.Size * sizeof(ImDrawList*));
|
|
|
- n += layer.Size;
|
|
|
- layer.resize(0);
|
|
|
+ memcpy(builder->Layers[0]->Data + n, layer->Data, layer->Size * sizeof(ImDrawList*));
|
|
|
+ n += layer->Size;
|
|
|
+ layer->resize(0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static void SetupViewportDrawData(ImGuiViewportP* viewport, ImVector<ImDrawList*>* draw_lists)
|
|
|
+static void InitViewportDrawData(ImGuiViewportP* viewport)
|
|
|
{
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
ImDrawData* draw_data = &viewport->DrawDataP;
|
|
|
+
|
|
|
+ viewport->DrawDataBuilder.Layers[0] = &draw_data->CmdLists;
|
|
|
+ viewport->DrawDataBuilder.Layers[1] = &viewport->DrawDataBuilder.LayerData1;
|
|
|
+ viewport->DrawDataBuilder.Layers[0]->resize(0);
|
|
|
+ viewport->DrawDataBuilder.Layers[1]->resize(0);
|
|
|
+
|
|
|
draw_data->Valid = true;
|
|
|
- draw_data->CmdLists = (draw_lists->Size > 0) ? draw_lists->Data : NULL;
|
|
|
- draw_data->CmdListsCount = draw_lists->Size;
|
|
|
+ draw_data->CmdListsCount = 0;
|
|
|
draw_data->TotalVtxCount = draw_data->TotalIdxCount = 0;
|
|
|
draw_data->DisplayPos = viewport->Pos;
|
|
|
draw_data->DisplaySize = viewport->Size;
|
|
|
draw_data->FramebufferScale = io.DisplayFramebufferScale;
|
|
|
- for (int n = 0; n < draw_lists->Size; n++)
|
|
|
- {
|
|
|
- ImDrawList* draw_list = draw_lists->Data[n];
|
|
|
- draw_list->_PopUnusedDrawCmd();
|
|
|
- draw_data->TotalVtxCount += draw_list->VtxBuffer.Size;
|
|
|
- draw_data->TotalIdxCount += draw_list->IdxBuffer.Size;
|
|
|
- }
|
|
|
+ draw_data->OwnerViewport = viewport;
|
|
|
}
|
|
|
|
|
|
// Push a clipping rectangle for both ImGui logic (hit-testing etc.) and low-level ImDrawList rendering.
|
|
|
@@ -4905,14 +4906,14 @@ static void ImGui::RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32
|
|
|
ImDrawList* draw_list = window->RootWindow->DrawList;
|
|
|
if (draw_list->CmdBuffer.Size == 0)
|
|
|
draw_list->AddDrawCmd();
|
|
|
- draw_list->PushClipRect(viewport_rect.Min - ImVec2(1, 1), viewport_rect.Max + ImVec2(1, 1), false); // Ensure ImDrawCmd are not merged
|
|
|
+ draw_list->PushClipRect(viewport_rect.Min - ImVec2(1, 1), viewport_rect.Max + ImVec2(1, 1), false); // FIXME: Need to stricty ensure ImDrawCmd are not merged (ElemCount==6 checks below will verify that)
|
|
|
draw_list->AddRectFilled(viewport_rect.Min, viewport_rect.Max, col);
|
|
|
ImDrawCmd cmd = draw_list->CmdBuffer.back();
|
|
|
IM_ASSERT(cmd.ElemCount == 6);
|
|
|
draw_list->CmdBuffer.pop_back();
|
|
|
draw_list->CmdBuffer.push_front(cmd);
|
|
|
- draw_list->PopClipRect();
|
|
|
draw_list->AddDrawCmd(); // We need to create a command as CmdBuffer.back().IdxOffset won't be correct if we append to same command.
|
|
|
+ draw_list->PopClipRect();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -5087,9 +5088,9 @@ void ImGui::Render()
|
|
|
for (int n = 0; n != g.Viewports.Size; n++)
|
|
|
{
|
|
|
ImGuiViewportP* viewport = g.Viewports[n];
|
|
|
- viewport->DrawDataBuilder.Clear();
|
|
|
+ InitViewportDrawData(viewport);
|
|
|
if (viewport->DrawLists[0] != NULL)
|
|
|
- AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetBackgroundDrawList(viewport));
|
|
|
+ AddDrawListToDrawDataEx(&viewport->DrawDataP, viewport->DrawDataBuilder.Layers[0], GetBackgroundDrawList(viewport));
|
|
|
}
|
|
|
|
|
|
// Draw modal/window whitening backgrounds
|
|
|
@@ -5120,14 +5121,18 @@ void ImGui::Render()
|
|
|
for (int n = 0; n < g.Viewports.Size; n++)
|
|
|
{
|
|
|
ImGuiViewportP* viewport = g.Viewports[n];
|
|
|
- viewport->DrawDataBuilder.FlattenIntoSingleLayer();
|
|
|
+ FlattenDrawDataIntoSingleLayer(&viewport->DrawDataBuilder);
|
|
|
|
|
|
// Add foreground ImDrawList (for each active viewport)
|
|
|
if (viewport->DrawLists[1] != NULL)
|
|
|
- AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetForegroundDrawList(viewport));
|
|
|
+ AddDrawListToDrawDataEx(&viewport->DrawDataP, viewport->DrawDataBuilder.Layers[0], GetForegroundDrawList(viewport));
|
|
|
|
|
|
- SetupViewportDrawData(viewport, &viewport->DrawDataBuilder.Layers[0]);
|
|
|
+ // We call _PopUnusedDrawCmd() last thing, as RenderDimmedBackgrounds() rely on a valid command being there (especially in docking branch).
|
|
|
ImDrawData* draw_data = &viewport->DrawDataP;
|
|
|
+ IM_ASSERT(draw_data->CmdLists.Size == draw_data->CmdListsCount);
|
|
|
+ for (int draw_list_n = 0; draw_list_n < draw_data->CmdLists.Size; draw_list_n++)
|
|
|
+ draw_data->CmdLists[draw_list_n]->_PopUnusedDrawCmd();
|
|
|
+
|
|
|
g.IO.MetricsRenderVertices += draw_data->TotalVtxCount;
|
|
|
g.IO.MetricsRenderIndices += draw_data->TotalIdxCount;
|
|
|
}
|
|
|
@@ -7653,7 +7658,7 @@ void ImGui::FocusItem()
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_Tabbing | ImGuiNavMoveFlags_FocusApi | ImGuiNavMoveFlags_NoSelect;
|
|
|
+ ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_IsTabbing | ImGuiNavMoveFlags_FocusApi | ImGuiNavMoveFlags_NoSelect;
|
|
|
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
|
|
SetNavWindow(window);
|
|
|
NavMoveRequestSubmit(ImGuiDir_None, ImGuiDir_Up, move_flags, scroll_flags);
|
|
|
@@ -7688,7 +7693,7 @@ void ImGui::SetKeyboardFocusHere(int offset)
|
|
|
|
|
|
SetNavWindow(window);
|
|
|
|
|
|
- ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_Tabbing | ImGuiNavMoveFlags_Activate | ImGuiNavMoveFlags_FocusApi;
|
|
|
+ ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_IsTabbing | ImGuiNavMoveFlags_Activate | ImGuiNavMoveFlags_FocusApi;
|
|
|
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
|
|
NavMoveRequestSubmit(ImGuiDir_None, offset < 0 ? ImGuiDir_Up : ImGuiDir_Down, move_flags, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable.
|
|
|
if (offset == -1)
|
|
|
@@ -8621,14 +8626,12 @@ static void ImGui::UpdateMouseInputs()
|
|
|
else
|
|
|
io.MouseDelta = ImVec2(0.0f, 0.0f);
|
|
|
|
|
|
- // Update stationary timer. Only reset on 2 successive moving frames.
|
|
|
- // FIXME: May need to expose threshold or treat touch inputs differently.
|
|
|
+ // Update stationary timer.
|
|
|
+ // FIXME: May need to rework again to have some tolerance for occasional small movement, while being functional on high-framerates.
|
|
|
const float mouse_stationary_threshold = (io.MouseSource == ImGuiMouseSource_Mouse) ? 2.0f : 3.0f; // Slightly higher threshold for ImGuiMouseSource_TouchScreen/ImGuiMouseSource_Pen, may need rework.
|
|
|
- g.MouseMovingFrames = (ImLengthSqr(io.MouseDelta) >= mouse_stationary_threshold * mouse_stationary_threshold) ? (g.MouseMovingFrames + 1) : 0;
|
|
|
- if (g.MouseMovingFrames == 0)
|
|
|
- g.MouseStationaryTimer += io.DeltaTime;
|
|
|
- else if (g.MouseMovingFrames > 1)
|
|
|
- g.MouseStationaryTimer = 0.0f;
|
|
|
+ const bool mouse_stationary = (ImLengthSqr(io.MouseDelta) <= mouse_stationary_threshold * mouse_stationary_threshold);
|
|
|
+ g.MouseStationaryTimer = mouse_stationary ? (g.MouseStationaryTimer + io.DeltaTime) : 0.0f;
|
|
|
+ //IMGUI_DEBUG_LOG("%.4f\n", g.MouseStationaryTimer);
|
|
|
|
|
|
// If mouse moved we re-enable mouse hovering in case it was disabled by gamepad/keyboard. In theory should use a >0.0f threshold but would need to reset in everywhere we set this to true.
|
|
|
if (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f)
|
|
|
@@ -11060,7 +11063,7 @@ static void ImGui::NavProcessItem()
|
|
|
// FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRect + scoring from a rect wrapped according to current wrapping policy)
|
|
|
if (g.NavMoveScoringItems && (item_flags & ImGuiItemFlags_Disabled) == 0)
|
|
|
{
|
|
|
- const bool is_tabbing = (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) != 0;
|
|
|
+ const bool is_tabbing = (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) != 0;
|
|
|
if (is_tabbing)
|
|
|
{
|
|
|
NavProcessItemForTabbingRequest(id, item_flags, g.NavMoveFlags);
|
|
|
@@ -11166,7 +11169,7 @@ void ImGui::NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavM
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
IM_ASSERT(g.NavWindow != NULL);
|
|
|
|
|
|
- if (move_flags & ImGuiNavMoveFlags_Tabbing)
|
|
|
+ if (move_flags & ImGuiNavMoveFlags_IsTabbing)
|
|
|
move_flags |= ImGuiNavMoveFlags_AllowCurrentNavId;
|
|
|
|
|
|
g.NavMoveSubmitted = g.NavMoveScoringItems = true;
|
|
|
@@ -11714,7 +11717,7 @@ void ImGui::NavUpdateCreateTabbingRequest()
|
|
|
g.NavTabbingDir = g.IO.KeyShift ? -1 : (g.NavDisableHighlight == true && g.ActiveId == 0) ? 0 : +1;
|
|
|
else
|
|
|
g.NavTabbingDir = g.IO.KeyShift ? -1 : (g.ActiveId == 0) ? 0 : +1;
|
|
|
- ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_Tabbing | ImGuiNavMoveFlags_Activate;
|
|
|
+ ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_IsTabbing | ImGuiNavMoveFlags_Activate;
|
|
|
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
|
|
ImGuiDir clip_dir = (g.NavTabbingDir < 0) ? ImGuiDir_Up : ImGuiDir_Down;
|
|
|
NavMoveRequestSubmit(ImGuiDir_None, clip_dir, move_flags, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable.
|
|
|
@@ -11734,7 +11737,7 @@ void ImGui::NavMoveRequestApplyResult()
|
|
|
ImGuiNavItemData* result = (g.NavMoveResultLocal.ID != 0) ? &g.NavMoveResultLocal : (g.NavMoveResultOther.ID != 0) ? &g.NavMoveResultOther : NULL;
|
|
|
|
|
|
// Tabbing forward wrap
|
|
|
- if ((g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) && result == NULL)
|
|
|
+ if ((g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) && result == NULL)
|
|
|
if ((g.NavTabbingCounter == 1 || g.NavTabbingDir == 0) && g.NavTabbingResultFirst.ID)
|
|
|
result = &g.NavTabbingResultFirst;
|
|
|
|
|
|
@@ -11742,7 +11745,7 @@ void ImGui::NavMoveRequestApplyResult()
|
|
|
const ImGuiAxis axis = (g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down) ? ImGuiAxis_Y : ImGuiAxis_X;
|
|
|
if (result == NULL)
|
|
|
{
|
|
|
- if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
|
|
+ if (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing)
|
|
|
g.NavMoveFlags |= ImGuiNavMoveFlags_NoSetNavHighlight;
|
|
|
if (g.NavId != 0 && (g.NavMoveFlags & ImGuiNavMoveFlags_NoSetNavHighlight) == 0)
|
|
|
NavRestoreHighlightAfterMove();
|
|
|
@@ -11783,9 +11786,11 @@ void ImGui::NavMoveRequestApplyResult()
|
|
|
}
|
|
|
if (g.ActiveId != result->ID)
|
|
|
ClearActiveID();
|
|
|
- if (g.NavId != result->ID && (g.NavMoveFlags & ImGuiNavMoveFlags_NoSelect) == 0)
|
|
|
+
|
|
|
+ // Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId)
|
|
|
+ // PageUp/PageDown however sets always set NavJustMovedTo (vs Home/End which doesn't) mimicking Windows behavior.
|
|
|
+ if ((g.NavId != result->ID || (g.NavMoveFlags & ImGuiNavMoveFlags_IsPageMove)) && (g.NavMoveFlags & ImGuiNavMoveFlags_NoSelect) == 0)
|
|
|
{
|
|
|
- // Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId)
|
|
|
g.NavJustMovedToId = result->ID;
|
|
|
g.NavJustMovedToFocusScopeId = result->FocusScopeId;
|
|
|
g.NavJustMovedToKeyMods = g.NavMoveKeyMods;
|
|
|
@@ -11798,14 +11803,14 @@ void ImGui::NavMoveRequestApplyResult()
|
|
|
|
|
|
// Restore last preferred position for current axis
|
|
|
// (storing in RootWindowForNav-> as the info is desirable at the beginning of a Move Request. In theory all storage should use RootWindowForNav..)
|
|
|
- if ((g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) == 0)
|
|
|
+ if ((g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) == 0)
|
|
|
{
|
|
|
preferred_scoring_pos_rel[axis] = result->RectRel.GetCenter()[axis];
|
|
|
g.NavWindow->RootWindowForNav->NavPreferredScoringPosRel[g.NavLayer] = preferred_scoring_pos_rel;
|
|
|
}
|
|
|
|
|
|
// Tabbing: Activates Inputable, otherwise only Focus
|
|
|
- if ((g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) && (result->InFlags & ImGuiItemFlags_Inputable) == 0)
|
|
|
+ if ((g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) && (result->InFlags & ImGuiItemFlags_Inputable) == 0)
|
|
|
g.NavMoveFlags &= ~ImGuiNavMoveFlags_Activate;
|
|
|
|
|
|
// Activate
|
|
|
@@ -11814,7 +11819,7 @@ void ImGui::NavMoveRequestApplyResult()
|
|
|
g.NavNextActivateId = result->ID;
|
|
|
g.NavNextActivateFlags = ImGuiActivateFlags_None;
|
|
|
g.NavMoveFlags |= ImGuiNavMoveFlags_NoSetNavHighlight;
|
|
|
- if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
|
|
+ if (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing)
|
|
|
g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState;
|
|
|
}
|
|
|
|
|
|
@@ -11914,14 +11919,14 @@ static float ImGui::NavUpdatePageUpPageDown()
|
|
|
nav_scoring_rect_offset_y = -page_offset_y;
|
|
|
g.NavMoveDir = ImGuiDir_Down; // Because our scoring rect is offset up, we request the down direction (so we can always land on the last item)
|
|
|
g.NavMoveClipDir = ImGuiDir_Up;
|
|
|
- g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet;
|
|
|
+ g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet | ImGuiNavMoveFlags_IsPageMove;
|
|
|
}
|
|
|
else if (IsKeyPressed(ImGuiKey_PageDown, true))
|
|
|
{
|
|
|
nav_scoring_rect_offset_y = +page_offset_y;
|
|
|
g.NavMoveDir = ImGuiDir_Up; // Because our scoring rect is offset down, we request the up direction (so we can always land on the last item)
|
|
|
g.NavMoveClipDir = ImGuiDir_Down;
|
|
|
- g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet;
|
|
|
+ g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet | ImGuiNavMoveFlags_IsPageMove;
|
|
|
}
|
|
|
else if (home_pressed)
|
|
|
{
|
|
|
@@ -13850,7 +13855,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
// DrawLists
|
|
|
int drawlist_count = 0;
|
|
|
for (int viewport_i = 0; viewport_i < g.Viewports.Size; viewport_i++)
|
|
|
- drawlist_count += g.Viewports[viewport_i]->DrawDataBuilder.GetDrawListCount();
|
|
|
+ drawlist_count += g.Viewports[viewport_i]->DrawDataP.CmdLists.Size;
|
|
|
if (TreeNode("DrawLists", "DrawLists (%d)", drawlist_count))
|
|
|
{
|
|
|
Checkbox("Show ImDrawCmd mesh when hovering", &cfg->ShowDrawCmdMesh);
|
|
|
@@ -13858,9 +13863,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
for (int viewport_i = 0; viewport_i < g.Viewports.Size; viewport_i++)
|
|
|
{
|
|
|
ImGuiViewportP* viewport = g.Viewports[viewport_i];
|
|
|
- for (int layer_i = 0; layer_i < IM_ARRAYSIZE(viewport->DrawDataBuilder.Layers); layer_i++)
|
|
|
- for (int draw_list_i = 0; draw_list_i < viewport->DrawDataBuilder.Layers[layer_i].Size; draw_list_i++)
|
|
|
- DebugNodeDrawList(NULL, viewport->DrawDataBuilder.Layers[layer_i][draw_list_i], "DrawList");
|
|
|
+ for (int draw_list_i = 0; draw_list_i < viewport->DrawDataP.CmdLists.Size; draw_list_i++)
|
|
|
+ DebugNodeDrawList(NULL, viewport, viewport->DrawDataP.CmdLists[draw_list_i], "DrawList");
|
|
|
}
|
|
|
TreePop();
|
|
|
}
|
|
|
@@ -14192,9 +14196,10 @@ void ImGui::DebugNodeColumns(ImGuiOldColumns* columns)
|
|
|
}
|
|
|
|
|
|
// [DEBUG] Display contents of ImDrawList
|
|
|
-void ImGui::DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label)
|
|
|
+void ImGui::DebugNodeDrawList(ImGuiWindow* window, ImGuiViewportP* viewport, const ImDrawList* draw_list, const char* label)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
+ IM_UNUSED(viewport); // Used in docking branch
|
|
|
ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;
|
|
|
int cmd_count = draw_list->CmdBuffer.Size;
|
|
|
if (cmd_count > 0 && draw_list->CmdBuffer.back().ElemCount == 0 && draw_list->CmdBuffer.back().UserCallback == NULL)
|
|
|
@@ -14483,9 +14488,8 @@ void ImGui::DebugNodeViewport(ImGuiViewportP* viewport)
|
|
|
(flags & ImGuiViewportFlags_IsPlatformWindow) ? " IsPlatformWindow" : "",
|
|
|
(flags & ImGuiViewportFlags_IsPlatformMonitor) ? " IsPlatformMonitor" : "",
|
|
|
(flags & ImGuiViewportFlags_OwnedByApp) ? " OwnedByApp" : "");
|
|
|
- for (int layer_i = 0; layer_i < IM_ARRAYSIZE(viewport->DrawDataBuilder.Layers); layer_i++)
|
|
|
- for (int draw_list_i = 0; draw_list_i < viewport->DrawDataBuilder.Layers[layer_i].Size; draw_list_i++)
|
|
|
- DebugNodeDrawList(NULL, viewport->DrawDataBuilder.Layers[layer_i][draw_list_i], "DrawList");
|
|
|
+ for (int draw_list_i = 0; draw_list_i < viewport->DrawDataP.CmdLists.Size; draw_list_i++)
|
|
|
+ DebugNodeDrawList(NULL, viewport, viewport->DrawDataP.CmdLists[draw_list_i], "DrawList");
|
|
|
TreePop();
|
|
|
}
|
|
|
}
|
|
|
@@ -14513,7 +14517,7 @@ void ImGui::DebugNodeWindow(ImGuiWindow* window, const char* label)
|
|
|
TextDisabled("Note: some memory buffers have been compacted/freed.");
|
|
|
|
|
|
ImGuiWindowFlags flags = window->Flags;
|
|
|
- DebugNodeDrawList(window, window->DrawList, "DrawList");
|
|
|
+ DebugNodeDrawList(window, window->Viewport, window->DrawList, "DrawList");
|
|
|
BulletText("Pos: (%.1f,%.1f), Size: (%.1f,%.1f), ContentSize (%.1f,%.1f) Ideal (%.1f,%.1f)", window->Pos.x, window->Pos.y, window->Size.x, window->Size.y, window->ContentSize.x, window->ContentSize.y, window->ContentSizeIdeal.x, window->ContentSizeIdeal.y);
|
|
|
BulletText("Flags: 0x%08X (%s%s%s%s%s%s%s%s%s..)", flags,
|
|
|
(flags & ImGuiWindowFlags_ChildWindow) ? "Child " : "", (flags & ImGuiWindowFlags_Tooltip) ? "Tooltip " : "", (flags & ImGuiWindowFlags_Popup) ? "Popup " : "",
|
|
|
@@ -14929,7 +14933,7 @@ void ImGui::ShowStackToolWindow(bool* p_open)
|
|
|
void ImGui::ShowMetricsWindow(bool*) {}
|
|
|
void ImGui::ShowFontAtlas(ImFontAtlas*) {}
|
|
|
void ImGui::DebugNodeColumns(ImGuiOldColumns*) {}
|
|
|
-void ImGui::DebugNodeDrawList(ImGuiWindow*, const ImDrawList*, const char*) {}
|
|
|
+void ImGui::DebugNodeDrawList(ImGuiWindow*, ImGuiViewportP*, const ImDrawList*, const char*) {}
|
|
|
void ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList*, const ImDrawList*, const ImDrawCmd*, bool, bool) {}
|
|
|
void ImGui::DebugNodeFont(ImFont*) {}
|
|
|
void ImGui::DebugNodeStorage(ImGuiStorage*, const char*) {}
|