Keyboard problem in game(s) | developer.brewmp.com Keyboard problem in game(s) | developer.brewmp.com

Developer

Keyboard problem in game(s)

Forums:

Hi all !

First I must thank everyone that helped me on this forum so far - its been a blast and the game is running very nicely now ! :)

However I have stumbled upon one problem which could effect the game play a lot :

When I press some directional key and hold it down I need to move the main character around. In Brew 1.1 I use the Key Event that comes into my handler and move the character when that event comes in.
The problem is that if you HOLD the key down then in the beginning a Key event is sent OK, BUT then it pauses for around half second before key events start coming in again. This means that my main character always pauses in the beginning and then moves on...

Is there a way for me to overcome this ? I checked FAQ's and API's but I didn't find a way to find out manually (without an event) if a key is pressed down or not... that would be perfect. If that can't be done is there a way to surpess that Key Hold PAUSE someway ????

Best regards,
Tomaz

I figure the best way would be to catch the key down and key up events and to switch booleans accordingly. For example, the left key is pressed you set leftKeyPressed to TRUE, and when it is released you put it back to FALSE. That way, you always know the state of each key. I don't believe there's a way to get the state of the keys directly.

I figure the best way would be to catch the key down and key up events and to switch booleans accordingly. For example, the left key is pressed you set leftKeyPressed to TRUE, and when it is released you put it back to FALSE. That way, you always know the state of each key. I don't believe there's a way to get the state of the keys directly.

I know... But HOW do I get the event when the key is pressed and when it is released ??? I only get the event for when it is pressed... or am I missing something ??
Tomaz

I know... But HOW do I get the event when the key is pressed and when it is released ??? I only get the event for when it is pressed... or am I missing something ??
Tomaz

You can use the EVT_KEY_PRESS and EVT_KEY_RELEASE events
/kUfa

You can use the EVT_KEY_PRESS and EVT_KEY_RELEASE events
/kUfa

Thank you ! I missed those in the API - just coded it and it works PERFECTLY :)
I am really hyped to try it on a real phone now :)
Best regards and thanx again !
Tomaz

Thank you ! I missed those in the API - just coded it and it works PERFECTLY :)
I am really hyped to try it on a real phone now :)
Best regards and thanx again !
Tomaz

FYI, there is also an EVT_KEY_HELD event, but many handsets dont use it.
-Tyndal

FYI, there is also an EVT_KEY_HELD event, but many handsets dont use it.
-Tyndal

I saw it now in the API - finally found the place ;-) And didn't use it since I "simulate" the HELD event in my handler anyway.
Best regards,
Tomaz

I saw it now in the API - finally found the place ;-) And didn't use it since I "simulate" the HELD event in my handler anyway.
Best regards,
Tomaz