[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

RE: [pygame] Speed of mouse position capture



 

> -----Original Message-----
> From: owner-pygame-users@xxxxxxxx 
> [mailto:owner-pygame-users@xxxxxxxx] On Behalf Of Luke Paireepinart
> Sent: Monday, 15 May 2006 2:41 p.m.
> To: pygame-users@xxxxxxxx
> Subject: Re: [pygame] Speed of mouse position capture
> 
> Brian Bull wrote:
> >>> I am encountering one difficulty, which is that the speed 
> of mouse 
> >>> position capture seems quite slow. I had expected that the
> >>>       
> >> app would
> >>     
> >>> receive a MOUSEMOTION event every time the mouse shifted to a new 
> >>> pixel, and that connecting up the locations of these MOUSEMOTION 
> >>> events would give an almost exact representation of the 
> path of the 
> >>> mouth across the screen. However, what happens in practice
> >>>       
> >> is that, if
> >>     
> >>> the mouse is moving fast, consecutive MOUSEMOTION events can be 
> >>> separated by more than 20 pixels. This makes it very hard
> >>>       
> >> to interpret
> >>     
> >>> the path of the mouse with enough precision - it ends up
> >>>       
> >> divided into
> >>     
> >>> a small number of long line segments.
> >>>       
> >> What OS? Win9X sampled the mouse less frequently that 
> Win2K and later.
> >> Also serial mouse is slower than ps2, which is slower that usb.
> >>
> >> Alan
> >>     
> >
> > Os is XP so presumably not the problem. I think it might be 
> a serial 
> > mouse though. Will check. I'm sure I've got a usb mouse 
> sitting about 
> > somewhere.
> 
> I wrote a simple "loop through and print out all the 
> mousemotion events" 
> script.
> I even made it to where it only updated a few pixels of the 
> screen rather than the entire thing per iteration.
> I have an optical USB mouse on WinXP and a 1.3ghz AMD 1500+ 
> w/ 512 mb ram and a Geforce FX 5600.
> Granted, my processor's a little on the slow side, but it's 
> decently fast for our purposes, I believe.
> Either way, the result of my test is, as yours was, some 
> coordinates being as far as 40 px apart when I moved the 
> mouse very quickly.
> So I'd say none of the following are the issue
> 1) Your mouse format (ps2/serial/usb),   2) your OS,   3) your 
> CPU/ram/video card.
> I'm guessing, like the guy mentioned earlier, that SDL just 
> doesn't by default update the mousemotion event fast enough.
> Have you considered just doing a pygame.mouse.get_pos() in a 
> separate thread or something of that sort?

[embarrassed] I don't know how to multi thread. Will try using DirectX,
failing that will investigate multi threading (can you point me to a
good reference?)

Brian
"The information contained in this transmission is confidential. It is intended for the named address only. If you are not the named address you may not copy, distribute or take any action in reliance upon this transmission"