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

Re: [pygame] events + openGL



> pygame.event.pump() # tried this to get it working.. no success tho
>         event_list = pygame.event.get([KEYDOWN,QUIT,MOUSEBUTTONDOWN])
>         for event in event_list:
>             if event.type == QUIT: finished = 1
>             elif event.type == KEYDOWN:
>                 if event.key == K_ESCAPE:
>                     print "finished"
>                     finished = 1
>             elif event.type == MOUSEBUTTONDOWN:
>                 events.mouseClicked(event.pos)

heya frank, sorry i haven't had time to look into your little
sample myself. but here are some things that come to my mind
just looking at your code...

first, there's no need to call event.pump() if you are using
any of the other event queue checking functions. the only time
you need to make the pump() call is when you aren't doing 
anything else with the event queue. in any case, it won't
hurt anything for you to make both calls.

another thing that may (or may not) be a problem is the use
of your "get" with the list of desired event types. the event
queue is always getting MOUSEMOVE and other miscellaneous 
events from SDL. calling event.get() will only get those
types of events off of the queue. the other events are still
sitting on the queue. you mention after awhile you stop getting
the mouseclick events, perhaps the event queue is just getting
"full" and there's no room for more. since you already check
for different events with your "if" and "elif" cases, just switch
the call to "pygame.event.get()" which will just get all the
available events off the queue. not sure if thats really a problem,
but i can assume there is some internal limit to the SDL event
queue size.

maybe this can get things going for you?

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