Skip to content
This repository was archived by the owner on Feb 19, 2019. It is now read-only.

Commit 7a39f2c

Browse files
committed
It's hard to track pressed without keeping the old state...
1 parent 4cc4242 commit 7a39f2c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/clientapi/util/io/MouseKeyTracker.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ public final boolean wasButtonPressed(int button, boolean newState) {
2626
mouseKeyStates = expandedArray;
2727
}
2828

29-
// Return true if the mouse is pressed in the new state and wasn't in the old state
30-
return newState && !mouseKeyStates[button];
29+
// true if the mouse is pressed in the new state and wasn't in the old state
30+
boolean wasPressed = newState && !mouseKeyStates[button];
31+
32+
// Set the new state
33+
mouseKeyStates[button] = newState;
34+
35+
return wasPressed;
3136
}
3237
}

0 commit comments

Comments
 (0)