Cursor trail now considers actual FPS (not target FPS). (fixes #109)

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-07-16 18:14:46 -05:00
parent 4e2074e41b
commit 5dac21a545

View File

@ -125,7 +125,7 @@ public class Cursor {
cursorMiddle = GameImage.CURSOR_MIDDLE.getImage(); cursorMiddle = GameImage.CURSOR_MIDDLE.getImage();
int removeCount = 0; int removeCount = 0;
int FPSmod = (Options.getTargetFPS() / 60); float FPSmod = Math.max(container.getFPS(), 1) / 60f;
Skin skin = Options.getSkin(); Skin skin = Options.getSkin();
// scale cursor // scale cursor
@ -151,13 +151,13 @@ public class Cursor {
lastX = mouseX; lastX = mouseX;
lastY = mouseY; lastY = mouseY;
removeCount = (cursorX.size() / (6 * FPSmod)) + 1; removeCount = (int) (cursorX.size() / (6 * FPSmod)) + 1;
} else { } else {
// old style: sample one point at a time // old style: sample one point at a time
cursorX.add(mouseX); cursorX.add(mouseX);
cursorY.add(mouseY); cursorY.add(mouseY);
int max = 10 * FPSmod; int max = (int) (10 * FPSmod);
if (cursorX.size() > max) if (cursorX.size() > max)
removeCount = cursorX.size() - max; removeCount = cursorX.size() - max;
} }