MCPcopy Create free account
hub / github.com/AmelieHeinrich/Termina / ShowDebugWindow

Method ShowDebugWindow

Sources/Termina/Input/InputSystem.cpp:471–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469 }
470
471 void InputSystem::ShowDebugWindow(bool* open)
472 {
473 if (!ImGui::Begin("Input System", open))
474 {
475 ImGui::End();
476 return;
477 }
478
479 if (ImGui::CollapsingHeader("Keyboard", ImGuiTreeNodeFlags_DefaultOpen))
480 {
481 ImGui::Indent();
482 bool anyHeld = false;
483 for (int32 k = 0; k < MaxKeys; k++)
484 {
485 if (!s_Instance->m_KeyCurrent[k]) continue;
486 const char* name = GetKeyName(k);
487 if (!name) continue;
488 anyHeld = true;
489 ImGui::Text("%s", name);
490 ImGui::SameLine();
491 }
492 if (!anyHeld)
493 ImGui::TextDisabled("none");
494 else
495 ImGui::NewLine();
496 ImGui::Unindent();
497 }
498
499 if (ImGui::CollapsingHeader("Mouse", ImGuiTreeNodeFlags_DefaultOpen))
500 {
501 ImGui::Indent();
502 ImGui::Text("Position: %.1f, %.1f", s_Instance->m_MouseX, s_Instance->m_MouseY);
503 ImGui::Text("Delta: %.2f, %.2f", s_Instance->m_MouseDeltaX, s_Instance->m_MouseDeltaY);
504 ImGui::Text("Scroll: %.2f, %.2f", s_Instance->m_ScrollX, s_Instance->m_ScrollY);
505 ImGui::Spacing();
506 for (int32 b = 0; b < MaxMouseButtons; b++)
507 {
508 if (!s_Instance->m_MouseButtonCurrent[b]) continue;
509 ImGui::Text("%s", GetMouseButtonName(b));
510 ImGui::SameLine();
511 }
512 ImGui::NewLine();
513 ImGui::Unindent();
514 }
515
516 if (ImGui::CollapsingHeader("Gamepads", ImGuiTreeNodeFlags_DefaultOpen))
517 {
518 ImGui::Indent();
519 bool anyConnected = false;
520 for (int32 i = 0; i < MaxGamepads; i++)
521 {
522 if (!glfwJoystickIsGamepad(GLFW_JOYSTICK_1 + i)) continue;
523 anyConnected = true;
524
525 const char* name = glfwGetGamepadName(GLFW_JOYSTICK_1 + i);
526 ImGui::Text("Gamepad %d: %s", i, name ? name : "Unknown");
527 ImGui::Indent();
528

Callers

nothing calls this directly

Calls 9

GetKeyNameFunction · 0.85
GetMouseButtonNameFunction · 0.85
glfwJoystickIsGamepadFunction · 0.85
glfwGetGamepadNameFunction · 0.85
GetGamepadButtonNameFunction · 0.85
ImVec2Function · 0.85
GetGamepadAxisNameFunction · 0.85
c_strMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected