mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-13 08:19:55 +02:00
Compare commits
5 Commits
features/p
...
features/v
Author | SHA1 | Date | |
---|---|---|---|
684c03da3d | |||
4691fa0ed5 | |||
aa79d0cd2f | |||
88de982071 | |||
97b1abd6dd |
@ -31,6 +31,18 @@ HOW TO UPDATE?
|
||||
- Please report any issue!
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.88 WIP (In Progress)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Breaking changes:
|
||||
|
||||
Other Changes:
|
||||
|
||||
- Stack Tool: Added option to copy item path to clipboard. (#4631)
|
||||
- Drawlist: Fixed PathArcTo() emitting terminating vertices too close to arc vertices. (#4993) [@thedmd]
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.87 (Released 2022-02-07)
|
||||
-----------------------------------------------------------------------
|
||||
@ -103,7 +115,6 @@ Breaking Changes:
|
||||
better support for IME. Updated backends accordingly. Because the old field is set by existing backends,
|
||||
we are keeping it (marked as obsolete).
|
||||
|
||||
|
||||
Other Changes:
|
||||
|
||||
- IO: Added event based input queue API, which now trickles events to support low framerates. [@thedmd, @ocornut]
|
||||
|
@ -1,7 +0,0 @@
|
||||
project "imgui"
|
||||
kind "StaticLib"
|
||||
files { "../*.h", "../*.cpp" }
|
||||
vpaths { ["imgui"] = { "../*.cpp", "../*.h", "../misc/debuggers/*.natvis" } }
|
||||
filter { "toolset:msc*" }
|
||||
files { "../misc/debuggers/*.natvis" }
|
||||
|
@ -1,298 +0,0 @@
|
||||
|
||||
-- We use Premake5 to generate project files (Visual Studio solutions, XCode solutions, Makefiles, etc.)
|
||||
-- Download Premake5: at https://premake.github.io/download
|
||||
-- YOU NEED PREMAKE 5.0.0-alpha10 or later
|
||||
|
||||
--------- HELP
|
||||
-- To reduce friction for people who don't aren't used to Premake, we list some concrete usage examples.
|
||||
|
||||
if _ACTION == nil then
|
||||
print "-----------------------------------------"
|
||||
print " DEAR IMGUI EXAMPLES - PROJECT GENERATOR"
|
||||
print "-----------------------------------------"
|
||||
print "Usage:"
|
||||
print " premake5 [generator] [options]"
|
||||
print "Examples:"
|
||||
print " premake5 vs2010"
|
||||
print " premake5 vs2019 --with-sdl --with-vulkan"
|
||||
print " premake5 xcode4 --with-glfw"
|
||||
print " premake5 gmake2 --with-glfw --cc=clang"
|
||||
print "Generators:"
|
||||
print " codelite gmake gmake2 vs2008 vs2010 vs2012 vs2013 vs2015 vs2017 xcode4 etc."
|
||||
print "Options:"
|
||||
print " --with-dx9 Enable dear imgui DirectX 9 example"
|
||||
print " --with-dx10 Enable dear imgui DirectX 10 example"
|
||||
print " --with-dx11 Enable dear imgui DirectX 11 example"
|
||||
print " --with-dx12 Enable dear imgui DirectX 12 example (vs2015+)"
|
||||
print " --with-glfw Enable dear imgui GLFW examples"
|
||||
print " --with-sdl Enable dear imgui SDL examples"
|
||||
print " --with-vulkan Enable dear imgui Vulkan example"
|
||||
print " --cc=clang Compile with Clang"
|
||||
print " --cc=gcc Compile with GCC"
|
||||
print "Project and object files will be created in the build/ folder. You can delete your build/ folder at any time."
|
||||
print ""
|
||||
end
|
||||
|
||||
---------- OPTIONS
|
||||
|
||||
newoption { trigger = "with-dx9", description="Enable dear imgui DirectX 9 example" }
|
||||
newoption { trigger = "with-dx10", description="Enable dear imgui DirectX 10 example" }
|
||||
newoption { trigger = "with-dx11", description="Enable dear imgui DirectX 11 example" }
|
||||
newoption { trigger = "with-dx12", description="Enable dear imgui DirectX 12 example" }
|
||||
newoption { trigger = "with-glfw", description="Enable dear imgui GLFW examples" }
|
||||
newoption { trigger = "with-sdl", description="Enable dear imgui SDL examples" }
|
||||
newoption { trigger = "with-vulkan", description="Enable dear imgui Vulkan example" }
|
||||
|
||||
-- Enable/detect default options under Windows
|
||||
if _ACTION ~= nil and ((os.istarget ~= nil and os.istarget("windows")) or (os.is ~= nil and os.is("windows"))) then
|
||||
print("( enabling --with-dx9 )");
|
||||
print("( enabling --with-dx10 )");
|
||||
print("( enabling --with-dx11 )");
|
||||
_OPTIONS["with-dx9"] = 1
|
||||
_OPTIONS["with-dx10"] = 1
|
||||
_OPTIONS["with-dx11"] = 1
|
||||
if _ACTION >= "vs2015" then
|
||||
print("( enabling --with-dx12 because compiler is " .. _ACTION .. " )");
|
||||
_OPTIONS["with-dx12"] = 1
|
||||
end
|
||||
print("( enabling --with-glfw because GLFW is included in the libs/ folder )");
|
||||
_OPTIONS["with-glfw"] = 1
|
||||
if os.getenv("SDL2_DIR") then
|
||||
print("( enabling --with-sdl because SDL2_DIR environment variable was found )");
|
||||
_OPTIONS["with-sdl"] = 1
|
||||
end
|
||||
if os.getenv("VULKAN_SDK") then
|
||||
print("( enabling --with-vulkan because VULKAN_SDK environment variable was found )");
|
||||
_OPTIONS["with-vulkan"] = 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--------- HELPER FUNCTIONS
|
||||
|
||||
-- Helper function: add dear imgui source files into project
|
||||
function imgui_as_src(fs_path, project_path)
|
||||
if (project_path == nil) then project_path = fs_path; end; -- default to same virtual folder as the file system folder (in this project it would be ".." !)
|
||||
|
||||
files { fs_path .. "/*.cpp", fs_path .. "/*.h" }
|
||||
includedirs { fs_path, fs_path .. "/backends" }
|
||||
vpaths { [project_path] = { fs_path .. "/*.*", fs_path .. "/misc/debuggers/*.natvis" } } -- add in a specific folder of the Visual Studio project
|
||||
filter { "toolset:msc*" }
|
||||
files { fs_path .. "/misc/debuggers/*.natvis" }
|
||||
filter {}
|
||||
end
|
||||
|
||||
-- Helper function: add dear imgui as a library (uncomment the 'include "premake5-lib"' line)
|
||||
--include "premake5-lib"
|
||||
function imgui_as_lib(fs_path)
|
||||
includedirs { fs_path, fs_path .. "/backends" }
|
||||
links "imgui"
|
||||
end
|
||||
|
||||
--------- SOLUTION, PROJECTS
|
||||
|
||||
workspace "imgui_examples"
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "x86", "x86_64" }
|
||||
|
||||
location "build/"
|
||||
symbols "On"
|
||||
warnings "Extra"
|
||||
--flags { "FatalCompileWarnings"}
|
||||
|
||||
filter { "configurations:Debug" }
|
||||
optimize "Off"
|
||||
filter { "configurations:Release" }
|
||||
optimize "On"
|
||||
filter { "toolset:clang", "system:windows" }
|
||||
buildoptions { "-Xclang", "-flto-visibility-public-std" } -- Remove "warning LNK4049: locally defined symbol ___std_terminate imported"
|
||||
|
||||
-- example_win32_directx11 (Win32 + DirectX 11)
|
||||
-- We have DX11 as the first project because this is what Visual Studio uses
|
||||
if (_OPTIONS["with-dx11"]) then
|
||||
project "example_win32_directx11"
|
||||
kind "ConsoleApp"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
files { "../backends/imgui_impl_win32.*", "../backends/imgui_impl_dx11.*", "example_win32_directx11/*.cpp", "example_win32_directx11/*.h", "README.txt" }
|
||||
vpaths { ["sources"] = "./**" }
|
||||
filter { "system:windows", "toolset:msc-v80 or msc-v90 or msc-v100" }
|
||||
includedirs { "$(DXSDK_DIR)/Include" }
|
||||
filter { "system:windows", "toolset:msc-v80 or msc-v90 or msc-v100", "platforms:x86" }
|
||||
libdirs { "$(DXSDK_DIR)/Lib/x86" }
|
||||
filter { "system:windows", "toolset:msc-v80 or msc-v90 or msc-v100", "platforms:x86_64" }
|
||||
libdirs { "$(DXSDK_DIR)/Lib/x64" }
|
||||
filter { "system:windows" }
|
||||
links { "d3d11", "d3dcompiler", "dxgi" }
|
||||
end
|
||||
|
||||
-- example_win32_directx9 (Win32 + DirectX 9)
|
||||
if (_OPTIONS["with-dx9"]) then
|
||||
project "example_win32_directx9"
|
||||
kind "ConsoleApp"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
files { "../backends/imgui_impl_win32.*", "../backends/imgui_impl_dx9.*", "example_win32_directx9/*.cpp", "example_win32_directx9/*.h", "README.txt" }
|
||||
vpaths { ["sources"] = "./**" }
|
||||
filter { "system:windows" }
|
||||
links { "d3d9" }
|
||||
end
|
||||
|
||||
-- example_win32_directx10 (Win32 + DirectX 10)
|
||||
if (_OPTIONS["with-dx10"]) then
|
||||
project "example_win32_directx10"
|
||||
kind "ConsoleApp"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
files { "../backends/imgui_impl_win32.*", "../backends/imgui_impl_dx10.*", "example_win32_directx10/*.cpp", "example_win32_directx10/*.h", "README.txt" }
|
||||
vpaths { ["sources"] = "./**" }
|
||||
filter { "system:windows", "toolset:msc-v80 or msc-v90 or msc-v100" }
|
||||
includedirs { "$(DXSDK_DIR)/Include" }
|
||||
filter { "system:windows", "toolset:msc-v80 or msc-v90 or msc-v100", "platforms:x86" }
|
||||
libdirs { "$(DXSDK_DIR)/Lib/x86" }
|
||||
filter { "system:windows", "toolset:msc-v80 or msc-v90 or msc-v100", "platforms:x86_64" }
|
||||
libdirs { "$(DXSDK_DIR)/Lib/x64" }
|
||||
filter { "system:windows" }
|
||||
links { "d3d10", "d3dcompiler", "dxgi" }
|
||||
end
|
||||
|
||||
-- example_win32_directx12 (Win32 + DirectX 12)
|
||||
if (_OPTIONS["with-dx12"]) then
|
||||
project "example_win32_directx12"
|
||||
kind "ConsoleApp"
|
||||
systemversion "10.0.16299.0"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
files { "../backends/imgui_impl_win32.*", "../backends/imgui_impl_dx12.*", "example_win32_directx12/*.cpp", "example_win32_directx12/*.h", "README.txt" }
|
||||
vpaths { ["sources"] = "./**" }
|
||||
filter { "system:windows" }
|
||||
links { "d3d12", "d3dcompiler", "dxgi" }
|
||||
end
|
||||
|
||||
-- example_glfw_opengl2 (GLFW + OpenGL2)
|
||||
if (_OPTIONS["with-glfw"]) then
|
||||
project "example_glfw_opengl2"
|
||||
kind "ConsoleApp"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
files { "../backends/imgui_impl_glfw.*", "../backends/imgui_impl_opengl2.*", "example_glfw_opengl2/*.h", "example_glfw_opengl2/*.cpp", "README.txt"}
|
||||
vpaths { ["sources"] = "./**" }
|
||||
includedirs { "libs/glfw/include" }
|
||||
filter { "system:windows", "platforms:x86" }
|
||||
libdirs { "libs/glfw/lib-vc2010-32" }
|
||||
filter { "system:windows", "platforms:x86_64" }
|
||||
libdirs { "libs/glfw/lib-vc2010-64" }
|
||||
filter { "system:windows" }
|
||||
ignoredefaultlibraries { "msvcrt" }
|
||||
links { "opengl32", "glfw3" }
|
||||
filter { "system:macosx" }
|
||||
libdirs { "/usr/local/lib" }
|
||||
links { "glfw" }
|
||||
linkoptions { "-framework OpenGL" }
|
||||
end
|
||||
|
||||
-- example_glfw_opengl3 (GLFW + OpenGL3)
|
||||
if (_OPTIONS["with-glfw"]) then
|
||||
project "example_glfw_opengl3"
|
||||
kind "ConsoleApp"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
vpaths { ["sources"] = "./**" }
|
||||
files { "../backends/imgui_impl_glfw.*", "../backends/imgui_impl_opengl3.*", "example_glfw_opengl3/*.h", "example_glfw_opengl3/*.cpp", "./README.txt", "libs/gl3w/GL/gl3w.c" }
|
||||
includedirs { "libs/glfw/include", "libs/gl3w" }
|
||||
filter { "system:windows", "platforms:x86" }
|
||||
libdirs { "libs/glfw/lib-vc2010-32" }
|
||||
filter { "system:windows", "platforms:x86_64" }
|
||||
libdirs { "libs/glfw/lib-vc2010-64" }
|
||||
filter { "system:windows" }
|
||||
ignoredefaultlibraries { "msvcrt" }
|
||||
links { "opengl32", "glfw3" }
|
||||
filter { "system:macosx" }
|
||||
libdirs { "/usr/local/lib" }
|
||||
links { "glfw" }
|
||||
linkoptions { "-framework OpenGL" }
|
||||
end
|
||||
|
||||
-- example_glfw_vulkan (GLFW + Vulkan)
|
||||
if (_OPTIONS["with-vulkan"]) then
|
||||
project "example_glfw_vulkan"
|
||||
kind "ConsoleApp"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
vpaths { ["sources"] = "./**" }
|
||||
files { "../backends/imgui_impl_glfw*", "../backends/imgui_impl_vulkan.*", "example_glfw_vulkan/*.h", "example_glfw_vulkan/*.cpp", "./README.txt" }
|
||||
includedirs { "libs/glfw/include", "%VULKAN_SDK%/include" }
|
||||
filter { "system:windows", "platforms:x86" }
|
||||
libdirs { "libs/glfw/lib-vc2010-32", "%VULKAN_SDK%/lib32" }
|
||||
filter { "system:windows", "platforms:x86_64" }
|
||||
libdirs { "libs/glfw/lib-vc2010-64", "%VULKAN_SDK%/lib" }
|
||||
filter { "system:windows" }
|
||||
ignoredefaultlibraries { "msvcrt" }
|
||||
links { "vulkan-1", "glfw3" }
|
||||
end
|
||||
|
||||
-- example_null (no rendering)
|
||||
if (true) then
|
||||
project "example_null"
|
||||
kind "ConsoleApp"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
vpaths { ["sources"] = "./**" }
|
||||
files { "example_null/*.h", "example_null/*.cpp", "./README.txt" }
|
||||
filter { "system:windows" }
|
||||
ignoredefaultlibraries { "msvcrt" }
|
||||
end
|
||||
|
||||
-- example_sdl_opengl2 (SDL + OpenGL2)
|
||||
if (_OPTIONS["with-sdl"]) then
|
||||
project "example_sdl_opengl2"
|
||||
kind "ConsoleApp"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
vpaths { ["sources"] = "./**" }
|
||||
files { "../backends/imgui_impl_sdl*", "../backends/imgui_impl_opengl2.*", "example_sdl_opengl2/*.h", "example_sdl_opengl2/*.cpp", "./README.txt" }
|
||||
includedirs { "%SDL2_DIR%/include" }
|
||||
filter { "system:windows", "platforms:x86" }
|
||||
libdirs { "%SDL2_DIR%/lib/x86" }
|
||||
filter { "system:windows", "platforms:x86_64" }
|
||||
libdirs { "%SDL2_DIR%/lib/x64" }
|
||||
filter { "system:windows" }
|
||||
ignoredefaultlibraries { "msvcrt" }
|
||||
links { "SDL2", "SDL2main", "opengl32" }
|
||||
end
|
||||
|
||||
-- example_sdl_opengl3 (SDL + OpenGL3)
|
||||
if (_OPTIONS["with-sdl"]) then
|
||||
project "example_sdl_opengl3"
|
||||
kind "ConsoleApp"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
vpaths { ["sources"] = "./**" }
|
||||
files { "../backends/imgui_impl_sdl*", "../backends/imgui_impl_opengl3.*", "example_sdl_opengl3/*.h", "example_sdl_opengl3/*.cpp", "./README.txt", "libs/gl3w/GL/gl3w.c" }
|
||||
includedirs { "%SDL2_DIR%/include", "libs/gl3w" }
|
||||
filter { "system:windows", "platforms:x86" }
|
||||
libdirs { "%SDL2_DIR%/lib/x86" }
|
||||
filter { "system:windows", "platforms:x86_64" }
|
||||
libdirs { "%SDL2_DIR%/lib/x64" }
|
||||
filter { "system:windows" }
|
||||
ignoredefaultlibraries { "msvcrt" }
|
||||
links { "SDL2", "SDL2main", "opengl32" }
|
||||
end
|
||||
|
||||
-- example_sdl_vulkan (SDL + Vulkan)
|
||||
if (_OPTIONS["with-vulkan"]) then
|
||||
project "example_sdl_vulkan"
|
||||
kind "ConsoleApp"
|
||||
imgui_as_src ("..", "imgui")
|
||||
--imgui_as_lib ("..")
|
||||
vpaths { ["sources"] = "./**" }
|
||||
files { "../backends/imgui_impl_sdl*", "../backends/imgui_impl_vulkan.*", "example_sdl_vulkan/*.h", "example_sdl_vulkan/*.cpp", "./README.txt" }
|
||||
includedirs { "%SDL2_DIR%/include", "%VULKAN_SDK%/include" }
|
||||
filter { "system:windows", "platforms:x86" }
|
||||
libdirs { "%SDL2_DIR%/lib/x86", "%VULKAN_SDK%/lib32" }
|
||||
filter { "system:windows", "platforms:x86_64" }
|
||||
libdirs { "%SDL2_DIR%/lib/x64", "%VULKAN_SDK%/lib" }
|
||||
filter { "system:windows" }
|
||||
ignoredefaultlibraries { "msvcrt" }
|
||||
links { "SDL2", "SDL2main", "vulkan-1" }
|
||||
end
|
110
imgui.cpp
110
imgui.cpp
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.87
|
||||
// dear imgui, 1.88 WIP
|
||||
// (main code and documentation)
|
||||
|
||||
// Help:
|
||||
@ -3193,6 +3193,32 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFl
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui::RenderMouseCursor(ImVec2 base_pos, float base_scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT);
|
||||
for (int n = 0; n < g.Viewports.Size; n++)
|
||||
{
|
||||
ImGuiViewportP* viewport = g.Viewports[n];
|
||||
ImDrawList* draw_list = GetForegroundDrawList(viewport);
|
||||
ImFontAtlas* font_atlas = draw_list->_Data->Font->ContainerAtlas;
|
||||
ImVec2 offset, size, uv[4];
|
||||
if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2]))
|
||||
{
|
||||
const ImVec2 pos = base_pos - offset;
|
||||
const float scale = base_scale;
|
||||
ImTextureID tex_id = font_atlas->TexID;
|
||||
draw_list->PushTextureID(tex_id);
|
||||
draw_list->AddImage(tex_id, pos + ImVec2(1, 0) * scale, pos + (ImVec2(1, 0) + size) * scale, uv[2], uv[3], col_shadow);
|
||||
draw_list->AddImage(tex_id, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv[2], uv[3], col_shadow);
|
||||
draw_list->AddImage(tex_id, pos, pos + size * scale, uv[2], uv[3], col_border);
|
||||
draw_list->AddImage(tex_id, pos, pos + size * scale, uv[0], uv[1], col_fill);
|
||||
draw_list->PopTextureID();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -4888,6 +4914,10 @@ void ImGui::Render()
|
||||
if (windows_to_render_top_most[n] && IsWindowActiveAndVisible(windows_to_render_top_most[n])) // NavWindowingTarget is always temporarily displayed as the top-most window
|
||||
AddRootWindowToDrawData(windows_to_render_top_most[n]);
|
||||
|
||||
// Draw software mouse cursor if requested by io.MouseDrawCursor flag
|
||||
if (g.IO.MouseDrawCursor && first_render_of_frame && g.MouseCursor != ImGuiMouseCursor_None)
|
||||
RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48));
|
||||
|
||||
// Setup ImDrawData structures for end-user
|
||||
g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = 0;
|
||||
for (int n = 0; n < g.Viewports.Size; n++)
|
||||
@ -4895,10 +4925,6 @@ void ImGui::Render()
|
||||
ImGuiViewportP* viewport = g.Viewports[n];
|
||||
viewport->DrawDataBuilder.FlattenIntoSingleLayer();
|
||||
|
||||
// Draw software mouse cursor if requested by io.MouseDrawCursor flag
|
||||
if (g.IO.MouseDrawCursor && first_render_of_frame)
|
||||
RenderMouseCursor(GetForegroundDrawList(viewport), g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48));
|
||||
|
||||
// Add foreground ImDrawList (for each active viewport)
|
||||
if (viewport->DrawLists[1] != NULL)
|
||||
AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetForegroundDrawList(viewport));
|
||||
@ -7539,6 +7565,7 @@ static const char* const GKeyNames[] =
|
||||
"GamepadL1", "GamepadR1", "GamepadL2", "GamepadR2", "GamepadL3", "GamepadR3",
|
||||
"GamepadLStickUp", "GamepadLStickDown", "GamepadLStickLeft", "GamepadLStickRight",
|
||||
"GamepadRStickUp", "GamepadRStickDown", "GamepadRStickLeft", "GamepadRStickRight",
|
||||
"Copy", "Cut", "Paste", "Undo", "Redo", "SelectAll",
|
||||
"ModCtrl", "ModShift", "ModAlt", "ModSuper"
|
||||
};
|
||||
IM_STATIC_ASSERT(ImGuiKey_NamedKey_COUNT == IM_ARRAYSIZE(GKeyNames));
|
||||
@ -13000,27 +13027,44 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat
|
||||
ImGuiStackLevelInfo* info = &tool->Results[tool->StackLevel];
|
||||
IM_ASSERT(info->ID == id && info->QueryFrameCount > 0);
|
||||
|
||||
int data_len;
|
||||
switch (data_type)
|
||||
{
|
||||
case ImGuiDataType_S32:
|
||||
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%d", (int)(intptr_t)data_id);
|
||||
break;
|
||||
case ImGuiDataType_String:
|
||||
data_len = data_id_end ? (int)((const char*)data_id_end - (const char*)data_id) : (int)strlen((const char*)data_id);
|
||||
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "\"%.*s\"", data_len, (const char*)data_id);
|
||||
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%.*s", data_id_end ? (int)((const char*)data_id_end - (const char*)data_id) : (int)strlen((const char*)data_id), (const char*)data_id);
|
||||
break;
|
||||
case ImGuiDataType_Pointer:
|
||||
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "(void*)0x%p", data_id);
|
||||
break;
|
||||
case ImGuiDataType_ID:
|
||||
if (info->Desc[0] == 0) // PushOverrideID() is often used to avoid hashing twice, which would lead to 2 calls to DebugHookIdInfo(). We prioritize the first one.
|
||||
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "0x%08X [override]", id);
|
||||
if (info->Desc[0] != 0) // PushOverrideID() is often used to avoid hashing twice, which would lead to 2 calls to DebugHookIdInfo(). We prioritize the first one.
|
||||
return;
|
||||
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "0x%08X [override]", id);
|
||||
break;
|
||||
default:
|
||||
IM_ASSERT(0);
|
||||
}
|
||||
info->QuerySuccess = true;
|
||||
info->DataType = data_type;
|
||||
}
|
||||
|
||||
static int StackToolFormatLevelInfo(ImGuiStackTool* tool, int n, bool format_for_ui, char* buf, size_t buf_size)
|
||||
{
|
||||
ImGuiStackLevelInfo* info = &tool->Results[n];
|
||||
ImGuiWindow* window = (info->Desc[0] == 0 && n == 0) ? ImGui::FindWindowByID(info->ID) : NULL;
|
||||
if (window) // Source: window name (because the root ID don't call GetID() and so doesn't get hooked)
|
||||
return ImFormatString(buf, buf_size, format_for_ui ? "\"%s\" [window]" : "%s", window->Name);
|
||||
if (info->QuerySuccess) // Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id)
|
||||
return ImFormatString(buf, buf_size, (format_for_ui && info->DataType == ImGuiDataType_String) ? "\"%s\"" : "%s", info->Desc);
|
||||
if (tool->StackLevel < tool->Results.Size) // Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers.
|
||||
return (*buf = 0);
|
||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||
if (const char* label = ImGuiTestEngine_FindItemDebugLabel(GImGui, info->ID)) // Source: ImGuiTestEngine's ItemInfo()
|
||||
return ImFormatString(buf, buf_size, format_for_ui ? "??? \"%s\"" : "%s", label);
|
||||
#endif
|
||||
return ImFormatString(buf, buf_size, "???");
|
||||
}
|
||||
|
||||
// Stack Tool: Display UI
|
||||
@ -13036,6 +13080,7 @@ void ImGui::ShowStackToolWindow(bool* p_open)
|
||||
}
|
||||
|
||||
// Display hovered/active status
|
||||
ImGuiStackTool* tool = &g.DebugStackTool;
|
||||
const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
|
||||
const ImGuiID active_id = g.ActiveId;
|
||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||
@ -13046,8 +13091,33 @@ void ImGui::ShowStackToolWindow(bool* p_open)
|
||||
SameLine();
|
||||
MetricsHelpMarker("Hover an item with the mouse to display elements of the ID Stack leading to the item's final ID.\nEach level of the stack correspond to a PushID() call.\nAll levels of the stack are hashed together to make the final ID of a widget (ID displayed at the bottom level of the stack).\nRead FAQ entry about the ID stack for details.");
|
||||
|
||||
// CTRL+C to copy path
|
||||
const float time_since_copy = (float)g.Time - tool->CopyToClipboardLastTime;
|
||||
Checkbox("Ctrl+C: copy path to clipboard", &tool->CopyToClipboardOnCtrlC);
|
||||
SameLine();
|
||||
TextColored((time_since_copy >= 0.0f && time_since_copy < 0.75f && ImFmod(time_since_copy, 0.25f) < 0.25f * 0.5f) ? ImVec4(1.f, 1.f, 0.3f, 1.f) : ImVec4(), "*COPIED*");
|
||||
if (tool->CopyToClipboardOnCtrlC && IsKeyDown(ImGuiKey_ModCtrl) && IsKeyPressed(ImGuiKey_C))
|
||||
{
|
||||
tool->CopyToClipboardLastTime = (float)g.Time;
|
||||
char* p = g.TempBuffer;
|
||||
char* p_end = p + IM_ARRAYSIZE(g.TempBuffer);
|
||||
for (int stack_n = 0; stack_n < tool->Results.Size && p + 3 < p_end; stack_n++)
|
||||
{
|
||||
*p++ = '/';
|
||||
char level_desc[256];
|
||||
StackToolFormatLevelInfo(tool, stack_n, false, level_desc, IM_ARRAYSIZE(level_desc));
|
||||
for (int n = 0; level_desc[n] && p + 2 < p_end; n++)
|
||||
{
|
||||
if (level_desc[n] == '/')
|
||||
*p++ = '\\';
|
||||
*p++ = level_desc[n];
|
||||
}
|
||||
}
|
||||
*p = '\0';
|
||||
SetClipboardText(g.TempBuffer);
|
||||
}
|
||||
|
||||
// Display decorated stack
|
||||
ImGuiStackTool* tool = &g.DebugStackTool;
|
||||
tool->LastActiveFrame = g.FrameCount;
|
||||
if (tool->Results.Size > 0 && BeginTable("##table", 3, ImGuiTableFlags_Borders))
|
||||
{
|
||||
@ -13061,23 +13131,9 @@ void ImGui::ShowStackToolWindow(bool* p_open)
|
||||
ImGuiStackLevelInfo* info = &tool->Results[n];
|
||||
TableNextColumn();
|
||||
Text("0x%08X", (n > 0) ? tool->Results[n - 1].ID : 0);
|
||||
|
||||
TableNextColumn();
|
||||
ImGuiWindow* window = (info->Desc[0] == 0 && n == 0) ? FindWindowByID(info->ID) : NULL;
|
||||
if (window) // Source: window name (because the root ID don't call GetID() and so doesn't get hooked)
|
||||
Text("\"%s\" [window]", window->Name);
|
||||
else if (info->QuerySuccess) // Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id)
|
||||
TextUnformatted(info->Desc);
|
||||
else if (tool->StackLevel >= tool->Results.Size) // Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers.
|
||||
{
|
||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||
if (const char* label = ImGuiTestEngine_FindItemDebugLabel(&g, info->ID)) // Source: ImGuiTestEngine's ItemInfo()
|
||||
Text("??? \"%s\"", label);
|
||||
else
|
||||
#endif
|
||||
TextUnformatted("???");
|
||||
}
|
||||
|
||||
StackToolFormatLevelInfo(tool, n, true, g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer));
|
||||
TextUnformatted(g.TempBuffer);
|
||||
TableNextColumn();
|
||||
Text("0x%08X", info->ID);
|
||||
if (n == tool->Results.Size - 1)
|
||||
|
14
imgui.h
14
imgui.h
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.87
|
||||
// dear imgui, v1.88 WIP
|
||||
// (headers)
|
||||
|
||||
// Help:
|
||||
@ -64,8 +64,8 @@ Index of this file:
|
||||
|
||||
// Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||
#define IMGUI_VERSION "1.87"
|
||||
#define IMGUI_VERSION_NUM 18700
|
||||
#define IMGUI_VERSION "1.88 WIP"
|
||||
#define IMGUI_VERSION_NUM 18703
|
||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
@ -1421,6 +1421,14 @@ enum ImGuiKey_
|
||||
ImGuiKey_GamepadRStickLeft, // [Analog]
|
||||
ImGuiKey_GamepadRStickRight, // [Analog]
|
||||
|
||||
// High-level/virtual keys (for e.g. web apps events)
|
||||
ImGuiKey_Copy,
|
||||
ImGuiKey_Cut,
|
||||
ImGuiKey_Paste,
|
||||
ImGuiKey_Undo,
|
||||
ImGuiKey_Redo,
|
||||
ImGuiKey_SelectAll,
|
||||
|
||||
// Keyboard Modifiers
|
||||
// - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper, in a format allowing
|
||||
// them to be accessed via standard key API, allowing calls such as IsKeyPressed(), IsKeyReleased(), querying duration etc.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.87
|
||||
// dear imgui, v1.88 WIP
|
||||
// (demo code)
|
||||
|
||||
// Help:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.87
|
||||
// dear imgui, v1.88 WIP
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
@ -1206,8 +1206,8 @@ void ImDrawList::PathArcTo(const ImVec2& center, float radius, float a_min, floa
|
||||
|
||||
const float a_min_segment_angle = a_min_sample * IM_PI * 2.0f / IM_DRAWLIST_ARCFAST_SAMPLE_MAX;
|
||||
const float a_max_segment_angle = a_max_sample * IM_PI * 2.0f / IM_DRAWLIST_ARCFAST_SAMPLE_MAX;
|
||||
const bool a_emit_start = (a_min_segment_angle - a_min) != 0.0f;
|
||||
const bool a_emit_end = (a_max - a_max_segment_angle) != 0.0f;
|
||||
const bool a_emit_start = ImAbs(a_min_segment_angle - a_min) >= 1e-5f;
|
||||
const bool a_emit_end = ImAbs(a_max - a_max_segment_angle) >= 1e-5f;
|
||||
|
||||
_Path.reserve(_Path.Size + (a_mid_samples + 1 + (a_emit_start ? 1 : 0) + (a_emit_end ? 1 : 0)));
|
||||
if (a_emit_start)
|
||||
@ -3736,7 +3736,6 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
||||
// - RenderArrow()
|
||||
// - RenderBullet()
|
||||
// - RenderCheckMark()
|
||||
// - RenderMouseCursor()
|
||||
// - RenderArrowPointingAt()
|
||||
// - RenderRectFilledRangeH()
|
||||
// - RenderRectFilledWithHole()
|
||||
@ -3797,27 +3796,6 @@ void ImGui::RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float
|
||||
draw_list->PathStroke(col, 0, thickness);
|
||||
}
|
||||
|
||||
void ImGui::RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
|
||||
{
|
||||
if (mouse_cursor == ImGuiMouseCursor_None)
|
||||
return;
|
||||
IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT);
|
||||
|
||||
ImFontAtlas* font_atlas = draw_list->_Data->Font->ContainerAtlas;
|
||||
ImVec2 offset, size, uv[4];
|
||||
if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2]))
|
||||
{
|
||||
pos -= offset;
|
||||
ImTextureID tex_id = font_atlas->TexID;
|
||||
draw_list->PushTextureID(tex_id);
|
||||
draw_list->AddImage(tex_id, pos + ImVec2(1, 0) * scale, pos + (ImVec2(1, 0) + size) * scale, uv[2], uv[3], col_shadow);
|
||||
draw_list->AddImage(tex_id, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv[2], uv[3], col_shadow);
|
||||
draw_list->AddImage(tex_id, pos, pos + size * scale, uv[2], uv[3], col_border);
|
||||
draw_list->AddImage(tex_id, pos, pos + size * scale, uv[0], uv[1], col_fill);
|
||||
draw_list->PopTextureID();
|
||||
}
|
||||
}
|
||||
|
||||
// Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side.
|
||||
void ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.87
|
||||
// dear imgui, v1.88 WIP
|
||||
// (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!
|
||||
@ -1510,7 +1510,8 @@ struct ImGuiStackLevelInfo
|
||||
ImGuiID ID;
|
||||
ImS8 QueryFrameCount; // >= 1: Query in progress
|
||||
bool QuerySuccess; // Obtained result from DebugHookIdInfo()
|
||||
char Desc[58]; // Arbitrarily sized buffer to hold a result (FIXME: could replace Results[] with a chunk stream?)
|
||||
ImGuiDataType DataType : 8;
|
||||
char Desc[57]; // Arbitrarily sized buffer to hold a result (FIXME: could replace Results[] with a chunk stream?) FIXME: Now that we added CTRL+C this should be fixed.
|
||||
|
||||
ImGuiStackLevelInfo() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
@ -1522,8 +1523,10 @@ struct ImGuiStackTool
|
||||
int StackLevel; // -1: query stack and resize Results, >= 0: individual stack level
|
||||
ImGuiID QueryId; // ID to query details for
|
||||
ImVector<ImGuiStackLevelInfo> Results;
|
||||
bool CopyToClipboardOnCtrlC;
|
||||
float CopyToClipboardLastTime;
|
||||
|
||||
ImGuiStackTool() { memset(this, 0, sizeof(*this)); }
|
||||
ImGuiStackTool() { memset(this, 0, sizeof(*this)); CopyToClipboardLastTime = -FLT_MAX; }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -2760,12 +2763,12 @@ namespace ImGui
|
||||
IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImDrawList* draw_list, ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding = 0.0f, ImDrawFlags flags = 0);
|
||||
IMGUI_API void RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags = ImGuiNavHighlightFlags_TypeDefault); // Navigation highlight
|
||||
IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.
|
||||
IMGUI_API void RenderMouseCursor(ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow);
|
||||
|
||||
// Render helpers (those functions don't access any ImGui state!)
|
||||
IMGUI_API void RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale = 1.0f);
|
||||
IMGUI_API void RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col);
|
||||
IMGUI_API void RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz);
|
||||
IMGUI_API void RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow);
|
||||
IMGUI_API void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col);
|
||||
IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);
|
||||
IMGUI_API void RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect inner, ImU32 col, float rounding);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.87
|
||||
// dear imgui, v1.88 WIP
|
||||
// (tables and columns code)
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.87
|
||||
// dear imgui, v1.88 WIP
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
@ -4248,11 +4248,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
const bool is_shift_key_only = (io.KeyMods == ImGuiKeyModFlags_Shift);
|
||||
const bool is_shortcut_key = g.IO.ConfigMacOSXBehaviors ? (io.KeyMods == ImGuiKeyModFlags_Super) : (io.KeyMods == ImGuiKeyModFlags_Ctrl);
|
||||
|
||||
const bool is_cut = ((is_shortcut_key && IsKeyPressed(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Delete))) && !is_readonly && !is_password && (!is_multiline || state->HasSelection());
|
||||
const bool is_copy = ((is_shortcut_key && IsKeyPressed(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressed(ImGuiKey_Insert))) && !is_password && (!is_multiline || state->HasSelection());
|
||||
const bool is_paste = ((is_shortcut_key && IsKeyPressed(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Insert))) && !is_readonly;
|
||||
const bool is_undo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Z)) && !is_readonly && is_undoable);
|
||||
const bool is_redo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressed(ImGuiKey_Z))) && !is_readonly && is_undoable;
|
||||
const bool is_cut = ((is_shortcut_key && IsKeyPressed(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Delete)) || IsKeyPressed(ImGuiKey_Cut)) && !is_readonly && !is_password && (!is_multiline || state->HasSelection());
|
||||
const bool is_copy = ((is_shortcut_key && IsKeyPressed(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressed(ImGuiKey_Insert)) || IsKeyPressed(ImGuiKey_Copy)) && !is_password && (!is_multiline || state->HasSelection());
|
||||
const bool is_paste = ((is_shortcut_key && IsKeyPressed(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Insert)) || IsKeyPressed(ImGuiKey_Paste)) && !is_readonly;
|
||||
const bool is_undo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Z)) || IsKeyPressed(ImGuiKey_Undo)) && !is_readonly && is_undoable;
|
||||
const bool is_redo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressed(ImGuiKey_Z)) || IsKeyPressed(ImGuiKey_Redo)) && !is_readonly && is_undoable;
|
||||
|
||||
// We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful.
|
||||
const bool is_validate_enter = IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_KeypadEnter);
|
||||
@ -4307,7 +4307,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
state->OnKeyPressed(is_undo ? STB_TEXTEDIT_K_UNDO : STB_TEXTEDIT_K_REDO);
|
||||
state->ClearSelection();
|
||||
}
|
||||
else if (is_shortcut_key && IsKeyPressed(ImGuiKey_A))
|
||||
else if ((is_shortcut_key && IsKeyPressed(ImGuiKey_A)) || IsKeyPressed(ImGuiKey_SelectAll))
|
||||
{
|
||||
state->SelectAll();
|
||||
state->CursorFollow = true;
|
||||
|
Reference in New Issue
Block a user