0 is the left mouse button 1 is the right mouse button 2 is the middle mouse button 3,4,… are extra mouse buttons
A button is either pressed or not. And it either changed since the last time or not. The old API gives us 4 possibilities:
00 not pressed and was not 01 just pressed (was not in last tick) 10 just released (not pressed but was last tick) 11 being held down
However, this will not work with clicks that happen “between” two ticks:
tick 0 1 2 3 4 mouse D U D U D U
In the above case the 4 ticks will have: 1: 01 (just pressed, correct) 2: 10 (just released) Completely ignores the click in between 3: 00 (nothing) Completely ignores the click 4: 00
There is no good way to solve this with this API. If clicks are detected as 01 (react as soon as pressed) then we should return this: 1: 01 2: 01 (there was a click after all) 3: 01 (same) 4: 10
This would capture all 3 clicks but would see only one if they are detected as 10.
If clicks are detected as 10 (react when the button is released): 1: 01 (so no click yet) 2: 10 (we lose the really fast click, which would still be fine) 3: 10 (there was a click) 4: 00
This would capture 2 of the 3 clicks (which is fine, we can never detect more than one click per tick). But it would only detect one click if detected as 01.
Both of those solutions also make it so the previous tick state could differ from the actual one, possibly messing up drag&drop code and so on if not prepared for it.
One stop-gap measure we do employ is if there is just one fast click with no click before, we create both a fake 01 and fake 10.
tick 0 1 2 3 4 D U
1: 00 2: 01 (fake, but not really) 3: 10 (to go with it) 4: 00
no parameters
Parameters: int x, int y, int z
Parameters: float x, float y, int n, int d
Parameters: int n
Returns: float
Returns: bool
Parameters: int b
Returns: int
Return the mouse X coordinate for the current tick.
Return the mouse Y coordinate for the current tick.
Return the mouse wheel coordinate for the current tick.
deprecated
Parameters: int i
Return the mouse button state for the current tick.
Parameters: int x, int y