EventReceive catches events so fast

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
keynet
Posts: 18
Joined: Wed Jun 27, 2012 9:07 am

EventReceive catches events so fast

Post by keynet »

Hi.
I made a simple chatting program, and it gets key inputs using IEventReceiver.

When event.KeyInput.Key is irr::KEY_RETURN and event.KeyInput.PressDown is set, the program send chat message to sever and clear the edit box's text.
And it checks this event while dev->run() which of FPS is set to 30 FPS.
Also when the chat message is empty, it shows a messagebox that should be something on the chat message edit box.

However, the program gets user's Enter Key event so fast, so even I put some message on edit box and input Enter Key, it tries message at least twice so that the first message sent and the second cleared-message isn't sent, which shows a "edit box is empty!" message box.

Why does IEventReceiver get user's key input so fast?
And is there any method to control this speed so that I can get user's input not so badly fast?

Please help. Thanks in advance
From Seoul, South Korea
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: EventReceive catches events so fast

Post by hybrid »

The event is only sent once, and key repeat is not that fast that it would occur on a single key hit. Maybe you just check the key state? In that case, you might get more than one frame with state key pressed. Maybe show your code?
Post Reply