Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clearing mouse input
#1
From my reading of the Wiki, this line should clear mouse input:
While _MouseInput <> 0: Wend
Not sure if it does or not; the programme continues as expected after it, but there's a delay of about 2 seconds before this happens.
Can this delay be removed (or reduced)? Or am I misunderstanding  the wiki?
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply
#2
That's not of because of clearing the mouse input, I rather suspect a misplacement of the clearing line, but would need to see your code to confirm.

Make sure the line clearing the mouse input is placed INSIDE your input loop right before you start examining the mouse events.

If you place the line OUTSIDE of your input loop it has no effect, and your input loop would then process the entire mouse input queue, what could explain the delay in your program.

Also there is a good article about using the mouse interface in the old forum https://qb64forum.alephc.xyz/index.php?topic=2377.0
Reply
#3
What @RhoSigma said - you basically want to put the mouse clearing code inside your main loop right before you read the mouse input, like this:
Code: (Select All)
DO 'main program loop
    DO WHILE _MOUSEINPUT: LOOP
    'Access mouse data
    PRINT _MOUSEX; _MOUSEY
    'Do other stuff
    _LIMIT 30
LOOP
Reply
#4
Are you trying to clear mousebutton after responding to a click in code so the same code doesn't execute several times while you hold mouse button down?

That is a tricky problem discussed several times.
b = b + ...
Reply
#5
@ bplus no, not exactly; I want to repeat a sequence of commands, then go back and repeat it.
@RhoSigma and madscijr That was the problem. I didn't have the clearance code in the right position. OK now.

Thanks all.  Great support!
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply




Users browsing this thread: 1 Guest(s)