mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 05:27:01 +00:00
Demo: Display better mouse cursor info for debugging backends.
This commit is contained in:
parent
20c7aab60c
commit
94bf12f14b
2
imgui.h
2
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_
|
||||
};
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user