mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Demo: Arrange some inputs panels.
This commit is contained in:
parent
36fa2b9523
commit
4e91b521ee
@ -1499,7 +1499,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::BulletText("%s", lines[i]);
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Keyboard, Mouse & Focus"))
|
||||
if (ImGui::CollapsingHeader("Inputs, Navigation & Focus"))
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui::Checkbox("io.NavMovesMouse", &io.NavMovesMouse);
|
||||
@ -1508,6 +1508,38 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor);
|
||||
ImGui::SameLine(); ShowHelpMarker("Request ImGui to render a mouse cursor for you in software. Note that a mouse cursor rendered via regular GPU rendering will feel more laggy than hardware cursor, but will be more in sync with your other visuals.");
|
||||
|
||||
ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||
ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||
ImGui::Text("WantTextInput: %d", io.WantTextInput);
|
||||
ImGui::Text("WantMoveMouse: %d", io.WantMoveMouse);
|
||||
|
||||
if (ImGui::TreeNode("Keyboard, Mouse & Navigation State"))
|
||||
{
|
||||
ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y);
|
||||
ImGui::Text("Mouse down:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (io.MouseDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); }
|
||||
ImGui::Text("Mouse clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
||||
ImGui::Text("Mouse dbl-clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDoubleClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
||||
ImGui::Text("Mouse released:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseReleased(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
||||
ImGui::Text("Mouse wheel: %.1f", io.MouseWheel);
|
||||
|
||||
ImGui::Text("Keys down:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (io.KeysDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("%d (%.02f secs)", i, io.KeysDownDuration[i]); }
|
||||
ImGui::Text("Keys pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i)) { ImGui::SameLine(); ImGui::Text("%d", i); }
|
||||
ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d", i); }
|
||||
ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
||||
|
||||
ImGui::Text("NavUsable: %d, NavActive: %d", io.NavUsable, io.NavActive);
|
||||
|
||||
ImGui::Button("Hovering me sets the\nkeyboard capture flag");
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::CaptureKeyboardFromApp(true);
|
||||
ImGui::SameLine();
|
||||
ImGui::Button("Holding me clears the\nthe keyboard capture flag");
|
||||
if (ImGui::IsItemActive())
|
||||
ImGui::CaptureKeyboardFromApp(false);
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Tabbing"))
|
||||
{
|
||||
ImGui::Text("Use TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
||||
@ -1571,37 +1603,6 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Keyboard & Mouse State"))
|
||||
{
|
||||
ImGui::Text("MousePos: (%g, %g)", io.MousePos.x, io.MousePos.y);
|
||||
ImGui::Text("Mouse down:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (io.MouseDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); }
|
||||
ImGui::Text("Mouse clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
||||
ImGui::Text("Mouse dbl-clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDoubleClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
||||
ImGui::Text("Mouse released:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseReleased(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
||||
ImGui::Text("MouseWheel: %.1f", io.MouseWheel);
|
||||
|
||||
ImGui::Text("Keys down:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (io.KeysDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("%d (%.02f secs)", i, io.KeysDownDuration[i]); }
|
||||
ImGui::Text("Keys pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i)) { ImGui::SameLine(); ImGui::Text("%d", i); }
|
||||
ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d", i); }
|
||||
ImGui::Text("KeyMods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
||||
|
||||
ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||
ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||
ImGui::Text("WantTextInput: %d", io.WantTextInput);
|
||||
ImGui::Text("WantMoveMouse: %d", io.WantMoveMouse);
|
||||
ImGui::Text("NavUsable: %d, NavActive: %d", io.NavUsable, io.NavActive);
|
||||
|
||||
ImGui::Button("Hovering me sets the\nkeyboard capture flag");
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::CaptureKeyboardFromApp(true);
|
||||
ImGui::SameLine();
|
||||
ImGui::Button("Holding me clears the\nthe keyboard capture flag");
|
||||
if (ImGui::IsItemActive())
|
||||
ImGui::CaptureKeyboardFromApp(false);
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Mouse cursors"))
|
||||
{
|
||||
ImGui::Text("Hover to see mouse cursors:");
|
||||
|
Loading…
Reference in New Issue
Block a user