8#include "ViewContext.h"
9#include "Input/InputManager.h"
11#include "InspectorGuiHelper.h"
13void Cogs::Core::inputInspector(Context * context,
bool * show)
16 guiBegin(
"Input", show);
19 for (
auto & d : context->getDefaultView()->inputManager->deviceStates) {
20 std::string header = d.id.empty() ? (
"Device" + std::to_string(autoId)) : d.id;
23 if (!d.isConnected && d.id.empty())
continue;
25 if (ImGui::CollapsingHeader(header.c_str())) {
28 std::bitset<kMaxAxes> axisBits(d.axisMask);
29 std::bitset<kMaxActions> buttonBits(d.buttonMask);
31 ImGui::Text(
"Connected: %s", d.isConnected ?
"Yes" :
"No");
32 ImGui::Text(
"Extended: %s", d.device ?
"Yes" :
"No");
35 if (ImGui::CollapsingHeader(getUniqueHeader(
"Axes").c_str())) {
36 for (
size_t i = 0; i < axisBits.size(); ++i) {
38 if (d.axisNames.size() <= i || d.axisNames[i].empty()) {
39 ImGui::Text(
"Axis %zu: %f", i, d.axes[i]);
41 ImGui::Text(
"%s: %f", d.axisNames[i].c_str(), d.axes[i]);
47 if (ImGui::CollapsingHeader(getUniqueHeader(
"Buttons").c_str())) {
48 for (
size_t i = 0; i < buttonBits.size(); ++i) {
50 if (d.actionNames.size() <= i || d.actionNames[i].empty()) {
51 ImGui::Text(
"Button %zu: %s", i, d.buttons[i] ?
"down" :
"up");
53 ImGui::Text(
"%s: %s", d.actionNames[i].c_str(), d.buttons[i] ?
"down" :
"up");