[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Odd fill/mouse behaviour



Magnus Lie Hetland wrote:
> 
> In a program I'm playing with, I tried to fill the screen with white,
> and then hiding the mouse. This resulted in a little black square in
> the middle of the screen. I tried not hiding the mouse, and then
> everything was fine (white) until I moved the mouse, and a black
> square appeared where it had been (in the center). After moving the
> mouse-hiding *before* creating/filling the display, things work just
> fine. But this does strike me as a bit odd... Perhaps I've missed
> something in the documentation?

This is standard mouse behaviour.  The mouse works like any other
sprite; it's erased and redrawn whenever it's moved.  Whenever it needs
to be erased, the mouse driver repaints whatever it last knew to be
behind the mouse.  If you change what's supposed to be behind the mouse
then of course it won't match what the mouse driver knows to be there,
so when the mouse is moved the screen gets messed up.

As a result, you should hide the mouse before drawing.  The proper
procedure is usually "hide, draw, show", so for obvious reasons you
should try to do all of your drawing at once.

BTW this is easy enough to confirm:  Hide the mouse, fill the screen
with pink or something, then show the mouse, then fill it with white. 
When you move it you should get a pink box.

-- 
======================================================================
Paul Sidorsky                                          Calgary, Canada
paulsid@shaw.ca                        http://members.shaw.ca/paulsid/
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org