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

[pygame] Speed of mouse position capture



Title: Speed of mouse position capture

Dear list,

So in my Pygame app, I am trying to create a system where the user interacts with the game by drawing glyphs on the screen with the mouse - for example, drawing a small circle around an enemy with the mouse might mean 'zap a Sleep spell at them'.

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.

Is there a way to make Pygame sample the position of the mouse more often?

(I suppose one answer would be 'get a faster PC' - it is 5 years old and running Pygame in debug mode from WING probably slows it down even more - but if there was something I could do on the software level, it would be better…)

TIA,
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."