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
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

keyboard input

Post by belfegor »

.......
OnEvent function:
if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key == irr::KEY_LSHIFT &&
event.KeyInput.PressedDown == false)
{
std::cout << "KEY_LSHIFT pressed" << std::endl;
return true;
}

if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key == irr::KEY_RSHIFT &&
event.KeyInput.PressedDown == false)
{
std::cout << "KEY_RSHIFT pressed" << std::endl;
return true;
}
.........

there is no output in console(same for KEY_LCONTROL & KEY_RCONTROL).
KEY_SHIFT & KEY_CONTROL work but if you press either of them(left or right shift/control).
What i am doing wrong?How do you use these separated?
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
FriendlyWarlord
Posts: 58
Joined: Thu Apr 06, 2006 11:54 pm

Post by FriendlyWarlord »

Sorry, I don't have a solution... but I had the same "problem", so I believe you are not doing anything wrong. Maybe it depends on what kind of keyboard you have? I'd like clarification on this too...

What I'm more concerned about is some buttons that are missing: ~ [ ] \ ; ' and /
Although, I haven't yet taken the time to actually look into why those are missing, and how to go about adding them in. Sorry, I'm kinda useless here =/
=D
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

Post by belfegor »

Yes i also noticed about those keys on my keyboard to.
Is there someone that it works?
Devs?Please!!!
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Input in Irrlicht is (IMO) only suitable for demo purposes at the moment. Remember: Irrlicht is a 3d engine, not a game engine. If you're not minded to investigate and fix it yourself, then I'd suggest switching to something like SDL instead.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

Post by belfegor »

Why are you get upset?.Why it can be used for game?
Yes i was looked into the source to find something that i could fix about
my problem and i didnt find nothing logical that i could fix, so i am
posting in beginners forum (that is the purpose of this forum i gues).
I am not forcing noone to answer.

You take me like some kid who wants everything on the plate ready.
I am not some rich guy who can buy everything and learn the easy way.
I lose my parents since i was 20 and till now all stuff i do i do by my self!!!
So dont hate me for without good reason.

Sorry for my bad english.
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

You may be projecting somewhere. I'm not even remotely upset. Here's what's happening:

1) I'm confirming your analysis that there are problems with Irrlicht input.

2) I'm saying that it needs fixed (if you want to use it in a real application), and suggesting that you could do so if you wanted to.

3) If you don't want to (and nobody is asking you to), then I'm suggesting an alternative method that might save you time.

That's it. That's all that's being said.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

Post by belfegor »

Sorry for misunderstanding.

found this solution:

bool getKey(irr::s32 key)
{
return (GetAsyncKeyState(key) ? 1 : 0);
}
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
sevans
Posts: 6
Joined: Thu Mar 01, 2007 6:00 am

Is this safe? Is this irrlicht?

Post by sevans »

Hi,

Is the solution found here safe? Is it STL or Irrlicht? Will it break the cross platform-ness?

Thanks,

-sevans
CuteAlien
Admin
Posts: 10052
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

GetAsyncKeyState is not platform independent, but will only work on windows.
Robert Y.
Posts: 212
Joined: Sun Jan 28, 2007 11:23 pm

Post by Robert Y. »

I would use

Code: Select all

if (GetAsyncKeyState(VK_LSHIFT)<0) ...
to make sure the key is pressed at this exact moment.

The GetAsyncKeyState function is part of the Win32 SDK, not available in *nix.
olivehehe_03
Posts: 157
Joined: Tue Mar 20, 2007 8:30 am

Post by olivehehe_03 »

I've had this problem before, my program couldn't detect when left shift was pressed, but I could never work out why so I just used a different key instead...
Tell me what you cherish most. Give me the pleasure of taking it away.
Post Reply