MouseHit() does not work sometimes

BlitzMax Forums/BlitzMax Programming/MouseHit() does not work sometimes

One Eyed Jack - how are you synching to the vblank? Maybe the mouse is only polled once a vblank - if you are going two or three flips before a vblank occurs maybe the mouse can miss a call?

for example the mouse code in the BMax docs is as follows:


' mousehit.bmx

Graphics 640,480

While Not KeyHit(KEY_ESCAPE)
	Cls
	If MouseHit(1) DrawRect 0,0,200,200
	If MouseHit(2) DrawRect 200,0,200,200
	If MouseHit(3) DrawRect 400,0,200,200
	Flip 
Wend




if you put a 1 or a 0 after the flip, the mousehit doesnot seem to register all the time and so only occasionally draws the rectangle. Using a -1 seems to get a result though.

Just a thought.

IPete2.