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

Re: [pygame] drawing a mouse cursor



Michael wrote:
I need to draw my own cursor because the cursor needs to change depending what tool the user has selected. It's drawing the cursor fine but it seems to leap from point to point instead of following instead of gliding to the right place. Is there a way to make the program sample the cursor position more often or anything else I could do to make the cursor movement more smooth? I'm just using the MOUSEMOTION event.. anything better I could do?
pygame does support changing the system cursor. you still are stuck with a 'boring' black and white cursor, but it will be controlled by the system.

you can also pretty easily blit your own cursor image when you draw the screen. it sounds like this is what you are doing. if the cursor motion is jumpy i suspect it is because your framerate is low.

getting the framerate up could be hard if you've already done your optimizing stuff. if your time is spent rendering it will be tough. if there are many computations being done you could break them up into batches. perhaps checking every number of computations for more mouse input. clearing and redrawing just that area should be pretty fast and keep the mouse much smoother.