mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Merge branch 'viewport' into docking
# Conflicts: # docs/CHANGELOG.txt # imgui_widgets.cpp
This commit is contained in:
commit
2515413080
@ -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]
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
@ -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"?**
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
42
imgui.cpp
42
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);
|
||||
|
6
imgui.h
6
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
|
||||
|
@ -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:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.66 WIP
|
||||
// dear imgui, v1.66
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
|
@ -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!
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.65
|
||||
// dear imgui, v1.66
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
|
@ -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/
|
||||
|
10
misc/cpp/README.txt
Normal file
10
misc/cpp/README.txt
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user