Look for both left and right mouse click -Information provided by Jo Even Skarstein
To look for any mouse button when using EVNT_MULTI or EVNT_BUTTON you do like this:
- Set EV_MBCLICKS to 258
- Set EV_MBMASK to 3 (Look for bit 1 & bit 2)
This is how it works:
Bit 8 (equals 256) enables wait for both/either button
Thus you add 256 to the number of expected mouse clicks (Usually this is set to 2)
256+2 = 258
EVNT_BUTTON
Syntax: EVNT_BUTTON(ev_mbclicks,ev_mbmask,ev_mbstate[,mx,my,button,k_state])
Action: Waits for one or more mouse clicks, and returns the number of clicks.
INPUTS
ev_mbclicks - Maximum allowable clicks.
ev_mbmask - Mask for the desired mouse key:
Bit 0 = 1 : Left Button
Bit 1 = 1 : Right Button
ev_mbstate - Desired status, in order to terminate the event.
Bit allocation as for mask.
RETURNED VALUES:
mx - x coordinate of mouse pointer on event termination
my - y coordinate of mouse pointer on event termination
button - state of mouse button, bit allocation as for mask.
k_state- Condition of keyboard shift keys:
Bit 0 = Right shift key
Bit 1 = Left shift key
Bit 2 = Control key
Bit 3 = Alternate key
Back to GFA-page