ArcDroid,

I would do the following:

Mock up the screen in a graphics creation/editing application.  Slice
out the parts that you're going to use for your app.

Create a custom view.  I use surfaceview if it's going to be primary.

Load all of your assets and draw them to the screen.  Tweak to get it
to work right.

Now write your touch handling code.  Mostly you'll want to look for
touch downs (**note on that for multitouch below) and trigger a sound
on a touchdown point intersecting a key.

For multitouch, when the second touch point comes down you won't get a
down event but instead will have a move event with 2 touch points in
it instead just one.  There is a flaw in the implementation of the API
though that no event is sent when the second touch point is lifted.
You'll only find out when the first touch point has moved, as the
event will have a pointer count of 1 instead of 2 like it did
previously.  That may not have much of an impact on your app but
knowing to look for the pointer count going from 1 to 2 is key for
you.

A quick and dirty way to implement MT of any number of touches
(Remember - some new phones support up to 5 touchpoints) is to keep an
array of the keys and their states (up or down).  If touch down or
movement is occuring in any of those keys where the state is up, set
the state to down and trigger the sound.  If no touch is intersecting
a key's bounds, set the state to up.  This also makes for nice
rendering since all you have to do is draw an alternate image for the
current down keys.

Good luck and have fun with your app

On Sep 6, 10:12 pm, ArcDroid <jacobrjohn...@gmail.com> wrote:
> Hello,
> I would like to add multi-touch to my piano app and would like
> feedback on the best way to do it.  I hate the idea that multi-touch
> is only for one view and not multiple views (ie buttons).
> Thanks,
> Jake

-- 
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