mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
Skip rendering if alpha is 0.0
This commit is contained in:
parent
c5dacee3a7
commit
ca027e1754
55
imgui.cpp
55
imgui.cpp
@ -1401,34 +1401,39 @@ void Render()
|
|||||||
memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));
|
memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render tooltip
|
// Skip render altogether if alpha is 0.0
|
||||||
if (g.Tooltip[0])
|
// Note that vertex buffers have been created, so it is best practice that you don't call Begin/End in the first place.
|
||||||
|
if (g.Style.Alpha > 0.0f)
|
||||||
{
|
{
|
||||||
// Use a dummy window to render the tooltip
|
// Render tooltip
|
||||||
ImGui::BeginTooltip();
|
if (g.Tooltip[0])
|
||||||
ImGui::TextUnformatted(g.Tooltip);
|
{
|
||||||
ImGui::EndTooltip();
|
// Use a dummy window to render the tooltip
|
||||||
}
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::TextUnformatted(g.Tooltip);
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
|
|
||||||
// Gather windows to render
|
// Gather windows to render
|
||||||
g.RenderDrawLists.resize(0);
|
g.RenderDrawLists.resize(0);
|
||||||
for (size_t i = 0; i != g.Windows.size(); i++)
|
for (size_t i = 0; i != g.Windows.size(); i++)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = g.Windows[i];
|
ImGuiWindow* window = g.Windows[i];
|
||||||
if (window->Visible && (window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) == 0)
|
if (window->Visible && (window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) == 0)
|
||||||
window->AddToRenderList();
|
window->AddToRenderList();
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i != g.Windows.size(); i++)
|
for (size_t i = 0; i != g.Windows.size(); i++)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = g.Windows[i];
|
ImGuiWindow* window = g.Windows[i];
|
||||||
if (window->Visible && (window->Flags & ImGuiWindowFlags_Tooltip))
|
if (window->Visible && (window->Flags & ImGuiWindowFlags_Tooltip))
|
||||||
window->AddToRenderList();
|
window->AddToRenderList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
if (!g.RenderDrawLists.empty())
|
if (!g.RenderDrawLists.empty())
|
||||||
g.IO.RenderDrawListsFn(&g.RenderDrawLists[0], (int)g.RenderDrawLists.size());
|
g.IO.RenderDrawListsFn(&g.RenderDrawLists[0], (int)g.RenderDrawLists.size());
|
||||||
g.RenderDrawLists.resize(0);
|
g.RenderDrawLists.resize(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the optional ## from which we stop displaying text.
|
// Find the optional ## from which we stop displaying text.
|
||||||
|
Loading…
Reference in New Issue
Block a user