I'm trying to put a shooter training game together that uses a weapon-mounted laser pointer. I need to register mouse coordinates when a shot is fired. In addition, I'd like to keep tracking the laser pointer while it is still visible after the shot is taken, which is about 0.1sec.

I'm using CCV multi-touch interface that sends TUIO messages to a mouse driver. I can see the mouse pointer jump to where the laser dot appears on screen. But the mouse driver is not designed for tracking laser dots, it expects gestures, i.e. tapping the screen for a left mouse click, using two fingers for a right click etc. All I have is a dot that appears for 0.1sec.

To cut to the chase, I need an efficient way of tracking mouse movements, ideally, multiple times per frame. When a shot is fired, the mouse pointer jumps to the new location. I compare its coordinates to the last known location and activate group "Shot Fired" if I see those coordinates move by two or more points in any direction. I need to write a fast routine for the "Shot Fired" group, to draw a dot where the mouse is at the moment, thus showing the trail of the laser dot on screen. When the laser dot is no longer visible, the mouse stops moving so I know to record its last known position, deactivate the "Shot Fired" group, and go on waiting for another shot.

Would fastloops be the right way to implement this? Currently, my "Shot Fired" group just draws a bullet hole, plays a gunshot sound, and de-activates itself. But, the triggering of that group event is unreliable: I may have to fire the shot several times before it activates, so I need to optimize that as well. Is there a way to do a fastloop forever, until a mouse movement occurs? Because up until that point, the program just idly waits for a shot to be fired.

Sorry for not being able to explain better, I hope this makes sense....