From 5385342272109c08d6ae3f3b1b2442f7afad387c Mon Sep 17 00:00:00 2001 From: InviseDivine Date: Fri, 13 Mar 2026 23:23:25 +0200 Subject: [PATCH] sprint on ctrl --- src/client/Minecraft.cpp | 5 +++++ src/client/player/LocalPlayer.h | 2 ++ src/main_glfw.h | 1 + src/platform/input/Keyboard.h | 2 ++ 4 files changed, 10 insertions(+) diff --git a/src/client/Minecraft.cpp b/src/client/Minecraft.cpp index 12543b6..f59c157 100755 --- a/src/client/Minecraft.cpp +++ b/src/client/Minecraft.cpp @@ -1,5 +1,6 @@ #include "Minecraft.h" #include "client/player/input/IBuildInput.h" +#include "platform/input/Keyboard.h" #include "world/item/Item.h" #include "world/item/ItemInstance.h" #include @@ -727,6 +728,10 @@ void Minecraft::tickInput() { } #endif #if defined(PLATFORM_DESKTOP) + if (key == Keyboard::KEY_LEFT_CTRL) { + player->setSprinting(true); + } + if (key == Keyboard::KEY_E) { screenChooser.setScreen(SCREEN_BLOCKSELECTION); } diff --git a/src/client/player/LocalPlayer.h b/src/client/player/LocalPlayer.h index fc9de84..03d52d9 100755 --- a/src/client/player/LocalPlayer.h +++ b/src/client/player/LocalPlayer.h @@ -105,6 +105,8 @@ private: bool sprinting; int sprintDoubleTapTimer; bool prevForwardHeld; +public: + void setSprinting(bool sprint) { sprinting = sprint; } }; #endif /*NET_MINECRAFT_CLIENT_PLAYER__LocalPlayer_H__*/ diff --git a/src/main_glfw.h b/src/main_glfw.h index 9aa46a5..aaeadd5 100755 --- a/src/main_glfw.h +++ b/src/main_glfw.h @@ -27,6 +27,7 @@ int transformKey(int glfwkey) { case GLFW_KEY_BACKSPACE: return Keyboard::KEY_BACKSPACE; case GLFW_KEY_LEFT_SHIFT: return Keyboard::KEY_LSHIFT; case GLFW_KEY_ENTER: return Keyboard::KEY_RETURN; + case GLFW_KEY_LEFT_CONTROL: return Keyboard::KEY_LEFT_CTRL; default: return glfwkey; } } diff --git a/src/platform/input/Keyboard.h b/src/platform/input/Keyboard.h index aaf7a89..22249e9 100755 --- a/src/platform/input/Keyboard.h +++ b/src/platform/input/Keyboard.h @@ -71,9 +71,11 @@ public: static const int KEY_F11 = 122; static const int KEY_F12 = 123; + static const int KEY_ESCAPE = 27; static const int KEY_SPACE = 32; static const int KEY_LSHIFT = 10; + static const int KEY_LEFT_CTRL = 232; static bool isKeyDown(int keyCode) { return _states[keyCode] == KeyboardAction::KEYDOWN;