mirror of https://github.com/ocornut/imgui
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_sdl3.cpp # docs/CHANGELOG.txt # imgui.cpp # imgui.h # imgui_internal.h
This commit is contained in:
commit
f63c95a076
|
@ -576,7 +576,11 @@ void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows)
|
|||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
EM_JS(void, ImGui_ImplGlfw_EmscriptenOpenURL, (char const* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank'); });
|
||||
#if EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3 >= 3'4'0'20240817
|
||||
void ImGui_ImplGlfw_EmscriptenOpenURL(const char* url) { if (url) emscripten::glfw3::OpenURL(url); }
|
||||
#else
|
||||
EM_JS(void, ImGui_ImplGlfw_EmscriptenOpenURL, (const char* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank'); });
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||
// (Info: SDL3 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
||||
|
||||
// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN**)
|
||||
// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN AS SDL3 CHANGES.**)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Clipboard support.
|
||||
|
@ -26,6 +26,7 @@
|
|||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2024-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2024-09-03: Update for SDL3 api changes: SDL_GetGamepads() memory ownership revert. (#7918, #7898, #7807)
|
||||
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
|
||||
// - io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn
|
||||
// - io.SetClipboardTextFn -> platform_io.Platform_SetClipboardTextFn
|
||||
|
@ -763,7 +764,7 @@ static void ImGui_ImplSDL3_UpdateGamepads()
|
|||
{
|
||||
ImGui_ImplSDL3_CloseGamepads();
|
||||
int sdl_gamepads_count = 0;
|
||||
const SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
|
||||
SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
|
||||
for (int n = 0; n < sdl_gamepads_count; n++)
|
||||
if (SDL_Gamepad* gamepad = SDL_OpenGamepad(sdl_gamepads[n]))
|
||||
{
|
||||
|
@ -772,6 +773,7 @@ static void ImGui_ImplSDL3_UpdateGamepads()
|
|||
break;
|
||||
}
|
||||
bd->WantUpdateGamepadsList = false;
|
||||
SDL_free(sdl_gamepads);
|
||||
}
|
||||
|
||||
// FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||
// (Info: SDL3 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
||||
|
||||
// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN**)
|
||||
// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN AS SDL3 CHANGES.**)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Clipboard support.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// dear imgui: Renderer Backend for SDL_Renderer for SDL3
|
||||
// (Requires: SDL 3.0.0+)
|
||||
|
||||
// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN AS SDL3 CHANGES.**)
|
||||
|
||||
// Note how SDL_Renderer is an _optional_ component of SDL3.
|
||||
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
||||
// If your application will want to render any non trivial amount of graphics other than UI,
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// dear imgui: Renderer Backend for SDL_Renderer for SDL3
|
||||
// (Requires: SDL 3.0.0+)
|
||||
|
||||
// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN AS SDL3 CHANGES.**)
|
||||
|
||||
// Note how SDL_Renderer is an _optional_ component of SDL3.
|
||||
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
||||
// If your application will want to render any non trivial amount of graphics other than UI,
|
||||
|
|
|
@ -36,9 +36,11 @@ HOW TO UPDATE?
|
|||
- Please report any issue!
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.91.1 WIP (In Progress)
|
||||
VERSION 1.91.1 (Released 2024-09-04)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.91.1
|
||||
|
||||
Breaking changes:
|
||||
|
||||
- BeginChild(): renamed ImGuiChildFlags_Border to ImGuiChildFlags_Borders for consistency. [@cfillion]
|
||||
|
@ -54,7 +56,6 @@ Breaking changes:
|
|||
- io.PlatformOpenInShellFn -> platform_io.Platform_OpenInShellFn (#7660)
|
||||
- io.PlatformSetImeDataFn -> platform_io.Platform_SetImeDataFn
|
||||
- io.PlatformLocaleDecimalPoint -> platform_io.Platform_LocaleDecimalPoint (#7389, #6719, #2278)
|
||||
- clipboard function signature changed:
|
||||
- access those via GetPlatformIO() instead of GetIO().
|
||||
(Because PlatformOpenInShellFn and PlatformSetImeDataFn were introduced very recently and
|
||||
often automatically set by core library and backends, we are exceptionally not maintaining
|
||||
|
@ -63,45 +64,59 @@ Breaking changes:
|
|||
- old ImageButton() used ImTextureId as item id (created issue with e.g. multiple buttons in same scope, transient texture id values, opaque computation of ID)
|
||||
- new ImageButton() requires an explicit 'const char* str_id'
|
||||
- old ImageButton() had frame_padding' override argument.
|
||||
- new ImageButton() always use style.FramePadding, which you can freely override with PushStyleVar()/PopStyleVar().
|
||||
- new ImageButton() always use style.FramePadding, which you can modify using PushStyleVar()/PopStyleVar().
|
||||
|
||||
Other changes:
|
||||
|
||||
- IO: Added GetPlatformIO() and ImGuiPlatformIO, pulled from 'docking' branch, which
|
||||
is a centralized spot to connect os/platform/renderer related functions.
|
||||
Clipboard, IME and OpenInShell hooks are moved here. (#7660)
|
||||
- IO, InputText: fixed an issue where typing text in a InputText() would defer character
|
||||
- IO, InputText: fixed an issue where typing text in an InputText() would defer character
|
||||
processing by one frame, because of the trickling input queue. Reworked interleaved
|
||||
keys<>char trickling to take account for keys known to input characters. (#7889, #4921, #4858)
|
||||
- Windows: adjust default ClipRect to better match rendering of thick borders (which are in
|
||||
theory not supported). Compensate for the fact that borders are centered around the windows
|
||||
edge rather than inner. (#7887, #7888 + #3312, #7540, #3756, #6170, #6365)
|
||||
- MultiSelect+TreeNode+Drag and Drop: fixed an issue where carrying a drag and drop
|
||||
payload over an already open tree node would incorrectly select it. (#7850)
|
||||
- MultiSelect+TreeNode: default open behavior is OpenOnDoubleClick + OpenOnArrow
|
||||
when used in a multi-select context without any OpenOnXXX flags set. (#7850)
|
||||
- Made BeginItemTooltip() and IsItemHovered() with delay flag infer an implicit ID (for
|
||||
ID-less items such as Text element) in a way that works when item resizes. (#7945, #1485)
|
||||
- MultiSelect+TreeNode+Drag and Drop: fixed an issue where carrying a drag and drop payload
|
||||
over an already open tree node using multi-select would incorrectly select it. (#7850)
|
||||
- MultiSelect+TreeNode: default open behavior is _OpenOnDoubleClick + _OpenOnArrow when
|
||||
used in a multi-select context without any ImGuiTreeNode_OpenOnXXX flags set. (#7850)
|
||||
- Tables: fixes/revert a 1.90 change were outer border would be moved bottom and right
|
||||
by an extra pixel + rework the change so that contents doesn't overlap the bottom and
|
||||
right border in a scrolling table. (#6765, #3752, #7428)
|
||||
- Tables: fixed an issue resizing columns or querying hovered column/row when using multiple
|
||||
synched instances that are layed out at different X positions. (#7933)
|
||||
- Tabs: avoid queuing a refocus when tab is already focused, which would have the
|
||||
side-effect of e.g. closing popup on a mouse release. (#7914)
|
||||
- InputText: allow callback to update buffer while in read-only mode. (imgui_club/#46)
|
||||
- InputText: fixed an issue programmatically refocusing a multi-line input which was just active. (#4761, #7870)
|
||||
- TextLink(), TextLinkOpenURL(): change mouse cursor to Hand shape when hovered. (#7885, #7660)
|
||||
- Tooltips, Drag and Drop: made it possible to override BeginTooltip() position while inside
|
||||
a drag and drop source or target: a SetNextWindowPos() call won't be overriden. (#6973)
|
||||
- Style: added PushStyleVarX(), PushStyleVarY() helpers to modify only one component of a ImVec2 var.
|
||||
- Fonts: made it possible to use PushFont()/PopFont() calls accross Begin() calls. (#3224, #3875, #6398, #7903)
|
||||
- Backends: GLFW: added ImGui_ImplGlfw_Sleep() helper function because GLFW does not
|
||||
provide a way to do a portable sleep. (#7844)
|
||||
- Backends: SDL2, SDL3: ignore events of other SDL windows. (#7853) [@madebr, @ocornut]
|
||||
- Backends: SDL2, SDL3: storing SDL_WindowID inside ImGuiViewport::PlatformHandle instead of SDL_Window*.
|
||||
- Backends: GLFW: passing null window to glfwGetClipboardString()/glfwSetClipboardString()
|
||||
since GLFW own tests are doing that and it seems unnecessary.
|
||||
- Backends: SDL2, SDL3, GLFW, OSX, Allegro: update to set function handlers in ImGuiPlatformIO
|
||||
instead of ImGuiIO.
|
||||
- Examples: GLFW (all), SDL2 (all), SDL3 (all), Win32+OpenGL3: rework examples main loop
|
||||
to handle minimization without burning CPU or GPU by running unthrottled code. (#7844)
|
||||
a drag and drop source or target: a SetNextWindowPos() call won't be overridden. (#6973)
|
||||
- PlotHistogram, PlotLines: register item ID and use button behavior in a more idiomatic manner,
|
||||
fixes preventing e.g. GetItemID() and other ID-based helper to work. (#7935, #3072)
|
||||
- Style: added PushStyleVarX(), PushStyleVarY() helpers to conveniently modify only
|
||||
one component of a ImVec2 var.
|
||||
- Fonts: made it possible to use PushFont()/PopFont() calls across Begin() calls. (#3224, #3875, #6398, #7903)
|
||||
- Backends:
|
||||
- Backends: GLFW: added ImGui_ImplGlfw_Sleep() helper function because GLFW does not
|
||||
provide a way to do a portable sleep. (#7844)
|
||||
- Backends: GLFW+Emscripten: Use OpenURL() from GLFW3 contrib port when available and using
|
||||
the contrib port instead of Emscripten own GLFW3 implementation. (#7647, #7915, #7660) [@ypujante]
|
||||
- Backends: SDL2, SDL3: ignore events of other SDL windows. (#7853) [@madebr, @ocornut]
|
||||
- Backends: SDL2, SDL3: storing SDL_WindowID inside ImGuiViewport::PlatformHandle instead of SDL_Window*.
|
||||
- Backends: SDL3: Update for API changes: SDL_GetGamepads() memory ownership logic was reverted back
|
||||
by SDL3 on July 27. (#7918, #7898, #7807) [@cheyao, @MattGuerrette]
|
||||
- Backends: GLFW: passing null window to glfwGetClipboardString()/glfwSetClipboardString()
|
||||
since GLFW own tests are doing that and it seems unnecessary.
|
||||
- Backends: SDL2, SDL3, GLFW, OSX, Allegro: update to set function handlers in ImGuiPlatformIO
|
||||
instead of ImGuiIO.
|
||||
- Examples:
|
||||
- Examples: GLFW (all), SDL2 (all), SDL3 (all), Win32+OpenGL3: rework examples main loop
|
||||
to handle minimization without burning CPU or GPU by running unthrottled code. (#7844)
|
||||
- Examples: SDL3: Update for API changes: SDL_Init() returns 0 on failure.
|
||||
|
||||
Docking+Viewports Branch:
|
||||
|
||||
|
@ -113,7 +128,6 @@ Docking+Viewports Branch:
|
|||
ImGuiViewportFlags_NoFocusOnAppearing flag, instead of using a Win32-specific hack.
|
||||
(#7896) [@RT2Code]
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.91.0 (Released 2024-07-30)
|
||||
-----------------------------------------------------------------------
|
||||
|
@ -266,7 +280,7 @@ Other changes:
|
|||
- Backends: SDL2,SDL3,OSX: Update for io.SetPlatformImeDataFn() -> io.PlatformSetImeDataFn() rename.
|
||||
- Backends: GLFW,SDL2: Added io.PlatformOpenInShellFn handler for web/Emscripten versions. (#7660)
|
||||
[@ypujante, @ocornut]
|
||||
- Backends; GLFW+Emscripten: Added support for GLFW3 contrib port which fixes many of the things
|
||||
- Backends: GLFW+Emscripten: Added support for GLFW3 contrib port which fixes many of the things
|
||||
not supported by the embedded GLFW: gamepad support, mouse cursor shapes, copy to clipboard,
|
||||
workaround for Super/Meta key, different ways of resizing, multi-window (glfw/canvas) support.
|
||||
(#7647) [@ypujante]
|
||||
|
|
|
@ -50,7 +50,9 @@ All loaded fonts glyphs are rendered into a single texture atlas ahead of time.
|
|||
|
||||
### (4) Font atlas texture fails to upload to GPU.
|
||||
|
||||
This is often of byproduct of point 3. If you have large number of glyphs or multiple fonts, the texture may become too big for your graphics API. **The typical result of failing to upload a texture is if every glyph or everything appears as empty black or white rectangle.** Mind the fact that some graphics drivers have texture size limitation. If you are building a PC application, mind the fact that your users may use hardware with lower limitations than yours.
|
||||
This is often of byproduct of point 3. If you have large number of glyphs or multiple fonts, the texture may become too big for your graphics API. **The typical result of failing to upload a texture is if every glyph or everything appears as empty white rectangles.** Mind the fact that some graphics drivers have texture size limitation. If you are building a PC application, mind the fact that your users may use hardware with lower limitations than yours.
|
||||
|
||||
![empty squares](https://github.com/user-attachments/assets/68b50fb5-8b9d-4c38-baec-6ac384f06d26)
|
||||
|
||||
Some solutions:
|
||||
- You may reduce oversampling, e.g. `font_config.OversampleH = 1`, this will half your texture size for a quality loss.
|
||||
|
@ -60,6 +62,8 @@ Some solutions:
|
|||
- Set `io.Fonts.Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight;` to disable rounding the texture height to the next power of two.
|
||||
- Set `io.Fonts.TexDesiredWidth` to specify a texture width to reduce maximum texture height (see comment in `ImFontAtlas::Build()` function).
|
||||
|
||||
Future versions of Dear ImGui should solve this problem.
|
||||
|
||||
##### [Return to Index](#index)
|
||||
|
||||
---------------------------------------
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
int main(int, char**)
|
||||
{
|
||||
// Setup SDL
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD) != 0)
|
||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD))
|
||||
{
|
||||
printf("Error: SDL_Init(): %s\n", SDL_GetError());
|
||||
return -1;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
int main(int, char**)
|
||||
{
|
||||
// Setup SDL
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD) != 0)
|
||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD))
|
||||
{
|
||||
printf("Error: SDL_Init(): %s\n", SDL_GetError());
|
||||
return -1;
|
||||
|
|
19
imgui.cpp
19
imgui.cpp
|
@ -1,4 +1,4 @@
|
|||
// dear imgui, v1.91.1 WIP
|
||||
// dear imgui, v1.91.1
|
||||
// (main code and documentation)
|
||||
|
||||
// Help:
|
||||
|
@ -4357,7 +4357,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
|||
const float delay = CalcDelayFromHoveredFlags(flags);
|
||||
if (delay > 0.0f || (flags & ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGuiID hover_delay_id = (g.LastItemData.ID != 0) ? g.LastItemData.ID : window->GetIDFromRectangle(g.LastItemData.Rect);
|
||||
ImGuiID hover_delay_id = (g.LastItemData.ID != 0) ? g.LastItemData.ID : window->GetIDFromPos(g.LastItemData.Rect.Min);
|
||||
if ((flags & ImGuiHoveredFlags_NoSharedDelay) && (g.HoverItemDelayIdPreviousFrame != hover_delay_id))
|
||||
g.HoverItemDelayTimer = 0.0f;
|
||||
g.HoverItemDelayId = hover_delay_id;
|
||||
|
@ -8984,6 +8984,16 @@ ImGuiID ImGuiWindow::GetID(int n)
|
|||
}
|
||||
|
||||
// This is only used in rare/specific situations to manufacture an ID out of nowhere.
|
||||
// FIXME: Consider instead storing last non-zero ID + count of successive zero-ID, and combine those?
|
||||
ImGuiID ImGuiWindow::GetIDFromPos(const ImVec2& p_abs)
|
||||
{
|
||||
ImGuiID seed = IDStack.back();
|
||||
ImVec2 p_rel = ImGui::WindowPosAbsToRel(this, p_abs);
|
||||
ImGuiID id = ImHashData(&p_rel, sizeof(p_rel), seed);
|
||||
return id;
|
||||
}
|
||||
|
||||
// "
|
||||
ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
|
||||
{
|
||||
ImGuiID seed = IDStack.back();
|
||||
|
@ -12041,6 +12051,9 @@ void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_
|
|||
ImGuiContext& g = *GImGui;
|
||||
IMGUI_DEBUG_LOG_POPUP("[popup] ClosePopupToLevel(%d), restore_under=%d\n", remaining, restore_focus_to_window_under_popup);
|
||||
IM_ASSERT(remaining >= 0 && remaining < g.OpenPopupStack.Size);
|
||||
if (g.DebugLogFlags & ImGuiDebugLogFlags_EventPopup)
|
||||
for (int n = remaining; n < g.OpenPopupStack.Size; n++)
|
||||
IMGUI_DEBUG_LOG_POPUP("[popup] - Closing PopupID 0x%08X Window \"%s\"\n", g.OpenPopupStack[n].PopupId, g.OpenPopupStack[n].Window ? g.OpenPopupStack[n].Window->Name : NULL);
|
||||
|
||||
// Trim open popup stack
|
||||
ImGuiPopupData prev_popup = g.OpenPopupStack[remaining];
|
||||
|
@ -20406,7 +20419,7 @@ void ImGui::UpdateDebugToolFlashStyleColor()
|
|||
ImGuiContext& g = *GImGui;
|
||||
if (g.DebugFlashStyleColorTime <= 0.0f)
|
||||
return;
|
||||
ColorConvertHSVtoRGB(cosf(g.DebugFlashStyleColorTime * 6.0f) * 0.5f + 0.5f, 0.5f, 0.5f, g.Style.Colors[g.DebugFlashStyleColorIdx].x, g.Style.Colors[g.DebugFlashStyleColorIdx].y, g.Style.Colors[g.DebugFlashStyleColorIdx].z);
|
||||
ColorConvertHSVtoRGB(ImCos(g.DebugFlashStyleColorTime * 6.0f) * 0.5f + 0.5f, 0.5f, 0.5f, g.Style.Colors[g.DebugFlashStyleColorIdx].x, g.Style.Colors[g.DebugFlashStyleColorIdx].y, g.Style.Colors[g.DebugFlashStyleColorIdx].z);
|
||||
g.Style.Colors[g.DebugFlashStyleColorIdx].w = 1.0f;
|
||||
if ((g.DebugFlashStyleColorTime -= g.IO.DeltaTime) <= 0.0f)
|
||||
DebugFlashStyleColorStop();
|
||||
|
|
12
imgui.h
12
imgui.h
|
@ -1,4 +1,4 @@
|
|||
// dear imgui, v1.91.1 WIP
|
||||
// dear imgui, v1.91.1
|
||||
// (headers)
|
||||
|
||||
// Help:
|
||||
|
@ -28,8 +28,8 @@
|
|||
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||
#define IMGUI_VERSION "1.91.1 WIP"
|
||||
#define IMGUI_VERSION_NUM 19104
|
||||
#define IMGUI_VERSION "1.91.1"
|
||||
#define IMGUI_VERSION_NUM 19110
|
||||
#define IMGUI_HAS_TABLE
|
||||
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
||||
#define IMGUI_HAS_DOCK // Docking WIP branch
|
||||
|
@ -468,7 +468,7 @@ namespace ImGui
|
|||
// - Use the ShowStyleEditor() function to interactively see/edit the colors.
|
||||
IMGUI_API ImFont* GetFont(); // get current font
|
||||
IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied
|
||||
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
||||
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a white pixel, useful to draw custom shapes via the ImDrawList API
|
||||
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier, packed as a 32-bit value suitable for ImDrawList
|
||||
IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
||||
IMGUI_API ImU32 GetColorU32(ImU32 col, float alpha_mul = 1.0f); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
||||
|
@ -2025,7 +2025,7 @@ enum ImGuiTableColumnFlags_
|
|||
ImGuiTableColumnFlags_NoSort = 1 << 9, // Disable ability to sort on this field (even if ImGuiTableFlags_Sortable is set on the table).
|
||||
ImGuiTableColumnFlags_NoSortAscending = 1 << 10, // Disable ability to sort in the ascending direction.
|
||||
ImGuiTableColumnFlags_NoSortDescending = 1 << 11, // Disable ability to sort in the descending direction.
|
||||
ImGuiTableColumnFlags_NoHeaderLabel = 1 << 12, // TableHeadersRow() will not submit horizontal label for this column. Convenient for some small columns. Name will still appear in context menu or in angled headers.
|
||||
ImGuiTableColumnFlags_NoHeaderLabel = 1 << 12, // TableHeadersRow() will submit an empty label for this column. Convenient for some small columns. Name will still appear in context menu or in angled headers. You may append into this cell by calling TableSetColumnIndex() right after the TableHeadersRow() call.
|
||||
ImGuiTableColumnFlags_NoHeaderWidth = 1 << 13, // Disable header text width contribution to automatic column width.
|
||||
ImGuiTableColumnFlags_PreferSortAscending = 1 << 14, // Make the initial sort direction Ascending when first sorting on this column (default).
|
||||
ImGuiTableColumnFlags_PreferSortDescending = 1 << 15, // Make the initial sort direction Descending when first sorting on this column.
|
||||
|
@ -3562,7 +3562,7 @@ enum ImGuiViewportFlags_
|
|||
ImGuiViewportFlags_None = 0,
|
||||
ImGuiViewportFlags_IsPlatformWindow = 1 << 0, // Represent a Platform Window
|
||||
ImGuiViewportFlags_IsPlatformMonitor = 1 << 1, // Represent a Platform Monitor (unused yet)
|
||||
ImGuiViewportFlags_OwnedByApp = 1 << 2, // Platform Window: Was created/managed by the user application? (rather than our backend)
|
||||
ImGuiViewportFlags_OwnedByApp = 1 << 2, // Platform Window: Is created/managed by the user application? (rather than our backend)
|
||||
ImGuiViewportFlags_NoDecoration = 1 << 3, // Platform Window: Disable platform decorations: title bar, borders, etc. (generally set all windows, but if ImGuiConfigFlags_ViewportsDecoration is set we only set this on popups/tooltips)
|
||||
ImGuiViewportFlags_NoTaskBarIcon = 1 << 4, // Platform Window: Disable platform task bar icon (generally set on popups/tooltips, or all windows if ImGuiConfigFlags_ViewportsNoTaskBarIcon is set)
|
||||
ImGuiViewportFlags_NoFocusOnAppearing = 1 << 5, // Platform Window: Don't take focus when created.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// dear imgui, v1.91.1 WIP
|
||||
// dear imgui, v1.91.1
|
||||
// (demo code)
|
||||
|
||||
// Help:
|
||||
|
@ -117,6 +117,9 @@ Index of this file:
|
|||
#if !defined(_MSC_VER) || _MSC_VER >= 1800
|
||||
#include <inttypes.h> // PRId64/PRIu64, not avail in some MinGW headers.
|
||||
#endif
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/version.h> // __EMSCRIPTEN_major__ etc.
|
||||
#endif
|
||||
|
||||
// Visual Studio warnings
|
||||
#ifdef _MSC_VER
|
||||
|
@ -2061,6 +2064,10 @@ static void ShowDemoWindowWidgets(ImGuiDemoWindowData* demo_data)
|
|||
ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80));
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Need better plotting and graphing? Consider using ImPlot:");
|
||||
ImGui::TextLinkOpenURL("https://github.com/epezent/implot");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
|
@ -6471,7 +6478,11 @@ static void ShowDemoWindowTables()
|
|||
// FIXME: It would be nice to actually demonstrate full-featured selection using those checkbox.
|
||||
static bool column_selected[3] = {};
|
||||
|
||||
// Instead of calling TableHeadersRow() we'll submit custom headers ourselves
|
||||
// Instead of calling TableHeadersRow() we'll submit custom headers ourselves.
|
||||
// (A different approach is also possible:
|
||||
// - Specify ImGuiTableColumnFlags_NoHeaderLabel in some TableSetupColumn() call.
|
||||
// - Call TableHeadersRow() normally. This will submit TableHeader() with no name.
|
||||
// - Then call TableSetColumnIndex() to position yourself in the column and submit your stuff e.g. Checkbox().)
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
||||
for (int column = 0; column < COLUMNS_COUNT; column++)
|
||||
{
|
||||
|
@ -6486,6 +6497,7 @@ static void ShowDemoWindowTables()
|
|||
ImGui::PopID();
|
||||
}
|
||||
|
||||
// Submit table contents
|
||||
for (int row = 0; row < 5; row++)
|
||||
{
|
||||
ImGui::TableNextRow();
|
||||
|
@ -6520,6 +6532,7 @@ static void ShowDemoWindowTables()
|
|||
ImGui::CheckboxFlags("_ScrollX", &table_flags, ImGuiTableFlags_ScrollX);
|
||||
ImGui::CheckboxFlags("_ScrollY", &table_flags, ImGuiTableFlags_ScrollY);
|
||||
ImGui::CheckboxFlags("_Resizable", &table_flags, ImGuiTableFlags_Resizable);
|
||||
ImGui::CheckboxFlags("_Sortable", &table_flags, ImGuiTableFlags_Sortable);
|
||||
ImGui::CheckboxFlags("_NoBordersInBody", &table_flags, ImGuiTableFlags_NoBordersInBody);
|
||||
ImGui::CheckboxFlags("_HighlightHoveredColumn", &table_flags, ImGuiTableFlags_HighlightHoveredColumn);
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
||||
|
@ -7763,6 +7776,7 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
|||
#endif
|
||||
#ifdef __EMSCRIPTEN__
|
||||
ImGui::Text("define: __EMSCRIPTEN__");
|
||||
ImGui::Text("Emscripten: %d.%d.%d", __EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__);
|
||||
#endif
|
||||
#ifdef IMGUI_HAS_VIEWPORT
|
||||
ImGui::Text("define: IMGUI_HAS_VIEWPORT");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// dear imgui, v1.91.1 WIP
|
||||
// dear imgui, v1.91.1
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// dear imgui, v1.91.1 WIP
|
||||
// dear imgui, v1.91.1
|
||||
// (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.
|
||||
|
@ -2960,6 +2960,7 @@ public:
|
|||
ImGuiID GetID(const char* str, const char* str_end = NULL);
|
||||
ImGuiID GetID(const void* ptr);
|
||||
ImGuiID GetID(int n);
|
||||
ImGuiID GetIDFromPos(const ImVec2& p_abs);
|
||||
ImGuiID GetIDFromRectangle(const ImRect& r_abs);
|
||||
|
||||
// We don't use g.FontSize because the window may be != g.CurrentWindow.
|
||||
|
@ -3073,6 +3074,7 @@ struct ImGuiTableColumn
|
|||
float MaxX;
|
||||
float WidthRequest; // Master width absolute value when !(Flags & _WidthStretch). When Stretch this is derived every frame from StretchWeight in TableUpdateLayout()
|
||||
float WidthAuto; // Automatic width
|
||||
float WidthMax; // Maximum width (FIXME: overwritten by each instance)
|
||||
float StretchWeight; // Master width weight when (Flags & _WidthStretch). Often around ~1.0f initially.
|
||||
float InitStretchWeightOrWidth; // Value passed to TableSetupColumn(). For Width it is a content width (_without padding_).
|
||||
ImRect ClipRect; // Clipping rectangle for the column
|
||||
|
@ -3371,8 +3373,8 @@ namespace ImGui
|
|||
inline void SetWindowParentWindowForFocusRoute(ImGuiWindow* window, ImGuiWindow* parent_window) { window->ParentWindowForFocusRoute = parent_window; } // You may also use SetNextWindowClass()'s FocusRouteParentWindowId field.
|
||||
inline ImRect WindowRectAbsToRel(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x - off.x, r.Min.y - off.y, r.Max.x - off.x, r.Max.y - off.y); }
|
||||
inline ImRect WindowRectRelToAbs(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x + off.x, r.Min.y + off.y, r.Max.x + off.x, r.Max.y + off.y); }
|
||||
inline ImVec2 WindowPosRelToAbs(ImGuiWindow* window, const ImVec2& p) { ImVec2 off = window->DC.CursorStartPos; return ImVec2(p.x + off.x, p.y + off.y); }
|
||||
inline ImVec2 WindowPosAbsToRel(ImGuiWindow* window, const ImVec2& p) { ImVec2 off = window->DC.CursorStartPos; return ImVec2(p.x - off.x, p.y - off.y); }
|
||||
inline ImVec2 WindowPosRelToAbs(ImGuiWindow* window, const ImVec2& p) { ImVec2 off = window->DC.CursorStartPos; return ImVec2(p.x + off.x, p.y + off.y); }
|
||||
|
||||
// Windows: Display Order and Focus Order
|
||||
IMGUI_API void FocusWindow(ImGuiWindow* window, ImGuiFocusRequestFlags flags = 0);
|
||||
|
@ -3776,7 +3778,7 @@ namespace ImGui
|
|||
IMGUI_API ImRect TableGetCellBgRect(const ImGuiTable* table, int column_n);
|
||||
IMGUI_API const char* TableGetColumnName(const ImGuiTable* table, int column_n);
|
||||
IMGUI_API ImGuiID TableGetColumnResizeID(ImGuiTable* table, int column_n, int instance_no = 0);
|
||||
IMGUI_API float TableGetMaxColumnWidth(const ImGuiTable* table, int column_n);
|
||||
IMGUI_API float TableCalcMaxColumnWidth(const ImGuiTable* table, int column_n);
|
||||
IMGUI_API void TableSetColumnWidthAutoSingle(ImGuiTable* table, int column_n);
|
||||
IMGUI_API void TableSetColumnWidthAutoAll(ImGuiTable* table);
|
||||
IMGUI_API void TableRemove(ImGuiTable* table);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// dear imgui, v1.91.1 WIP
|
||||
// dear imgui, v1.91.1
|
||||
// (tables and columns code)
|
||||
|
||||
/*
|
||||
|
@ -1070,16 +1070,12 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||
continue;
|
||||
}
|
||||
|
||||
// Detect hovered column
|
||||
if (is_hovering_table && mouse_skewed_x >= column->ClipRect.Min.x && mouse_skewed_x < column->ClipRect.Max.x)
|
||||
table->HoveredColumnBody = (ImGuiTableColumnIdx)column_n;
|
||||
|
||||
// Lock start position
|
||||
column->MinX = offset_x;
|
||||
|
||||
// Lock width based on start position and minimum/maximum width for this position
|
||||
float max_width = TableGetMaxColumnWidth(table, column_n);
|
||||
column->WidthGiven = ImMin(column->WidthGiven, max_width);
|
||||
column->WidthMax = TableCalcMaxColumnWidth(table, column_n);
|
||||
column->WidthGiven = ImMin(column->WidthGiven, column->WidthMax);
|
||||
column->WidthGiven = ImMax(column->WidthGiven, ImMin(column->WidthRequest, table->MinColumnWidth));
|
||||
column->MaxX = offset_x + column->WidthGiven + table->CellSpacingX1 + table->CellSpacingX2 + table->CellPaddingX * 2.0f;
|
||||
|
||||
|
@ -1128,8 +1124,13 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||
column->Flags |= ImGuiTableColumnFlags_IsVisible;
|
||||
if (column->SortOrder != -1)
|
||||
column->Flags |= ImGuiTableColumnFlags_IsSorted;
|
||||
if (table->HoveredColumnBody == column_n)
|
||||
|
||||
// Detect hovered column
|
||||
if (is_hovering_table && mouse_skewed_x >= column->ClipRect.Min.x && mouse_skewed_x < column->ClipRect.Max.x)
|
||||
{
|
||||
column->Flags |= ImGuiTableColumnFlags_IsHovered;
|
||||
table->HoveredColumnBody = (ImGuiTableColumnIdx)column_n;
|
||||
}
|
||||
|
||||
// Alignment
|
||||
// FIXME-TABLE: This align based on the whole column width, not per-cell, and therefore isn't useful in
|
||||
|
@ -2206,8 +2207,8 @@ void ImGui::TableEndCell(ImGuiTable* table)
|
|||
// Note that actual columns widths are computed in TableUpdateLayout().
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
// Maximum column content width given current layout. Use column->MinX so this value on a per-column basis.
|
||||
float ImGui::TableGetMaxColumnWidth(const ImGuiTable* table, int column_n)
|
||||
// Maximum column content width given current layout. Use column->MinX so this value differs on a per-column basis.
|
||||
float ImGui::TableCalcMaxColumnWidth(const ImGuiTable* table, int column_n)
|
||||
{
|
||||
const ImGuiTableColumn* column = &table->Columns[column_n];
|
||||
float max_width = FLT_MAX;
|
||||
|
@ -2269,7 +2270,7 @@ void ImGui::TableSetColumnWidth(int column_n, float width)
|
|||
// Compare both requested and actual given width to avoid overwriting requested width when column is stuck (minimum size, bounded)
|
||||
IM_ASSERT(table->MinColumnWidth > 0.0f);
|
||||
const float min_width = table->MinColumnWidth;
|
||||
const float max_width = ImMax(min_width, TableGetMaxColumnWidth(table, column_n));
|
||||
const float max_width = ImMax(min_width, column_0->WidthMax); // Don't use TableCalcMaxColumnWidth() here as it would rely on MinX from last instance (#7933)
|
||||
column_0_width = ImClamp(column_0_width, min_width, max_width);
|
||||
if (column_0->WidthGiven == column_0_width || column_0->WidthRequest == column_0_width)
|
||||
return;
|
||||
|
@ -3018,7 +3019,8 @@ float ImGui::TableGetHeaderAngledMaxLabelWidth()
|
|||
// The intent is that advanced users willing to create customized headers would not need to use this helper
|
||||
// and can create their own! For example: TableHeader() may be preceded by Checkbox() or other custom widgets.
|
||||
// See 'Demo->Tables->Custom headers' for a demonstration of implementing a custom version of this.
|
||||
// This code is constructed to not make much use of internal functions, as it is intended to be a template to copy.
|
||||
// This code is intentionally written to not make much use of internal functions, to give you better direction
|
||||
// if you need to write your own.
|
||||
// FIXME-TABLE: TableOpenContextMenu() and TableGetHeaderRowHeight() are not public.
|
||||
void ImGui::TableHeadersRow()
|
||||
{
|
||||
|
@ -3026,7 +3028,8 @@ void ImGui::TableHeadersRow()
|
|||
ImGuiTable* table = g.CurrentTable;
|
||||
IM_ASSERT(table != NULL && "Need to call TableHeadersRow() after BeginTable()!");
|
||||
|
||||
// Layout if not already done (this is automatically done by TableNextRow, we do it here solely to facilitate stepping in debugger as it is frequent to step in TableUpdateLayout)
|
||||
// Call layout if not already done. This is automatically done by TableNextRow: we do it here _only_ to make
|
||||
// it easier to debug-step in TableUpdateLayout(). Your own version of this function doesn't need this.
|
||||
if (!table->IsLayoutLocked)
|
||||
TableUpdateLayout(table);
|
||||
|
||||
|
@ -3043,8 +3046,7 @@ void ImGui::TableHeadersRow()
|
|||
if (!TableSetColumnIndex(column_n))
|
||||
continue;
|
||||
|
||||
// Push an id to allow unnamed labels (generally accidental, but let's behave nicely with them)
|
||||
// In your own code you may omit the PushID/PopID all-together, provided you know they won't collide.
|
||||
// Push an id to allow empty/unnamed headers. This is also idiomatic as it ensure there is a consistent ID path to access columns (for e.g. automation)
|
||||
const char* name = (TableGetColumnFlags(column_n) & ImGuiTableColumnFlags_NoHeaderLabel) ? "" : TableGetColumnName(column_n);
|
||||
PushID(column_n);
|
||||
TableHeader(name);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// dear imgui, v1.91.1 WIP
|
||||
// dear imgui, v1.91.1
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
|
@ -8231,9 +8231,10 @@ int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_get
|
|||
const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding);
|
||||
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0));
|
||||
ItemSize(total_bb, style.FramePadding.y);
|
||||
if (!ItemAdd(total_bb, 0, &frame_bb))
|
||||
if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemFlags_NoNav))
|
||||
return -1;
|
||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags);
|
||||
bool hovered;
|
||||
ButtonBehavior(frame_bb, id, &hovered, NULL);
|
||||
|
||||
// Determine scale from values if not specified
|
||||
if (scale_min == FLT_MAX || scale_max == FLT_MAX)
|
||||
|
|
Loading…
Reference in New Issue