I'm not positive, but maybe the issue is that you're getting touch
events for each time you draw your scene?  Try to skip drawing, and
just print debug about when your finger is down... I think that will
shed some light on the issue.  You could also just capture the
touchdown, record it's startTime, and if you haven't received an event
in some delta (probably like 50ms?) assume you should stop the
character.

Good Luck.



On Jul 21, 2:50 am, billconan <[email protected]> wrote:
> Hello everyone.
>
> I'm working on a simple game: when you press a button on the screen, a
> character will run to certain direction.
>
> it's easy to support keyboard input. but, some phone doesn't go with a
> keyboard or even no a track ball. so I decided to draw a virtual "run"
> key on the screen (with opengl). when the user press the virtual key,
> i apply a velocity to the character. and when the user release the
> key, i disable the velocity to stop the character.
>
> but there seems to be some touch event noisy.
>
> if my finger cannot press still, i will see millions of touch down and
> touch up events, instead of a single long pressing. and occasionally,
> my program captured the touch down  event when i touch the screen, but
> didn't capture touch up event. so my character will keep moving, even
> no finger is on the screen.
>
> I'm wondering if there is some way to reduce the touch event noisy and
> tell if the user is currently pressing on the screen, instead of only
> getting an event when touch up and down happen.
>
> it seems the system ui can detect long pressing, for example when you
> put a finger on one item of the list view widget, the entire item
> turns to orange.
>
> i just don't know how to detect pressing in my opengl game.
>
> thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to