Mouse Button release

BlitzMax Forums/BlitzMax Beginners Area/Mouse Button release

Gavin Beard(Posted 2008) [#1]
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


MGE(Posted 2008) [#2]
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
'



Gavin Beard(Posted 2008) [#3]
Many thanks, i'll try that :-)


Gavin Beard(Posted 2008) [#4]
Many thanks, i'll try that :-)


GfK(Posted 2008) [#5]
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



grable(Posted 2008) [#6]
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



Gavin Beard(Posted 2008) [#7]
ah brill, got a few different ways here, all work well for me, many thanks