[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] broken links, event handling vs "getting directly" and screen refresh
Dan Stromberg wrote:
> 1) All the "Tutorial/Introduction" links on the documentation page
> (http://pygame.org/docs/index.html) are broken.
yeah, whoops. this has been fixed.
> 2) In http://pygame.org/docs/tut/newbieguide.html, it says that using
> the event system isn't always the best way to go. In my case, it's ok
> if I miss a mouse click once in a while, but I don't want latency
> creeping in, so I initially decided to avoid the event system. However,
> I'm noticing that if I obscure my game window with another briefly, I
> don't get window refresh until I redraw the whole window. Would this
> problem be easier to solve if I were using the event system? That is,
> is there a "time to redraw the whole screen now" event?
it sounds like you've got the right idea for your situation. in games
that don't use the event system, there is still one function you will
need from the event module.
pygame.event.pump()
http://www.pygame.org/docs/ref/pygame_event.html#pump
this function doesn't return anything, but it does allow pygame a chance
to talk with the window manager and environment. it does things like
make sure input devices (like joysticks) are up to date, but doesn't
generate any events for them.
and here's the good news for you...
one important thing that happens in this call, pygame finds out if the
window needs to be repainted in any areas. if so, it automatically
remembers what should be drawn there and does the repainting for you.
usually you just call the pygame.event.pump() function once per frame,
this should take care of business for you. on some platforms it is more
important to call the pump(), since it handles a bit more coordination
with the system (besides just redraws).
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org