multikey keyboard input

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Cartaa
Posts: 9
Joined: Sun Jun 18, 2006 4:23 pm

multikey keyboard input

Post by Cartaa »

Hi,
i've been browsing the forums and I noticed that Irrlicht has a problem with dealing with multiple key presses unless they are simultaneously pressed. Which causes a problem for my game. So I was wondering if anyone knows of a way to fix it or if not what people think the best alternative to use for keyboard input is?

I'm using C++ under Windows if that's any help.

Thanks in advance.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

I think you should search the forum for "bool keys" or something like this
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

There should be no problem detecting when multiple keys are pressed.

When any single key is pressed, you just set a flag indicating that key is down. When a key is released, you clear the flag. If you want to check for key combinations, just check the flags for each key.

Travis
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

In addition, if this isn't a problem with your understanding of Irrlicht, it could be a limitation of your keyboard.
I don't know the exact layout (it probably varies), but only shift/control/alt/win etc have a dedicated wire to themselves, and the others have to share. The result is you can't press more than 3 keys simultanously, and their internal wiring has something to do with it. For example mine supports 'asdf' together, but not 'sdfg', yours may be different.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Cartaa
Posts: 9
Joined: Sun Jun 18, 2006 4:23 pm

Post by Cartaa »

oh ok, my problem is that i am using a boolean key map and when i am holding a key and then press another key it seems to forget that I am already holding a key. I thought from reading other posts that the problem lies in there being a OnEvent thing that only reads the latest keypress but it may be my code. I'll need to study it better when i get home from work but any further input from the community would be much appreciated. Thanks for the replies so far.

<EDIT>If it helps, i'm having the same problem as the guy here but i'm using C++ and can't really understand whats going on in the C# link to code that is provided there.
Post Reply