Hello.

I am working on a game that displays its graphics through a modified
SurfaceView.  The game scrolls around a map based on the location of
the main character.  That all works fine.

I am trying to add a feature to the game that allows you to touch the
screen and drag the camera around to see other parts of the map.  This
is where I am running into trouble.  The game's SurfaceView overrides
'public boolean onTouchEvent(MotionEvent event)' to call another
method in the game's thread which handles the events.  Sometimes, this
works fine (although the frame rate drops significantly while the
screen is touched).  Other times, there will be a delay of several
seconds before the game responds to a touch event, during which time
the game continues, but the user loses all control.  During these
delays, a message sometimes appears stating that my activity is not
responding, and giving the options to 'Force close' or 'Wait'.  If the
user selects 'Wait', the game almost always resumes right away, but
these delays are obviously not acceptable.

The delays occur only the first time the screen is touched after the
game is started.  Once the game has resumed after a delay, the touch
events work just fine again.

I have experimented with having the game thread sleep for short
periods at various points throughout the game.  Although this does
seem to have a small effect on the problem, the delays still happen.
Has anyone else run into this?  What am I doing wrong?

Thank you very much for any suggestions you can provide.

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

Reply via email to