Simple problem with key pressed event
Posted: Tue Jan 05, 2010 8:52 pm
Hi,
I have a problem catching the key pressed event. My code:
If the user keeps pushing the key down, I would expect the message "A PRESSED DOWN" to appear once, and then, nothing should come until the A key is relesed.
Instead, I get:
A PRESSED DOWN
A RELEASED
A PRESSED DOWN
A RELEASED
...
until I release the key. Is this really wanted or is it a bug I made?
Greets,
Lo
I have a problem catching the key pressed event. My code:
Code: Select all
class GameplayReceiver : public IEventReceiver
{
//...
bool OnEvent(const SEvent& event)
{
if(event.EventType == irr::EET_KEY_INPUT_EVENT)
{
if(event.KeyInput.PressedDown && event.KeyInput.Key == KEY_KEY_A)
puts("A PRESSED DOWN");
if(!event.KeyInput.PressedDown && event.KeyInput.Key == KEY_KEY_A)
puts("A RELEASED");
}
}
};
Instead, I get:
A PRESSED DOWN
A RELEASED
A PRESSED DOWN
A RELEASED
...
until I release the key. Is this really wanted or is it a bug I made?
Greets,
Lo