mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix input keys for locked fps metrics
This commit is contained in:
parent
3cfb0785fe
commit
3a17b3fea5
1 changed files with 11 additions and 0 deletions
|
|
@ -228,10 +228,21 @@ class MarbleGame {
|
||||||
world.update(dt * Debug.timeScale);
|
world.update(dt * Debug.timeScale);
|
||||||
ProfilerUI.update(h3d.Engine.getCurrent().fps);
|
ProfilerUI.update(h3d.Engine.getCurrent().fps);
|
||||||
} else {
|
} else {
|
||||||
|
var keyPressed = @:privateAccess hxd.Key.keyPressed.copy();
|
||||||
if (dtAccumulator >= 1.0 / Settings.optionsSettings.fpsLimit) {
|
if (dtAccumulator >= 1.0 / Settings.optionsSettings.fpsLimit) {
|
||||||
world.update(dtAccumulator);
|
world.update(dtAccumulator);
|
||||||
ProfilerUI.update(Math.floor((100.0 / dtAccumulator)) / 100);
|
ProfilerUI.update(Math.floor((100.0 / dtAccumulator)) / 100);
|
||||||
dtAccumulator = 0.0;
|
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
|
#end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue