Press and hold Dpad direction doesn't generate continuous events

by ron » Sat, 27 Dec 2008 07:03:31 GMT


Sponsored Links
 Hi,

I am thinking to write a game that uses the Dpad as the direction
keys. I am expecting to press and hold the Dpad's up/down/left/right
to control my game character to move in those directions. However,
when I test it on the emulator, pressing the Dpad right will first
generate 1 onKeyDown event, then it wait for a long while (~2 seconds)
before generate successive key events.. that's not good for me since
my character will move one step and stop (the first event), then wait
for a second or 2 and it continue to move.

Anyone has any idea why it happens and anyway to work around it??
thx.

Ron

--~--~---------~--~----~------------~-------~--~----~



Press and hold Dpad direction doesn't generate continuous events

by andyclap...@googlemail.com » Tue, 30 Dec 2008 03:13:14 GMT


 Couple of points:
You shouldn't really be relying on the keyboard repeat in a game. Set
a flag on the keydown, and clear it on the keyup. Check the flag
periodically (in the main game loop or via a timer) to see what keys
are currently held down and act accordingly.
No devices have dpads yet. The G1 has a trackball that sends dpad
style keypress events, but it's no way usable for games (though it
would be interesting to see it used as a real trackball - centipede
anybody?!) Make sure you also allow an alternative keyboard control
scheme (WSAD perhaps, although a bit close to G1's menu key).




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Paid Apps - Update Problem?

I paid for the Snap Photo Pro app (because its awesome) and he has
already released a newer version. Seems like no matter what I try
(wifi, 3g, standard, after reboot, after uninstall) I can't get the
update to start downloading. It just sits on the Starting Download...
screen. Checking around the web, I see a LOT of people are having this
same problem. Is there some known issue, or work around?
--~--~---------~--~----~------------~-------~--~----~

2. get call and sms logs / data

Hi @ all

I want to develop a kind of special contact application.
for some features, I need to have access to the call and sms history.

for example, I wan to:

- show the top three persons, I have called this month
- show the sms conversation between me and another contact

Call logs and sms logs are saved on the android device, for how long?
Can you tell me, if it's possible, how to get access to this
informationen?

thanks in advance!
Thomas, Switzerland

--~--~---------~--~----~------------~-------~--~----~

3. Failed compile ADT

4. Drawing Overlay on builtin map app?

5. Getting Android device to talk to other device.

6. Hardware Advice for a Student

7. only test!it's null