mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Demo: Tweak window option and style display
This commit is contained in:
parent
a9bdda0d95
commit
18223fd3ab
@ -139,7 +139,7 @@ void ImGui::ShowTestWindow(bool* p_opened)
|
|||||||
static bool no_scrollbar = false;
|
static bool no_scrollbar = false;
|
||||||
static bool no_collapse = false;
|
static bool no_collapse = false;
|
||||||
static bool no_menu = false;
|
static bool no_menu = false;
|
||||||
static float bg_alpha = 0.65f;
|
static float bg_alpha = -0.01f; // <0: default
|
||||||
|
|
||||||
// Demonstrate the various window flags. Typically you would just use the default.
|
// Demonstrate the various window flags. Typically you would just use the default.
|
||||||
ImGuiWindowFlags window_flags = 0;
|
ImGuiWindowFlags window_flags = 0;
|
||||||
@ -203,14 +203,17 @@ void ImGui::ShowTestWindow(bool* p_opened)
|
|||||||
|
|
||||||
if (ImGui::CollapsingHeader("Window options"))
|
if (ImGui::CollapsingHeader("Window options"))
|
||||||
{
|
{
|
||||||
ImGui::Checkbox("no titlebar", &no_titlebar); ImGui::SameLine(150);
|
ImGui::Checkbox("No titlebar", &no_titlebar); ImGui::SameLine(150);
|
||||||
ImGui::Checkbox("no border", &no_border); ImGui::SameLine(300);
|
ImGui::Checkbox("No border", &no_border); ImGui::SameLine(300);
|
||||||
ImGui::Checkbox("no resize", &no_resize);
|
ImGui::Checkbox("No resize", &no_resize);
|
||||||
ImGui::Checkbox("no move", &no_move); ImGui::SameLine(150);
|
ImGui::Checkbox("No move", &no_move); ImGui::SameLine(150);
|
||||||
ImGui::Checkbox("no scrollbar", &no_scrollbar); ImGui::SameLine(300);
|
ImGui::Checkbox("No scrollbar", &no_scrollbar); ImGui::SameLine(300);
|
||||||
ImGui::Checkbox("no collapse", &no_collapse);
|
ImGui::Checkbox("No collapse", &no_collapse);
|
||||||
ImGui::Checkbox("no menu", &no_menu);
|
ImGui::Checkbox("No menu", &no_menu);
|
||||||
ImGui::SliderFloat("bg alpha", &bg_alpha, 0.0f, 1.0f);
|
|
||||||
|
ImGui::PushItemWidth(100);
|
||||||
|
ImGui::DragFloat("Window Fill Alpha", &bg_alpha, 0.005f, -0.01f, 1.0f, bg_alpha < 0.0f ? "(default)" : "%.3f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
||||||
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
if (ImGui::TreeNode("Style"))
|
if (ImGui::TreeNode("Style"))
|
||||||
{
|
{
|
||||||
@ -1509,16 +1512,16 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::PushItemWidth(100);
|
ImGui::PushItemWidth(100);
|
||||||
ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, FLT_MAX, NULL, 2.0f);
|
ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, FLT_MAX, NULL, 2.0f);
|
||||||
if (style.CurveTessellationTol < 0.0f) style.CurveTessellationTol = 0.10f;
|
if (style.CurveTessellationTol < 0.0f) style.CurveTessellationTol = 0.10f;
|
||||||
|
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
||||||
|
ImGui::DragFloat("Window Fill Alpha Default", &style.WindowFillAlphaDefault, 0.005f, 0.0f, 1.0f, "%.2f");
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::TreeNode("Sizes"))
|
if (ImGui::TreeNode("Sizes"))
|
||||||
{
|
{
|
||||||
ImGui::SliderFloat("Alpha", &style.Alpha, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI. But application code could have a toggle to switch between zero and non-zero.
|
|
||||||
ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f");
|
ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f");
|
||||||
ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 16.0f, "%.0f");
|
ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 16.0f, "%.0f");
|
||||||
ImGui::SliderFloat("WindowFillAlphaDefault", &style.WindowFillAlphaDefault, 0.0f, 1.0f, "%.2f");
|
|
||||||
ImGui::SliderFloat("ChildWindowRounding", &style.ChildWindowRounding, 0.0f, 16.0f, "%.0f");
|
ImGui::SliderFloat("ChildWindowRounding", &style.ChildWindowRounding, 0.0f, 16.0f, "%.0f");
|
||||||
ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f");
|
ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f");
|
||||||
ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 16.0f, "%.0f");
|
ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 16.0f, "%.0f");
|
||||||
|
Loading…
Reference in New Issue
Block a user