[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] event queue full



On Jun 14, 2004, at 3:05 PM, Sami Hangaslammi wrote:
Do you call pygame.event.pump() in your mainloop while the game is paused?
Another thing you can test is to filter out all events you are not
processing in your game by using pygame.event.set_allowed.
Already doing both (thanks to an earlier message I read on this list). Here's an abridged version of my main():

def main():
pygame.init()

game = Game()
clock = pygame.time.Clock()

# filter our event queue
pygame.event.set_allowed([])
pygame.event.set_allowed([KEYDOWN,KEYUP,QUIT])

# Event loop
while 1:
pygame.event.pump()
# Make sure game doesn't run at more than 30 frames per second
clock.tick(30)

for event in pygame.event.get([KEYDOWN,KEYUP,QUIT]):
if event.type == KEYDOWN:
# ...
elif event.type == KEYUP:
# ...
elif event.type == QUIT:
break

game.doGameLoop()


//jack