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

Re: [pygame] Blocking events problem?



On Mon, 23 Jul 2001, Pete Shinners wrote:

>> Yep, apparently adding a dummy
>> 
>> pygame.event.set_blocked ( MOUSEMOTION ) 
>> 
>> somewhere inside the main loop seems to disable USEREVENT:s
>> from being received by pygame.event.poll (). Is this some known
>> issue or have I done something wrong?
>
>it is neither. you've done nothing incorrect, but this is
>not a known issue. i'll look into this real soon. for now
>i guess just don't block the MOUSEMOTION events?

I don't want them to unnecessarily get dispatched to the gorier parts of
the engine unless necessary. And only popup menus need the motion events
right now. Just trying to save a few cycles.

I tried the test program you sent me, and of course it works as it's
supposed to work. Still my code refuses. :) What's event more weird is
that I use USEREVENT:s for another thing too, and that part works just
great. It's all done the exact same way.

I know the events get posted to the queue, but they never materialize
there for some reason. The events are created like this:

  # create a new event
  event = pygame.event.Event ( USEREVENT, {'object': MenuDone (K_m )} )

  # post the event to the pygame event queue for dispatching
  pygame.event.post ( event )

I can verify that the events end up on the queue using
pygame.event.get(USEREVENT), and they sure are there. But they never seem
to be available in the main event queue, and running the same thing there
shows no events. Yet some USEREVENT events work ok. I'm really lost here.
:) I kind of liked the system built up around the USEREVENT:s, but as
there apparently is something badly wrong somewhere in my code I think
I'll scrap the idea and think of something else instead.

Thanks for the help, Pete.

>> Also, music seems to sometimes not stop when the game
>> terminates. The game just says it got terminated ok, but
>> still plays music. I think I should do an explicit stop()
>> on the music before exiting.

>i just looked at the code for this, and i'm sort of scared
>that the music actually plays after pygame quits. pygame
>deletes the music object and shuts down SDL_mixer when it
>quits, i can't see how music is still playing? nevertheless,
>i just added a Mix_HaltMusic(); call into the mixer shutdown
>code, so if anything that should get it, it certainly can't
>hurt.

If I  stop() it before exiting there's no such problem. And it didn't
really exit all the way to the prompt and still play music, it executed
all *my* Python code down to the last line, but when the Python
interpreter should have exited the music just played on. :)

-----------------------------------------------------------------------------
      Real children don't go hoppity-skip unless they are on drugs.
           -- Susan Sto Helit, in Hogfather (Terry Pratchett)

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org