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

Re: [pygame] Problem with event-handling



Hi,

On 10/25/06, Farai Aschwanden <fash@xxxxxxxxxx> wrote:
Hello Kai

If you only want to check keyboard inputs you dont need to use pump
and pull. Those are, as far as I understand the description, getting
ANY running event from the event queue. So for checkin any key input
you directly can use:  "if event.type == KEYDOWN". If then any key
was pressed you can check for the ones you are interested in. The
following link of Pygame doc shows a list of all available keys you
can  check for.

I know this, but I simply didn't want to use it that way. The problem was that I pulled for ESC on the of the loop and later I pulled for SPACE. Logically, the queue is always empty, when I check whether SPACE is pressed.

I would be great if I had a key-system that works like, e.g.:
input.is_pressed(KEY, FUNCTION)

and internally it uses a list and calls the given function
every time the key is pressed. The internal things should be
hidden from the programmer. But I'm not that pro and have
no clue (yet) about this callback-function-thing.

Thanks :)
Kai