Attempt to fix Flan's not reading input events (3/?)

This commit is contained in:
artdeell 2021-01-01 11:32:02 +03:00
parent 2831311d08
commit dffcb9e9f8

View File

@ -140,50 +140,42 @@ public class Mouse {
} }
public static boolean next() { public static boolean next() {
return queue.next(); //return queue.next();
} return true;
private static void moveAutomatically() {
if(queue.getCurrentPos() == -1) {
next();
}
} }
public static int getEventX() { public static int getEventX() {
moveAutomatically(); return getX();
return xEvents[queue.getCurrentPos()];
} }
public static int getEventY() { public static int getEventY() {
moveAutomatically(); return getY();
return yEvents[queue.getCurrentPos()];
} }
public static int getEventDX() { public static int getEventDX() {
moveAutomatically(); return getDX();
return xEvents[queue.getCurrentPos()] - lastxEvents[queue.getCurrentPos()];
} }
public static int getEventDY() { public static int getEventDY() {
moveAutomatically(); return getDY();
return yEvents[queue.getCurrentPos()] - lastyEvents[queue.getCurrentPos()];
} }
public static long getEventNanoseconds() { public static long getEventNanoseconds() {
moveAutomatically(); return Sys.getNanoTime();
return nanoTimeEvents[queue.getCurrentPos()];
} }
public static int getEventButton() { public static int getEventButton() {
moveAutomatically(); next();
return buttonEvents[queue.getCurrentPos()]; return buttonEvents[queue.getCurrentPos()];
} }
public static boolean getEventButtonState() { public static boolean getEventButtonState() {
moveAutomatically(); next();
return buttonEventStates[queue.getCurrentPos()]; return buttonEventStates[queue.getCurrentPos()];
} }
public static int getEventDWheel() { public static int getEventDWheel() {
moveAutomatically(); next();
return wheelEvents[queue.getCurrentPos()]; return wheelEvents[queue.getCurrentPos()];
} }