Page 1 of 1
How to repeat button press?

Posted:
Dec 27, 2007 @ 10:03am
by namGman
Hi, I'm trying to get my buttons to repeat when held. I tried setting SetRepeatRates and also added CheckRepeat to my frame processing but no button events are repeated.
Can you please provide a brief sample and explanation on how to generate repeated button events?
ps. my code is based off of the helloworld sample.
Thanks.

Posted:
Dec 27, 2007 @ 1:02pm
by edge
Hi NamGMan,
You're only able to get repeated keystrokes by using ClassEInput. Use ecd.input->GetKeyPressCount() to get the amount of key strokes since the last frame. More information can be found here:
http://www.edgelib.com/index.php?node=1018
You can also continuously call ecd.input->GetKeyEvent() until it returns false. The key scancode and event type (like first press, repeat or release) are contained in the E_INPUTEVENT structure. Please refer to this page for more information:
http://www.edgelib.com/index.php?node=770

Posted:
Dec 27, 2007 @ 8:43pm
by namGman

Posted:
Dec 28, 2007 @ 4:04pm
by edge
Hi NamGMan,
You're code looks correct, please also check for EIE_PRESSED instead of only for repeat.
Unfortunately, there is a bug in EDGELIB which prevents the SetRepeatRates() function from working correctly. It will be fixed in the next version.

Posted:
Dec 28, 2007 @ 11:39pm
by namGman
Hi, if I get your meaning the reason why I'm not checking for EIE_PRESSED is because the initial button press is passed through the OnButtonDown in the ClassEdge implementation.
Should I scrap the OnButtonDown (and similar) methods and move all input handling into the noted routine?
Thanks.

Posted:
Dec 29, 2007 @ 5:34pm
by edge
I recommend using ClassEInput for all your input events. It also allows you to use the improved keymappings for your application menus.