MouseState ... Flush

Previous topic - Next topic

gregbug

is there a way to flush MouseState (only mouse button1 and button 2) ?  :blink:

thanks.
Ciao Ciao,
Gianluca. (l'Aquila tornerà a volare alta nel cielo!!!!)

Schranz0r

No, you have to write a function for mousehit
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

gregbug

Ciao Ciao,
Gianluca. (l'Aquila tornerà a volare alta nel cielo!!!!)

FutureCow

Here's my function in case it helps.

Do a "GOSUB MouseUpdate" in your main code. You can then query the mouse location (MX/MY) or Button status (MB1/MB2).
This subroutine ensures you only get one click regardless of how long the user holds the mouse button down for.

Code (glbasic) Select

GLOBAL MX, MY, MB1, MB2, PreviousMouseButton1State, PreviousMouseButton2State

SUB MouseUpdate:
LOCAL MBTemp%, MB2Temp%

MOUSESTATE MX, MY, MBTemp, MB2Temp
IF MBTemp = 1
IF PreviousMouseButton1State = 1
MB1 = 0
ELSE
MB1 = 1
PreviousMouseButton1State = 1
ENDIF
ELSE
MB1 = 0
PreviousMouseButton1State = 0
ENDIF


IF MB2Temp = 1
IF PreviousMouseButton2State = 1
MB2 = 0
ELSE
MB2 = 1
PreviousMouseButton2State = 1
ENDIF
ELSE
MB2 = 0
PreviousMouseButton2State = 0
ENDIF

ENDSUB // MOUSEUPDATE

gregbug

Thanks for your code FutureCow!  =D
Ciao Ciao,
Gianluca. (l'Aquila tornerà a volare alta nel cielo!!!!)