aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Minecraft.cpp
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 19:59:48 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 19:59:48 +0800
commit2aee607d6c474ce2a36fa9a37dab291a687f524f (patch)
tree71b50fdad00abcee0b859cf08b26a48484c7c66c /Minecraft.Client/Minecraft.cpp
parente067d710e352052c6b79fe40d4c6aa27bd296056 (diff)
feat: implement game-tick input handling and per-frame edge detection
Diffstat (limited to 'Minecraft.Client/Minecraft.cpp')
-rw-r--r--Minecraft.Client/Minecraft.cpp16
1 files changed, 8 insertions, 8 deletions
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<<MINECRAFT_ACTION_PAUSEMENU;
- if (KMInput.IsKeyPressed('E')) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_INVENTORY;
- if (KMInput.IsKeyPressed('Q')) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_DROP;
- if (KMInput.IsKeyPressed('C')) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_CRAFTING;
- if (KMInput.IsKeyPressed(VK_F5)) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_RENDER_THIRD_PERSON;
+ if (KMInput.ConsumeKeyPress(VK_ESCAPE)) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_PAUSEMENU;
+ if (KMInput.ConsumeKeyPress('E')) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_INVENTORY;
+ if (KMInput.ConsumeKeyPress('Q')) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_DROP;
+ if (KMInput.ConsumeKeyPress('C')) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_CRAFTING;
+ if (KMInput.ConsumeKeyPress(VK_F5)) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_RENDER_THIRD_PERSON;
// In flying mode, Shift held = sneak/descend
if (localplayers[i]->abilities.flying && KMInput.IsKeyDown(VK_SHIFT))
localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_SNEAK_TOGGLE;
@@ -3197,7 +3197,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
// Mouse scroll wheel for hotbar
if (iPad == 0)
{
- int kbWheel = KMInput.GetScrollDelta();
+ int kbWheel = KMInput.ConsumeScrollDelta();
if (kbWheel > 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;