Minor follow-up to #127.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
3a9f6be5ae
commit
0b33fed2d4
|
@ -142,9 +142,9 @@ public class BeatmapParser {
|
||||||
|
|
||||||
// check if beatmap is cached
|
// check if beatmap is cached
|
||||||
String path = String.format("%s/%s", dir.getName(), file.getName());
|
String path = String.format("%s/%s", dir.getName(), file.getName());
|
||||||
if (map != null && map.containsKey(path)) {
|
Long lastModified = map.get(path);
|
||||||
|
if (map != null && lastModified != null) {
|
||||||
// check last modified times
|
// check last modified times
|
||||||
long lastModified = map.get(path);
|
|
||||||
if (lastModified == file.lastModified()) {
|
if (lastModified == file.lastModified()) {
|
||||||
// add to cached beatmap list
|
// add to cached beatmap list
|
||||||
Beatmap beatmap = new Beatmap(file);
|
Beatmap beatmap = new Beatmap(file);
|
||||||
|
|
|
@ -51,14 +51,16 @@ public class Cursor {
|
||||||
/** Cursor rotation angle. */
|
/** Cursor rotation angle. */
|
||||||
private float cursorAngle = 0f;
|
private float cursorAngle = 0f;
|
||||||
|
|
||||||
/** The milliseconds when the cursor was last pressed, used for scale animation */
|
/** The time in milliseconds when the cursor was last pressed, used for the scaling animation. */
|
||||||
private long lastCursorPressTime = 0L;
|
private long lastCursorPressTime = 0L;
|
||||||
/** Whether or not the cursor was pressed in the last frame, used for scale animation */
|
|
||||||
|
/** Whether or not the cursor was pressed in the last frame, used for the scaling animation. */
|
||||||
private boolean lastCursorPressState = false;
|
private boolean lastCursorPressState = false;
|
||||||
|
|
||||||
/** The amount the cursor scale increases, if enabled, when pressed */
|
/** The amount the cursor scale increases, if enabled, when pressed. */
|
||||||
private static final float CURSOR_SCALE_CHANGE = 0.25f;
|
private static final float CURSOR_SCALE_CHANGE = 0.25f;
|
||||||
/** The time it takes for the cursor to scale in milliseconds */
|
|
||||||
|
/** The time it takes for the cursor to scale, in milliseconds. */
|
||||||
private static final float CURSOR_SCALE_TIME = 125;
|
private static final float CURSOR_SCALE_TIME = 125;
|
||||||
|
|
||||||
/** Stores all previous cursor locations to display a trail. */
|
/** Stores all previous cursor locations to display a trail. */
|
||||||
|
@ -137,20 +139,18 @@ public class Cursor {
|
||||||
cursorMiddle = GameImage.CURSOR_MIDDLE.getImage();
|
cursorMiddle = GameImage.CURSOR_MIDDLE.getImage();
|
||||||
|
|
||||||
// scale cursor
|
// scale cursor
|
||||||
float cursorSizeAnimated = 1f;
|
float cursorScaleAnimated = 1f;
|
||||||
|
|
||||||
if (skin.isCursorExpanded()) {
|
if (skin.isCursorExpanded()) {
|
||||||
if (lastCursorPressState != mousePressed) {
|
if (lastCursorPressState != mousePressed) {
|
||||||
lastCursorPressState = mousePressed;
|
lastCursorPressState = mousePressed;
|
||||||
lastCursorPressTime = System.currentTimeMillis();
|
lastCursorPressTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
cursorSizeAnimated = (mousePressed ? 1f : 1.25f) +
|
float cursorScaleChange = CURSOR_SCALE_CHANGE * AnimationEquation.IN_OUT_CUBIC.calc(
|
||||||
((mousePressed ? CURSOR_SCALE_CHANGE : -CURSOR_SCALE_CHANGE) * AnimationEquation.IN_OUT_CUBIC.calc(
|
Utils.clamp(System.currentTimeMillis() - lastCursorPressTime, 0, CURSOR_SCALE_TIME) / CURSOR_SCALE_TIME);
|
||||||
Utils.clamp(System.currentTimeMillis() - lastCursorPressTime, 0, CURSOR_SCALE_TIME) / CURSOR_SCALE_TIME));
|
cursorScaleAnimated = 1f + ((mousePressed) ? cursorScaleChange : CURSOR_SCALE_CHANGE - cursorScaleChange);
|
||||||
}
|
}
|
||||||
|
float cursorScale = cursorScaleAnimated * Options.getCursorScale();
|
||||||
float cursorScale = Options.getCursorScale() * cursorSizeAnimated;
|
|
||||||
if (cursorScale != 1f) {
|
if (cursorScale != 1f) {
|
||||||
cursor = cursor.getScaledCopy(cursorScale);
|
cursor = cursor.getScaledCopy(cursorScale);
|
||||||
cursorTrail = cursorTrail.getScaledCopy(cursorScale);
|
cursorTrail = cursorTrail.getScaledCopy(cursorScale);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user