Added SetNextWindowBgAlpha() helper. (#1567) particularly helpul with the marking of the old 5-parameters version of Begin() as obsolete.

This commit is contained in:
omar
2018-01-23 19:13:49 +01:00
parent 2645ab5f7f
commit 9a76fd30fd
4 changed files with 22 additions and 20 deletions

View File

@ -2398,7 +2398,7 @@ static void ShowExampleAppFixedOverlay(bool* p_open)
ImVec2 window_pos = ImVec2((corner & 1) ? ImGui::GetIO().DisplaySize.x - DISTANCE : DISTANCE, (corner & 2) ? ImGui::GetIO().DisplaySize.y - DISTANCE : DISTANCE);
ImVec2 window_pos_pivot = ImVec2((corner & 1) ? 1.0f : 0.0f, (corner & 2) ? 1.0f : 0.0f);
ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot);
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 0.3f)); // Transparent background
ImGui::SetNextWindowBgAlpha(0.3f); // Transparent background
if (ImGui::Begin("Example: Fixed Overlay", p_open, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoSavedSettings))
{
ImGui::Text("Simple overlay\nin the corner of the screen.\n(right-click to change position)");
@ -2415,7 +2415,6 @@ static void ShowExampleAppFixedOverlay(bool* p_open)
}
ImGui::End();
}
ImGui::PopStyleColor();
}
// Demonstrate using "##" and "###" in identifiers to manipulate ID generation.