mirror of
https://github.com/Drezil/imgui.git
synced 2025-04-16 08:04:00 +00:00
Examples: Fixed Simple Layout example always showing. Using BeginPopupContextItem().
This commit is contained in:
parent
4144c59ce4
commit
d86785ac98
11
imgui.cpp
11
imgui.cpp
@ -10286,7 +10286,7 @@ void ImGui::ShowTestWindow(bool* opened)
|
|||||||
static bool show_app_metrics = false;
|
static bool show_app_metrics = false;
|
||||||
static bool show_app_main_menu_bar = false;
|
static bool show_app_main_menu_bar = false;
|
||||||
static bool show_app_console = false;
|
static bool show_app_console = false;
|
||||||
static bool show_app_layout = true;
|
static bool show_app_layout = false;
|
||||||
static bool show_app_long_text = false;
|
static bool show_app_long_text = false;
|
||||||
static bool show_app_auto_resize = false;
|
static bool show_app_auto_resize = false;
|
||||||
static bool show_app_fixed_overlay = false;
|
static bool show_app_fixed_overlay = false;
|
||||||
@ -10543,7 +10543,7 @@ void ImGui::ShowTestWindow(bool* opened)
|
|||||||
if (i > 0)
|
if (i > 0)
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::PushID(i);
|
ImGui::PushID(i);
|
||||||
int frame_padding = -1 + i; // -1 padding uses default padding
|
int frame_padding = -1 + i; // -1 = uses default padding
|
||||||
if (ImGui::ImageButton(tex_id, ImVec2(32,32), ImVec2(0,0), ImVec2(32.0f/tex_w,32/tex_h), frame_padding))
|
if (ImGui::ImageButton(tex_id, ImVec2(32,32), ImVec2(0,0), ImVec2(32.0f/tex_w,32/tex_h), frame_padding))
|
||||||
pressed_count += 1;
|
pressed_count += 1;
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
@ -10657,11 +10657,8 @@ void ImGui::ShowTestWindow(bool* opened)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static float value = 0.5f;
|
static float value = 0.5f;
|
||||||
ImGui::Text("Value = %.3f", value);
|
ImGui::Text("Value = %.3f (Right-click here)", value);
|
||||||
if (ImGui::IsItemHovered() && ImGui::IsMouseClicked(1))
|
if (ImGui::BeginPopupContextItem("item context menu"))
|
||||||
ImGui::OpenPopup("context menu");
|
|
||||||
ImGui::SameLine(); ImGui::Text("<-- right-click");
|
|
||||||
if (ImGui::BeginPopup("context menu"))
|
|
||||||
{
|
{
|
||||||
if (ImGui::Selectable("Set to zero")) value = 0.0f;
|
if (ImGui::Selectable("Set to zero")) value = 0.0f;
|
||||||
if (ImGui::Selectable("Set to PI")) value = PI;
|
if (ImGui::Selectable("Set to PI")) value = PI;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user