This site is no longer active and is available for archival purposes only. Registration and login is disabled.

How to repeat button press?


How to repeat button press?

Postby namGman » Dec 27, 2007 @ 10:03am

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.
namGman
pm Member
 
Posts: 18
Joined: Aug 22, 2007 @ 6:13pm


Postby edge » Dec 27, 2007 @ 1:02pm

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
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby namGman » Dec 27, 2007 @ 8:43pm

namGman
pm Member
 
Posts: 18
Joined: Aug 22, 2007 @ 6:13pm


Postby edge » Dec 28, 2007 @ 4:04pm

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.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby namGman » Dec 28, 2007 @ 11:39pm

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.
namGman
pm Member
 
Posts: 18
Joined: Aug 22, 2007 @ 6:13pm


Postby edge » Dec 29, 2007 @ 5:34pm

I recommend using ClassEInput for all your input events. It also allows you to use the improved keymappings for your application menus.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron