diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 22682e2d8..851ccea1a 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -57,7 +57,7 @@ HOW TO UPDATE? ----------------------------------------------------------------------- - VERSION 1.66 (In Progress) + VERSION 1.66 (Released 2018-11-22) ----------------------------------------------------------------------- Breaking Changes: @@ -67,13 +67,15 @@ Breaking Changes: Other Changes: -- Fixed calling DestroyContext() always saving .ini data with the current context instead - of the supplied context pointer. (#2066) - Fixed calling SetNextWindowSize()/SetWindowSize() with non-integer values leading to accidental alteration of window position. We now round the provided size. (#2067) +- Fixed calling DestroyContext() always saving .ini data with the current context instead + of the supplied context pointer. (#2066) - Nav, Focus: Fixed ImGuiWindowFlags_NoBringToFrontOnFocus windows not being restoring focus properly after the main menu bar or last focused window is deactivated. - Nav: Fixed an assert in certain circumstance (mostly when using popups) when mouse positions stop being valid. (#2168) +- Nav: Fixed explicit directional input not re-highlighting current nav item if there is a single item in the window + and highlight has been previously disabled by the mouse. (#787) - DragFloat: Fixed a situation where dragging with value rounding enabled or with a power curve erroneously wrapped the value to one of the min/max edge. (#2024, #708, #320, #2075). - DragFloat: Disabled using power curve when one edge is FLT_MAX (broken in 1.61). (#2024) @@ -110,6 +112,7 @@ Other Changes: - Examples: OpenGL3: Added support for GL 4.5's glClipControl(GL_UPPER_LEFT). (#2186) - Examples: OpenGL3+GLFW: Fixed error condition when using the GLAD loader. (#2157) [@blackball] - Examples: OpenGL3+GLFW/SDL: Made main.cpp compile with IMGUI_IMPL_OPENGL_LOADER_CUSTOM (may be missing init). (#2178) [@doug-moen] +- Examples: SDL2+Vulkan: Fixed application shutdown which could deadlock on Linux + Xorg. (#2181) [@eRabbit0] ----------------------------------------------------------------------- diff --git a/docs/README.md b/docs/README.md index ecedfe663..bd7117991 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,6 +17,8 @@ Dear ImGui is designed to enable fast iterations and to empower programmers to c Dear ImGui is particularly suited to integration in games engine (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on consoles platforms where operating system features are non-standard. +See [Software using dear imgui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui), [Quotes](https://github.com/ocornut/imgui/wiki/Quotes) and [Gallery](https://github.com/ocornut/imgui/issues/1902) pages to get an idea of its use cases. + Dear ImGui is self-contained within a few files that you can easily copy and compile into your application/engine: - imgui.cpp - imgui.h @@ -152,10 +154,11 @@ For other bindings: see [Bindings](https://github.com/ocornut/imgui/wiki/Binding Roadmap ------- -Some of the goals for 2018-2019 are: -- Finish work on docking, tabs. (see [#2109](https://github.com/ocornut/imgui/issues/2109)) -- Finish work on viewports and multiple OS windows management. (see [#1542](https://github.com/ocornut/imgui/issues/1542)) +Some of the goals for 2019 are: +- Finish work on docking, tabs. (see [#2109](https://github.com/ocornut/imgui/issues/2109), public branch looking for feedback) +- Finish work on multiple viewports / multiple OS windows. (see [#1542](https://github.com/ocornut/imgui/issues/1542), public branch looking for feedback) - Finish work on gamepad/keyboard controls. (see [#787](https://github.com/ocornut/imgui/issues/787)) +- Add an automation and testing system, both to test the library and end-user apps. - Make Columns better. (they are currently pretty terrible!) - Make the examples look better, improve styles, improve font support, make the examples hi-DPI aware. @@ -217,7 +220,7 @@ Support Forums If you have issues with: compiling, linking, adding fonts, running or displaying Dear ImGui, or wiring inputs: please post on the Discourse forum: https://discourse.dearimgui.org. -For any other questions, bug reports, requests, feedback, you may post on https://github.com/ocornut/imgui/issues. +For any other questions, bug reports, requests, feedback, you may post on https://github.com/ocornut/imgui/issues. Please read and fill the New Issue template carefully. Frequently Asked Question (FAQ) ------------------------------- @@ -238,7 +241,7 @@ You may also peak at the [Multi-Viewport](https://github.com/ocornut/imgui/issue **Who uses Dear ImGui?** -See the [Software using dear imgui page](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) for an (incomplete) list of games/software which are publicly known to use dear imgui. Please add yours if you can! +See the [Quotes](https://github.com/ocornut/imgui/wiki/Quotes) and [Software using dear imgui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) pages for an (incomplete) list of games/software which are publicly known to use dear imgui. Please add yours if you can! **Why the odd dual naming, "dear imgui" vs "ImGui"?** diff --git a/examples/example_sdl_vulkan/main.cpp b/examples/example_sdl_vulkan/main.cpp index c0dd7ec72..720477ac6 100644 --- a/examples/example_sdl_vulkan/main.cpp +++ b/examples/example_sdl_vulkan/main.cpp @@ -491,8 +491,9 @@ int main(int, char**) ImGui_ImplVulkan_Shutdown(); ImGui_ImplSDL2_Shutdown(); ImGui::DestroyContext(); - SDL_DestroyWindow(window); CleanupVulkan(); + + SDL_DestroyWindow(window); SDL_Quit(); return 0; diff --git a/examples/imgui_impl_opengl3.cpp b/examples/imgui_impl_opengl3.cpp index 998db5b91..da5646306 100644 --- a/examples/imgui_impl_opengl3.cpp +++ b/examples/imgui_impl_opengl3.cpp @@ -179,8 +179,9 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data) GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST); bool clip_origin_lower_left = true; #ifdef GL_CLIP_ORIGIN - GLenum last_clip_origin; glGetIntegerv(GL_CLIP_ORIGIN, (GLint*)&last_clip_origin); // Support for GL 4.5's glClipControl(GL_UPPER_LEFT) - clip_origin_lower_left = (last_clip_origin == GL_LOWER_LEFT); + GLenum last_clip_origin = 0; glGetIntegerv(GL_CLIP_ORIGIN, (GLint*)&last_clip_origin); // Support for GL 4.5's glClipControl(GL_UPPER_LEFT) + if (last_clip_origin == GL_UPPER_LEFT) + clip_origin_lower_left = false; #endif // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill diff --git a/imgui.cpp b/imgui.cpp index 34c451434..5bb44ab6a 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.66 WIP +// dear imgui, v1.66 // (main code and documentation) // Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code. @@ -2332,7 +2332,7 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFl return; if (g.NavDisableHighlight && !(flags & ImGuiNavHighlightFlags_AlwaysDraw)) return; - ImGuiWindow* window = ImGui::GetCurrentWindow(); + ImGuiWindow* window = g.CurrentWindow; if (window->DC.NavHideHighlightOneFrame) return; @@ -3902,7 +3902,7 @@ void ImGui::Render() IM_ASSERT(g.Initialized); if (g.FrameCountEnded != g.FrameCount) - ImGui::EndFrame(); + EndFrame(); g.FrameCountRendered = g.FrameCount; // Gather ImDrawList to render (for each active window) @@ -4530,9 +4530,8 @@ ImGuiWindow* ImGui::FindWindowByID(ImGuiID id) ImGuiWindow* ImGui::FindWindowByName(const char* name) { - ImGuiContext& g = *GImGui; ImGuiID id = ImHash(name, 0); - return (ImGuiWindow*)g.WindowsById.GetVoidPtr(id); + return FindWindowByID(id); } static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags) @@ -4811,7 +4810,7 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au if (resize_rect.Min.y > resize_rect.Max.y) ImSwap(resize_rect.Min.y, resize_rect.Max.y); bool hovered, held; ButtonBehavior(resize_rect, window->GetID((void*)(intptr_t)resize_grip_n), &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus); - //GetOverlayDrawList()->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255)); + //GetOverlayDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255)); if (hovered || held) g.MouseCursor = (resize_grip_n & 1) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE; @@ -4836,7 +4835,7 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au bool hovered, held; ImRect border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, RESIZE_WINDOWS_FROM_EDGES_HALF_THICKNESS); ButtonBehavior(border_rect, window->GetID((void*)(intptr_t)(border_n + 4)), &hovered, &held, ImGuiButtonFlags_FlattenChildren); - //GetOverlayDrawList()->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255)); + //GetOverlayDrawList(window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255)); if ((hovered && g.HoveredIdTimer > RESIZE_WINDOWS_FROM_EDGES_FEEDBACK_TIMER) || held) { g.MouseCursor = (border_n & 1) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS; @@ -5581,7 +5580,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) /* if (g.ActiveId == move_id) if (g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_C)) - ImGui::LogToClipboard(); + LogToClipboard(); */ // Inner rectangle @@ -5683,13 +5682,13 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_first_use, { // Old API feature: we could pass the initial window size as a parameter. This was misleading because it only had an effect if the window didn't have data in the .ini file. if (size_first_use.x != 0.0f || size_first_use.y != 0.0f) - ImGui::SetNextWindowSize(size_first_use, ImGuiCond_FirstUseEver); + SetNextWindowSize(size_first_use, ImGuiCond_FirstUseEver); // Old API feature: override the window background alpha with a parameter. if (bg_alpha_override >= 0.0f) - ImGui::SetNextWindowBgAlpha(bg_alpha_override); + SetNextWindowBgAlpha(bg_alpha_override); - return ImGui::Begin(name, p_open, flags); + return Begin(name, p_open, flags); } #endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS @@ -8115,7 +8114,7 @@ static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand) } else if (g.IO.KeyCtrl) // Hold to preview score in matching quadrant. Press C to rotate. { - if (IsKeyPressedMap(ImGuiKey_C)) { g.NavMoveDirLast = (ImGuiDir)((g.NavMoveDirLast + 1) & 3); g.IO.KeysDownDuration[g.IO.KeyMap[ImGuiKey_C]] = 0.01f; } + if (ImGui::IsKeyPressedMap(ImGuiKey_C)) { g.NavMoveDirLast = (ImGuiDir)((g.NavMoveDirLast + 1) & 3); g.IO.KeysDownDuration[g.IO.KeyMap[ImGuiKey_C]] = 0.01f; } if (quadrant == g.NavMoveDir) { ImFormatString(buf, IM_ARRAYSIZE(buf), "%.0f/%.0f", dist_box, dist_center); @@ -8502,7 +8501,7 @@ static void ImGui::NavUpdate() g.NavJustMovedToId = 0; // Process navigation move request - if (g.NavMoveRequest && (g.NavMoveResultLocal.ID != 0 || g.NavMoveResultOther.ID != 0)) + if (g.NavMoveRequest) NavUpdateMoveResult(); // When a forwarded move request failed, we restore the highlight that we disabled during the forward frame @@ -8713,14 +8712,26 @@ static void ImGui::NavUpdate() g.NavScoringCount = 0; #if IMGUI_DEBUG_NAV_RECTS if (g.NavWindow) { for (int layer = 0; layer < 2; layer++) GetOverlayDrawList(g.NavWindow)->AddRect(g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Min, g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Max, IM_COL32(255,200,0,255)); } // [DEBUG] - if (g.NavWindow) { ImU32 col = (g.NavWindow->HiddenFrames == 0) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredRefPos(NULL); char buf[32]; ImFormatString(buf, 32, "%d", g.NavLayer); GetOverlayDrawList(g.NavWindow)->AddCircleFilled(p, 3.0f, col); GetOverlayDrawList(g.NavWindow)->AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); } + if (g.NavWindow) { ImU32 col = (!g.NavWindow->Hidden) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredRefPos(); char buf[32]; ImFormatString(buf, 32, "%d", g.NavLayer); GetOverlayDrawList(g.NavWindow)->AddCircleFilled(p, 3.0f, col); GetOverlayDrawList(g.NavWindow)->AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); } #endif } +// Apply result from previous frame navigation directional move request static void ImGui::NavUpdateMoveResult() { - // Select which result to use ImGuiContext& g = *GImGui; + if (g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0) + { + // In a situation when there is no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result) + if (g.NavId != 0) + { + g.NavDisableHighlight = false; + g.NavDisableMouseHover = true; + } + return; + } + + // Select which result to use ImGuiNavMoveResult* result = (g.NavMoveResultLocal.ID != 0) ? &g.NavMoveResultLocal : &g.NavMoveResultOther; // PageUp/PageDown behavior first jumps to the bottom/top mostly visible item, _otherwise_ use the result from the previous/next page. @@ -8750,7 +8761,6 @@ static void ImGui::NavUpdateMoveResult() NavScrollToBringItemIntoView(result->Window->ParentWindow, ImRect(rect_abs.Min + delta_scroll, rect_abs.Max + delta_scroll)); } - // Apply result from previous frame navigation directional move request ClearActiveID(); g.NavWindow = result->Window; SetNavIDWithRectRel(result->ID, g.NavLayer, result->RectRel); diff --git a/imgui.h b/imgui.h index 68510e648..d3c35c712 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.66 WIP +// dear imgui, v1.66 // (headers) // See imgui.cpp file for documentation. @@ -23,8 +23,8 @@ // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY00 then bounced up to XYY01 when release tagging happens) -#define IMGUI_VERSION "1.66 WIP" -#define IMGUI_VERSION_NUM 16600 +#define IMGUI_VERSION "1.66" +#define IMGUI_VERSION_NUM 16601 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert)) #define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch #define IMGUI_HAS_DOCK 1 // Docking WIP branch diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 27fe2ba9d..3b6b2f0bf 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.66 WIP +// dear imgui, v1.66 // (demo code) // Message to the person tempted to delete this file when integrating Dear ImGui into their code base: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 6667c3d46..74fa4c9ba 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.66 WIP +// dear imgui, v1.66 // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index d7322909c..d54f38846 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.66 WIP +// dear imgui, v1.66 // (internal structures/api) // You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility! diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 117753011..79bd361fd 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.65 +// dear imgui, v1.66 // (widgets code) /* diff --git a/misc/README.txt b/misc/README.txt index 4bd274521..ff23d7fc6 100644 --- a/misc/README.txt +++ b/misc/README.txt @@ -1,6 +1,6 @@ misc/cpp/ - InputText() wrappers for C++ standard library (STL) types (std::string, etc.). + InputText() wrappers for C++ standard library (STL) type: std::string. This is also an example of how you may wrap your own similar types. misc/fonts/ diff --git a/misc/cpp/README.txt b/misc/cpp/README.txt new file mode 100644 index 000000000..dedfa747a --- /dev/null +++ b/misc/cpp/README.txt @@ -0,0 +1,10 @@ + +imgui_stdlib.h + imgui_stdlib.cpp + InputText() wrappers for C++ standard library (STL) type: std::string. + This is also an example of how you may wrap your own similar types. + +imgui_scoped.h + [Experimental, not currently in main repository] + Additional header file with some RAII-style wrappers for common ImGui functions. + Try by merging: https://github.com/ocornut/imgui/pull/2197 + Discuss at: https://github.com/ocornut/imgui/issues/2096