[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] drawing a mouse cursor
Thanks, I asked on the channel and as directed there I rewrote most of
my code to use sprites for the UI elements rather than just blitting
images myself. A pain really but it'll allow me to animate those
elements later which I was going to do anyway. The switch to sprites and
some other cleanup I did while working at it seems to have done the
trick. The cursor movement is reasonably smooth now and the program runs
faster in general. All around an improvement.
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.