Mouse Button release
BlitzMax Forums/BlitzMax Beginners Area/Mouse Button release
| ||
Hi all, is there a way to test for a mouse button to be released? something similar to mousedown(), its just so i dont update variables to much by tracking and updating while mouse button is down, i only want to update when its released? many thanks |
| ||
oops... never mind. I was going to suggest if it's not mouse down, it's released then, but you want to get a response after it's down. I usually set a var when the mouse is down, and then clear the var once the mouse is not down anymore. Signaling it's released. ' if md if mousedown()=0 md=0 ' released endif else if mousedown() md = 1 endif endif ' |
| ||
Many thanks, i'll try that :-) |
| ||
Many thanks, i'll try that :-) |
| ||
Graphics 800,600 While Not KeyDown(key_escape) PollEvent() 'get next event from queue If CurrentEvent.ID = EVENT_MOUSEUP 'a mouse button has been released If EventData() = 1 'it was the left button End EndIf EndIf Wend |
| ||
I do it slightly different, but the end result is the same ;)If MouseDown() Then If Not mb Then mb = True ' mouse down EndIf ' mouse hold ElseIf mb Then mb = False ' mouse release EndIf |
| ||
ah brill, got a few different ways here, all work well for me, many thanks |