[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to handle keyboard input
- To: linuxgames@sunsite.auc.dk
- Subject: Re: How to handle keyboard input
- From: Eero Pajarre <epajarre@koti.tpo.fi>
- Date: Mon, 08 May 2000 13:57:41 +0300
- Delivered-To: mailing list linuxgames@sunsite.auc.dk
- Delivery-Date: Mon, 08 May 2000 06:59:46 -0400
- Mailing-List: contact linuxgames-help@sunsite.auc.dk; run by ezmlm
- References: <Pine.LNX.4.21.0004271009500.31606-100000@challenge.dk>
- Reply-To: linuxgames@sunsite.auc.dk
Mads Bondo Dydensborg wrote:
>
> Hey all.
>
> Doing a game with OpenGL, using glutKeyboardFunc to get some
> keypresses. However, this is not good:
>
> a) Having to handle both KeyboardFunc and SpecialFunc, and *Up* funcs is
> tiresome, and I have no garantee that a keydown will eventually
> generate a key up.
> b) I can't handle multiple pressed keys.
I must confess I am using Windows95, but I do use
Glut and OpenGL (So that I can convert to Linux)
a) I have not seen randomly missing Keyups
(There are some problems with certain keys in the keyboard,
but this is certainly Windows specific ;-)
b) It is possible to handle multiple keys with Glut
functions. (Assuming you mean like "press forward key,
while pressing it press turn left for a while,
stop pressing forward, while still pressing turn left")
I handle multiple keys by keeping a state variable for each
interesting key. I update this state in the "down" and "up"
functions. The game logic then reads the "current value"
of the key from this value when it needs it.
Eero
---------------------------------------------------------------------
To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: linuxgames-help@sunsite.auc.dk