diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-04 21:19:40 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-05 01:12:48 +0800 |
| commit | 1dc8a005ed111463c22c17b487e5ec8a3e2d30f3 (patch) | |
| tree | 8f1825364bf14178f720ee124b01de78afa16d40 /Minecraft.Client/Screen.cpp | |
| parent | ac03b88a907bb49f5159f08de07398f3fce32991 (diff) | |
refactor: refactor KBM input code
Diffstat (limited to 'Minecraft.Client/Screen.cpp')
| -rw-r--r-- | Minecraft.Client/Screen.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Minecraft.Client/Screen.cpp b/Minecraft.Client/Screen.cpp index 6a402b04..e69b7373 100644 --- a/Minecraft.Client/Screen.cpp +++ b/Minecraft.Client/Screen.cpp @@ -110,13 +110,13 @@ void Screen::updateEvents() // Poll mouse button state and dispatch click/release events for (int btn = 0; btn < 3; btn++) { - if (KMInput.ConsumeMousePress(btn)) + if (g_KBMInput.IsMouseButtonPressed(btn)) { int xm = Mouse::getX() * width / minecraft->width; int ym = height - Mouse::getY() * height / minecraft->height - 1; mouseClicked(xm, ym, btn); } - if (KMInput.ConsumeMouseRelease(btn)) + if (g_KBMInput.IsMouseButtonReleased(btn)) { int xm = Mouse::getX() * width / minecraft->width; int ym = height - Mouse::getY() * height / minecraft->height - 1; @@ -127,7 +127,7 @@ void Screen::updateEvents() // Poll keyboard events for (int vk = 0; vk < 256; vk++) { - if (KMInput.ConsumeKeyPress(vk)) + if (g_KBMInput.IsKeyPressed(vk)) { // Map Windows virtual key to the Keyboard constants used by Screen::keyPressed int mappedKey = -1; @@ -144,7 +144,7 @@ void Screen::updateEvents() else if (vk >= 'A' && vk <= 'Z') { ch = (wchar_t)(vk - 'A' + L'a'); - if (KMInput.IsKeyDown(VK_SHIFT)) ch = (wchar_t)vk; + if (g_KBMInput.IsKeyDown(VK_LSHIFT) || g_KBMInput.IsKeyDown(VK_RSHIFT)) ch = (wchar_t)vk; } else if (vk >= '0' && vk <= '9') ch = (wchar_t)vk; else if (vk == VK_SPACE) ch = L' '; |
