LoginLogin
Might make SBS readonly: thread

MBUTTON

Root / Documentation / [.]

Created:
Read the status of mouse buttons. This function is very similar to BUTTON.

Check Button

Check a specific button if it has been held, pressed, or released.
MBUTTON button% {, mode% } OUT state%
InputDescription
button%ID of the button to check. See the Button IDs table.
mode%Button test mode (optional):
NumberDescription
0Button is held (default)
1invalid
2Button was just pressed
3Button was just released
OutputDescription
state%True if the button is in the checked state, false otherwise.

Button Bitset

Return the state of all buttons as a bitset. Unlike BUTTON and the above, you can only use this to see which buttons are held.
MBUTTON OUT bits%
OutputDescription
bits%A bitset containing which buttons are held. See the Button IDs table.

Button IDs

This table contains the IDs assigned to each mouse button. To determine which bit to test in bitset mode, use 1 << id. Most mice have only the left, middle, and right buttons. If a mouse does have extra buttons, they may not be assigned to buttons 4 and 5 in the USB mouse protocol. Some mice require special driver software to assign extra buttons, which is not compatible with SmileBASIC, and SmileBASIC cannot recognize more than 5 standard mouse buttons. Design programs with this in mind, and make sure to test your mouse.
IDButton
0Left Button
1Right Button
2Middle Button (Wheel Click)
3Button 4
4Button 5

No posts yet (will you be the first?)