Why does it seem everyone always makes mouse input so complicated?
PRINT “You clicked the button!”
MBWU
= NOT MBIND ‘Mouse Button Was Up
Mouse input, by itself, is a very simple thing. Basically, all the commands tell us is: Where’s the cursor and which buttons are up and down.
It’s up to the programmer to setermine
what their program actually needs to function properly.
In a game, you might just want to know if the button is up or down to shoot at enemies.
You might need a “click event” for a button — so you need to decide exactly
what qualifies as a click event in your program. My example above may not suit your needs, if you need a click to be counted as an “UP-DOWN-UP” event. All my little demo above worries about is “was it up, and is it now down?; it doesn’t track “is it now up again?”
Decide what you need for your mouse events and then code for them.
Click — Up, Down.
Double Click — Click + Click within X miliseconds.
Down and Hold — Down for X+ miliseconds
Hover — Up for X seconds without mouse x/y changing
And so on...