MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / DemoWindowInputs

Function DemoWindowInputs

Source/3rdParty/imgui/imgui_demo.cpp:7824–8130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7822//-----------------------------------------------------------------------------
7823
7824static void DemoWindowInputs()
7825{
7826 if (ImGui::CollapsingHeader("Inputs & Focus"))
7827 {
7828 ImGuiIO& io = ImGui::GetIO();
7829
7830 // Display inputs submitted to ImGuiIO
7831 ImGui::SetNextItemOpen(true, ImGuiCond_Once);
7832 bool inputs_opened = ImGui::TreeNode("Inputs");
7833 ImGui::SameLine();
7834 HelpMarker(
7835 "This is a simplified view. See more detailed input state:\n"
7836 "- in 'Tools->Metrics/Debugger->Inputs'.\n"
7837 "- in 'Tools->Debug Log->IO'.");
7838 if (inputs_opened)
7839 {
7840 IMGUI_DEMO_MARKER("Inputs & Focus/Inputs");
7841 if (ImGui::IsMousePosValid())
7842 ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y);
7843 else
7844 ImGui::Text("Mouse pos: <INVALID>");
7845 ImGui::Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y);
7846 ImGui::Text("Mouse down:");
7847 for (int i = 0; i < IM_COUNTOF(io.MouseDown); i++) if (ImGui::IsMouseDown(i)) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); }
7848 ImGui::Text("Mouse wheel: %.1f", io.MouseWheel);
7849 ImGui::Text("Mouse clicked count:");
7850 for (int i = 0; i < IM_COUNTOF(io.MouseDown); i++) if (io.MouseClickedCount[i] > 0) { ImGui::SameLine(); ImGui::Text("b%d: %d", i, io.MouseClickedCount[i]); }
7851
7852 // We iterate both legacy native range and named ImGuiKey ranges. This is a little unusual/odd but this allows
7853 // displaying the data for old/new backends.
7854 // User code should never have to go through such hoops!
7855 // You can generally iterate between ImGuiKey_NamedKey_BEGIN and ImGuiKey_NamedKey_END.
7856 struct funcs { static bool IsLegacyNativeDupe(ImGuiKey) { return false; } };
7857 ImGuiKey start_key = ImGuiKey_NamedKey_BEGIN;
7858 ImGui::Text("Keys down:"); for (ImGuiKey key = start_key; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key) || !ImGui::IsKeyDown(key)) continue; ImGui::SameLine(); ImGui::Text((key < ImGuiKey_NamedKey_BEGIN) ? "\"%s\"" : "\"%s\" %d", ImGui::GetKeyName(key), key); }
7859 ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
7860 ImGui::Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine(); ImGui::Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public.
7861
7862 ImGui::TreePop();
7863 }
7864
7865 // Display ImGuiIO output flags
7866 ImGui::SetNextItemOpen(true, ImGuiCond_Once);
7867 bool outputs_opened = ImGui::TreeNode("Outputs");
7868 ImGui::SameLine();
7869 HelpMarker(
7870 "The value of io.WantCaptureMouse and io.WantCaptureKeyboard are normally set by Dear ImGui "
7871 "to instruct your application of how to route inputs. Typically, when a value is true, it means "
7872 "Dear ImGui wants the corresponding inputs and we expect the underlying application to ignore them.\n\n"
7873 "The most typical case is: when hovering a window, Dear ImGui set io.WantCaptureMouse to true, "
7874 "and underlying application should ignore mouse inputs (in practice there are many and more subtle "
7875 "rules leading to how those flags are set).");
7876 if (outputs_opened)
7877 {
7878 IMGUI_DEMO_MARKER("Inputs & Focus/Outputs");
7879 ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse);
7880 ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose);
7881 ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard);

Callers 1

ShowDemoWindowMethod · 0.85

Calls 15

CollapsingHeaderFunction · 0.85
SetNextItemOpenFunction · 0.85
SliderIntFunction · 0.85
ColorButtonFunction · 0.85
ImVec4Class · 0.85
ImVec2Function · 0.85
RadioButtonFunction · 0.85
SeparatorTextFunction · 0.85
SliderFloatFunction · 0.85
ShortcutClass · 0.85
BeginChildFunction · 0.85
SeparatorFunction · 0.85

Tested by

no test coverage detected