LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: the2bears on February 24, 2007, 23:11:46

Title: Keyboard question...
Post by: the2bears on February 24, 2007, 23:11:46
Hey, I might be missing something but is there a way to find out if *nothing* is pressed?  In my loop, I simply poll the keyboard then check for the keys I'm interested in.  But I'm also interested in knowing when no key at all is pressed.  Other than check all the keys, is there a simple way to do this?

Thanks as always,

Bill
Title: Re: Keyboard question...
Post by: Matzon on February 24, 2007, 23:13:21
just check for events ?
Title: Re: Keyboard question...
Post by: the2bears on February 25, 2007, 01:39:28
Quote from: Matzon on February 24, 2007, 23:13:21
just check for events ?

Thank-you.

Hmmm... yes, but then I'll need to consume the events each time through the game loop, right?  Yes, should work without breaking the isKeyDown(...) code I have.  Confirmed, still works.

So, should one be consuming the keyboard events regardless if they're being used or not?

Bill
Title: Re: Keyboard question...
Post by: Matzon on February 25, 2007, 11:17:06
well, events will be put in the buffer and flipped - so it will just keep overwriting events  - regardless of whether you read them or not.
Title: Re: Keyboard question...
Post by: the2bears on February 25, 2007, 17:39:33
Quote from: Matzon on February 25, 2007, 11:17:06
well, events will be put in the buffer and flipped - so it will just keep overwriting events  - regardless of whether you read them or not.

Thanks, that's what I figured since to this point I've been ignoring them and nothing exploded.  At least in the code ;)

Bill