From 3a17b3fea571c0c6df3a6a4af402bcf827d03b65 Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:32:13 +0530 Subject: [PATCH] fix input keys for locked fps metrics --- src/MarbleGame.hx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/MarbleGame.hx b/src/MarbleGame.hx index 83bb1592..3db4d001 100644 --- a/src/MarbleGame.hx +++ b/src/MarbleGame.hx @@ -228,10 +228,21 @@ class MarbleGame { world.update(dt * Debug.timeScale); ProfilerUI.update(h3d.Engine.getCurrent().fps); } else { + var keyPressed = @:privateAccess hxd.Key.keyPressed.copy(); if (dtAccumulator >= 1.0 / Settings.optionsSettings.fpsLimit) { world.update(dtAccumulator); ProfilerUI.update(Math.floor((100.0 / dtAccumulator)) / 100); dtAccumulator = 0.0; + } else { + // Increment the frame counter for each key + for (i in 0...keyPressed.length) { + if (keyPressed[i] > 0) { + keyPressed[i]++; + } else if (keyPressed[i] < 0) { + keyPressed[i]--; + } + } + @:privateAccess hxd.Key.keyPressed = keyPressed; } } #end