From 0caf945a44b6f760019ec482b34c59a8d54b0d40 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 18 Mar 2026 11:25:35 -0700 Subject: [PATCH] feat: add NumLock auto-run toggle and HUD indicator NumLock now toggles auto-run alongside the existing tilde key. A cyan [Auto-Run] indicator appears in the player info area when active. --- src/rendering/camera_controller.cpp | 5 +++-- src/ui/game_screen.cpp | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/rendering/camera_controller.cpp b/src/rendering/camera_controller.cpp index d16fa26c..53be1a25 100644 --- a/src/rendering/camera_controller.cpp +++ b/src/rendering/camera_controller.cpp @@ -273,8 +273,9 @@ void CameraController::update(float deltaTime) { keyW = keyS = keyA = keyD = keyQ = keyE = nowJump = false; } - // Tilde toggles auto-run; any forward/backward key cancels it - bool tildeDown = !uiWantsKeyboard && input.isKeyPressed(SDL_SCANCODE_GRAVE); + // Tilde or NumLock toggles auto-run; any forward/backward key cancels it + bool tildeDown = !uiWantsKeyboard && (input.isKeyPressed(SDL_SCANCODE_GRAVE) || + input.isKeyPressed(SDL_SCANCODE_NUMLOCKCLEAR)); if (tildeDown && !tildeWasDown) { autoRunning = !autoRunning; } diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 8edb82ec..4c0fe1d7 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -3304,6 +3304,15 @@ void GameScreen::renderPlayerFrame(game::GameHandler& gameHandler) { ImGui::TextColored(ImVec4(0.9f, 0.5f, 0.2f, 1.0f), ""); if (ImGui::IsItemHovered()) ImGui::SetTooltip("Do not disturb — /dnd to cancel"); } + if (auto* ren = core::Application::getInstance().getRenderer()) { + if (auto* cam = ren->getCameraController()) { + if (cam->isAutoRunning()) { + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.4f, 0.9f, 1.0f, 1.0f), "[Auto-Run]"); + if (ImGui::IsItemHovered()) ImGui::SetTooltip("Auto-running — press ` or NumLock to stop"); + } + } + } if (inCombatConfirmed && !isDead) { float combatPulse = 0.75f + 0.25f * std::sin(static_cast(ImGui::GetTime()) * 4.0f); ImGui::SameLine();