From 94bf12f14b69393fa8f471fc90dcdd370fb91566 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 6 Dec 2017 22:20:08 +0100 Subject: [PATCH] Demo: Display better mouse cursor info for debugging backends. --- imgui.h | 2 +- imgui_demo.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/imgui.h b/imgui.h index 8929dea7..f8153c85 100644 --- a/imgui.h +++ b/imgui.h @@ -738,7 +738,7 @@ enum ImGuiMouseCursor_ ImGuiMouseCursor_Move, // Unused ImGuiMouseCursor_ResizeNS, // Unused ImGuiMouseCursor_ResizeEW, // When hovering over a column - ImGuiMouseCursor_ResizeNESW, // Unused + ImGuiMouseCursor_ResizeNESW, // When hovering over the bottom-left corner of a window ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window ImGuiMouseCursor_Count_ }; diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 6b0fed76..db3a163d 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1828,12 +1828,16 @@ void ImGui::ShowTestWindow(bool* p_open) if (ImGui::TreeNode("Mouse cursors")) { + const char* mouse_cursors_names[] = { "Arrow", "TextInput", "Move", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE" }; + IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_Count_); + + ImGui::Text("Current mouse cursor = %d: %s", ImGui::GetMouseCursor(), mouse_cursors_names[ImGui::GetMouseCursor()]); ImGui::Text("Hover to see mouse cursors:"); ImGui::SameLine(); ShowHelpMarker("Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, otherwise your backend needs to handle it."); for (int i = 0; i < ImGuiMouseCursor_Count_; i++) { char label[32]; - sprintf(label, "Mouse cursor %d", i); + sprintf(label, "Mouse cursor %d: %s", i, mouse_cursors_names[i]); ImGui::Bullet(); ImGui::Selectable(label, false); if (ImGui::IsItemHovered()) ImGui::SetMouseCursor(i);