From 2aee607d6c474ce2a36fa9a37dab291a687f524f Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 19:59:48 +0800 Subject: feat: implement game-tick input handling and per-frame edge detection --- Minecraft.Client/Minecraft.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Minecraft.Client/Minecraft.cpp') diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 7290d521..5e1a2119 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1456,11 +1456,11 @@ void Minecraft::run_middle() // Keyboard/mouse button presses for player 0 if (i == 0) { - if (KMInput.IsKeyPressed(VK_ESCAPE)) localplayers[i]->ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<abilities.flying && KMInput.IsKeyDown(VK_SHIFT)) localplayers[i]->ullButtonsPressed |= 1LL< 0 && gameMode->isInputAllowed(MINECRAFT_ACTION_LEFT_SCROLL)) wheel += 1; else if (kbWheel < 0 && gameMode->isInputAllowed(MINECRAFT_ACTION_RIGHT_SCROLL)) wheel -= 1; @@ -3206,7 +3206,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { for (int k = '1'; k <= '9'; k++) { - if (KMInput.IsKeyPressed(k)) + if (KMInput.ConsumeKeyPress(k)) { player->inventory->selected = k - '1'; app.SetOpacityTimer(iPad); @@ -3248,7 +3248,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) player->lastClickTick[0] = ticks; } #ifdef _WINDOWS64 - else if (iPad == 0 && KMInput.IsCaptured() && KMInput.IsMousePressed(0)) + else if (iPad == 0 && KMInput.IsCaptured() && KMInput.ConsumeMousePress(0)) { player->handleMouseClick(0); player->lastClickTick[0] = ticks; -- cgit v1.2.3