why does it work for
_MOUSEY
_MOUSEX
_MOUSEBUTTON(1)
We’re reading from a buffer a few nanoseconds long.
We read the buffer with the mouse in the top left corner: X = 0, Y = 0, Wheel = 0
3 nanoseconds later, we read the buffer again:
BUFFER START
0.5 Nanoseconds: Mouse X = 1
1.0 Nanoseconds: Y = 1
1.5 Nanoseconds: X = 2, Y = 2
2.0 Nanoseconds: Wheel = +1 (scrolled up)
2.5 Nanoseconds: Wheel = 0 (back to normal, after it “clicked”)
3.0 Nanoseconds: X = 3
BUFFER STOP
X = 3, Y = 2, Wheel = 0
Who cares what x and y was while in that buffer? We’re only going to use the value of where it’s at currently in our program.
But that wheel? At the moment we check it, what’s its current state? It’s not at that perfect moment of “click”, so it’s back to normal.
You want to know where x/y is after you clear the buffer, but you want to know if the wheel changed at all during the buffer.