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. yet another issue with AWS on Android

Hi,

I am trying a lot to port AWS libraries to use in my Android
application. After having problems which needed recompiling some
libraries, and so on - I got stuck with the issue many also did.
Android complains:

trouble processing "javax/net/ssl/SSLException.class":
[2010-10-26 02:09:06 - Amazon]
Attempt to include a core class (java.* or javax.*) in something other
than a core library.

But actually - this happens after I repackaged the stax-api.jar which
is required by AWS and that was suggested by Android as a solution
(instead --core library option which I try to avoid)...

Can someone give a hint what is now the problem, since javax.net.ssl.*
package is present in Android 2.2.jar - it should not give the above
mentioned error, isn't it? Stax-api.jar is repackaged to my
application namespace...

javax.xml.namespace.* is however used from Android.jar since otherwise
it was complaining - with the same error mentioned above.

Thanks in advance,

Sanja

-- 

2. Gallery with folder filter

Hello

I'm using following code to open a gallery inside of my app

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, FIND_RESULT);

Is it possible to limit a list of images to only show images taken by
camera? Viewing Gallery on my 2.1 system, images are grouped so there
has to be a parameter that defines to which folder it belongs.

Checking the MediaStore.Images.ImageColumns (http://
developer.android.com/reference/android/provider/
MediaStore.Images.ImageColumns.html) I did not a find any column that
would define such thing.

Could I be wrong? Because if I could create a query to filter by
folder and create my own gallery view, then my problem would be
solved.

Best regards,

Erol

-- 

3. broadcast receiver priority question

4. Android emulator is not working for Audio recorder?

5. Need help monetizing your Android Apps?

6. Image

7. Predefined licensing models