| 815 | } |
| 816 | |
| 817 | void ImGuiDebugOverlay::guiInputState() |
| 818 | { |
| 819 | if (ImGui::CollapsingHeader("Input State")) { |
| 820 | const IInputManager& input = theApplication().GetInputManager(); |
| 821 | |
| 822 | /*if (ImGui::TreeNode("Keyboard")) { |
| 823 | nctl::String pressedKeys; |
| 824 | const KeyboardState& keyState = input.keyboardState(); |
| 825 | for (std::uint32_t i = 0; i < static_cast<int>(Keys::COUNT); i++) { |
| 826 | if (keyState.isKeyDown(static_cast<Keys>(i))) |
| 827 | pressedKeys.formatAppend("%d ", i); |
| 828 | } |
| 829 | ImGui::Text("Keys pressed: %s", pressedKeys.data()); |
| 830 | ImGui::TreePop(); |
| 831 | }*/ |
| 832 | |
| 833 | if (ImGui::TreeNode("Mouse")) { |
| 834 | ImGui::Text("Cursor Mode: %s", mouseCursorModeToString(input.cursor())); |
| 835 | |
| 836 | const MouseState& mouseState = input.mouseState(); |
| 837 | ImGui::Text("Position: %d, %d", mouseState.x, mouseState.y); |
| 838 | |
| 839 | /*nctl::String pressedMouseButtons(32); |
| 840 | if (mouseState.isLeftButtonDown()) |
| 841 | pressedMouseButtons.append("left "); |
| 842 | if (mouseState.isRightButtonDown()) |
| 843 | pressedMouseButtons.append("right "); |
| 844 | if (mouseState.isMiddleButtonDown()) |
| 845 | pressedMouseButtons.append("middle "); |
| 846 | if (mouseState.isFourthButtonDown()) |
| 847 | pressedMouseButtons.append("fourth "); |
| 848 | if (mouseState.isFifthButtonDown()) |
| 849 | pressedMouseButtons.append("fifth"); |
| 850 | ImGui::Text("Pressed buttons: %s", pressedMouseButtons.data());*/ |
| 851 | ImGui::TreePop(); |
| 852 | } |
| 853 | |
| 854 | std::uint32_t numConnectedJoysticks = 0; |
| 855 | for (std::int32_t joyId = 0; joyId < IInputManager::MaxNumJoysticks; joyId++) { |
| 856 | if (input.isJoyPresent(joyId)) |
| 857 | numConnectedJoysticks++; |
| 858 | } |
| 859 | if (numConnectedJoysticks > 0) { |
| 860 | char widgetName[32]; |
| 861 | std::size_t length = formatInto(widgetName, "{} Joystick(s)", numConnectedJoysticks); |
| 862 | widgetName[length] = '\0'; |
| 863 | if (ImGui::TreeNode(widgetName)) { |
| 864 | ImGui::Text("Joystick mappings: %u", input.numJoyMappings()); |
| 865 | |
| 866 | for (std::int32_t joyId = 0; joyId < IInputManager::MaxNumJoysticks; joyId++) { |
| 867 | if (input.isJoyPresent(joyId) == false) |
| 868 | continue; |
| 869 | |
| 870 | length = formatInto(widgetName, "Joystick {}", joyId); |
| 871 | widgetName[length] = '\0'; |
| 872 | if (ImGui::TreeNode(widgetName)) { |
| 873 | ImGui::Text("Name: %s", input.joyName(joyId)); |
| 874 | ImGui::Text("GUID: %s", input.joyGuid(joyId)); |
nothing calls this directly
no test coverage detected