mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Merge branch 'master' into navigation
This commit is contained in:
41
imgui.cpp
41
imgui.cpp
@ -110,7 +110,7 @@
|
||||
- See examples/ folder for standalone sample applications. To understand the integration process, you can read examples/opengl2_example/ because it is short,
|
||||
then switch to the one more appropriate to your use case.
|
||||
- You may be able to grab and copy a ready made imgui_impl_*** file from the examples/.
|
||||
- When using Dear ImGui, your programming IDE if your friend: follow the declaration of variables, functions and types to find comments about them.
|
||||
- When using Dear ImGui, your programming IDE is your friend: follow the declaration of variables, functions and types to find comments about them.
|
||||
|
||||
- Init: retrieve the ImGuiIO structure with ImGui::GetIO() and fill the fields marked 'Settings': at minimum you need to set io.DisplaySize (application resolution).
|
||||
Later on you will fill your keyboard mapping, clipboard handlers, and other advanced features but for a basic integration you don't need to worry about it all.
|
||||
@ -784,6 +784,29 @@ void ImGui::StyleColorsClassic(ImGuiStyle* dst)
|
||||
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.12f);
|
||||
}
|
||||
|
||||
// To scale your entire UI (e.g. if you want your app to use High DPI or generally be DPI aware) you may use this helper function. Scaling the fonts is done separately and is up to you.
|
||||
// Tips: if you need to change your scale multiple times, prefer calling this on a freshly initialized ImGuiStyle structure rather than scaling multiple times (because floating point multiplications are lossy).
|
||||
void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
||||
{
|
||||
WindowPadding *= scale_factor;
|
||||
WindowMinSize *= scale_factor;
|
||||
WindowRounding *= scale_factor;
|
||||
ChildWindowRounding *= scale_factor;
|
||||
FramePadding *= scale_factor;
|
||||
FrameRounding *= scale_factor;
|
||||
ItemSpacing *= scale_factor;
|
||||
ItemInnerSpacing *= scale_factor;
|
||||
TouchExtraPadding *= scale_factor;
|
||||
IndentSpacing *= scale_factor;
|
||||
ColumnsMinSpacing *= scale_factor;
|
||||
ScrollbarSize *= scale_factor;
|
||||
ScrollbarRounding *= scale_factor;
|
||||
GrabMinSize *= scale_factor;
|
||||
GrabRounding *= scale_factor;
|
||||
DisplayWindowPadding *= scale_factor;
|
||||
DisplaySafeAreaPadding *= scale_factor;
|
||||
}
|
||||
|
||||
ImGuiIO::ImGuiIO()
|
||||
{
|
||||
// Most fields are initialized with zero
|
||||
@ -4516,9 +4539,9 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
||||
|
||||
char title[256];
|
||||
if (name)
|
||||
ImFormatString(title, IM_ARRAYSIZE(title), "%s.%s.%08X", parent_window->Name, name, id);
|
||||
ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s_%08X", parent_window->Name, name, id);
|
||||
else
|
||||
ImFormatString(title, IM_ARRAYSIZE(title), "%s.%08X", parent_window->Name, id);
|
||||
ImFormatString(title, IM_ARRAYSIZE(title), "%s/%08X", parent_window->Name, id);
|
||||
|
||||
bool ret = ImGui::Begin(title, NULL, size, -1.0f, flags);
|
||||
ImGuiWindow* child_window = ImGui::GetCurrentWindow();
|
||||
@ -11647,6 +11670,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
int elem_offset = 0;
|
||||
for (const ImDrawCmd* pcmd = draw_list->CmdBuffer.begin(); pcmd < draw_list->CmdBuffer.end(); elem_offset += pcmd->ElemCount, pcmd++)
|
||||
{
|
||||
if (pcmd->UserCallback == NULL && pcmd->ElemCount == 0)
|
||||
continue;
|
||||
if (pcmd->UserCallback)
|
||||
{
|
||||
ImGui::BulletText("Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData);
|
||||
@ -11701,8 +11726,9 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
|
||||
return;
|
||||
NodeDrawList(window->DrawList, "DrawList");
|
||||
ImGui::BulletText("Pos: (%.1f,%.1f)", window->Pos.x, window->Pos.y);
|
||||
ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
|
||||
ImGui::BulletText("Pos: (%.1f,%.1f), Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Pos.x, window->Pos.y, window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
|
||||
if (ImGui::IsItemHovered())
|
||||
GImGui->OverlayDrawList.AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255,255,0,255));
|
||||
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
|
||||
ImGui::BulletText("Active: %d, Accessed: %d", window->Active, window->Accessed);
|
||||
ImGui::BulletText("NavLastIds: 0x%08X,0x%08X, NavLayerActiveMask: %X", window->NavLastIds[0], window->NavLastIds[1], window->DC.NavLayerActiveMask);
|
||||
@ -11718,8 +11744,9 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
Funcs::NodeWindows(g.Windows, "Windows");
|
||||
if (ImGui::TreeNode("DrawList", "Active DrawLists (%d)", g.RenderDrawLists[0].Size))
|
||||
{
|
||||
for (int i = 0; i < g.RenderDrawLists[0].Size; i++)
|
||||
Funcs::NodeDrawList(g.RenderDrawLists[0][i], "DrawList");
|
||||
for (int layer = 0; layer < IM_ARRAYSIZE(g.RenderDrawLists); layer++)
|
||||
for (int i = 0; i < g.RenderDrawLists[layer].Size; i++)
|
||||
Funcs::NodeDrawList(g.RenderDrawLists[0][i], "DrawList");
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Popups", "Open Popups Stack (%d)", g.OpenPopupStack.Size))
|
||||
|
Reference in New Issue
Block a user