Multi-point touch example
During the launch last month it has been said that bada supports multi touch screen technology. However, for some reason Samsung is eager to call it multi-point touch. There is relatively few information on whether this is somehow connected to legal issues or simply another neologism to differentiate bada from the competition. Regardless of how you call it, it’s still just that: as a developer you have an option to detect various touches at once – and this is how it is done.
I have implemented this thing in the Simple Finger Drawing project and will make it available within the next few days on the projects page. The idea is to allow the user to use various fingers at once, so that the Picasso’s among us can unfold their creative energies in a more efficient way
First thing I did was to enable the multi touch on the drawing board form within the OnInitializing() function (somehow it seems that this statement must go there and not elsewhere, otherwise the multipoint-feature is not set).
// Enable multi-point touch Touch touch; touch.SetMultipointEnabled(*this, true);
The Touch class, as it is “explained”, holds information regarding the multi touches as well as touch events and co. I use the SetMuiltipointEnabled() function to enable multi touching for the drawing form.
Then, I have modified the drawing function. In the earlier versions it was simply receiving coordinates delivered by the different touch event handlers. Not anymore!
inline void
DrawingBoardForm::DrawBrush(const Osp::Ui::Control & source)
{
int radius = brush_->size;
int x;
int y;
Touch touch;
IList *touchList = null;
touchList = touch.GetTouchInfoListN(*this);
if (touchList)
{
for(int i=0; i<touchList->GetCount(); i++ )
{
TouchInfo *pTouchInfo = static_cast<TouchInfo *>(touchList->GetAt(i));
x = pTouchInfo->position.x-radius;
y = pTouchInfo->position.y-radius;
canvas_->FillEllipse(brush_->color.GetRGB32(), Rectangle(x, y,radius*2,radius*2));
}
touchList->RemoveAll(true);
delete touchList;
this->RequestRedraw(true);
}
}
Here we work again with the Touch class to get a list of TouchInfo s bound to the Control in question (our drawing board form). Then we loop through all those points and draw the brush strokes. Finally, after all the drawing is done we request a redraw as it was explained in this tutorial.
In theory this should be working perfectly, however there seems to be no way to test it on the simulator as you have only one mouse pointer. However if it did work, it might have looked like this:
The multi-point touch technology is specially interesting for games – and now you know how it is done! What I still have not found though is the maximum amount of points that it can track… (10 fingers?
)
Related posts:
the Flagship of independent news, reviews and resources for Developers and Users of Samsung's mobile platform Bada 




7 Responses to “Multi-point touch example”
By Ben Morris on Feb 4, 2010 | Reply
>>maximum amount of points that it can track
I think I heard that multipoint tracks up to 5 points.
Ben.
By wit on Feb 4, 2010 | Reply
Thank you for the info, Ben! Great to have you here
By karzia on Feb 5, 2010 | Reply
Maximum fingers are 6.
because lcd screen is not enough to touch 10 fingers
By karzia on Feb 5, 2010 | Reply
Dear Wit
If you wanna test the multi-touch , do Ctrl + Mouse LBuutton click.
By wit on Feb 5, 2010 | Reply
Thank you very much for that info, karzia!
I will try it out!
By Faizan on Jul 20, 2010 | Reply
Can we use this way to zoom into pics.. If not than how can we.. ??
By Dave on Jul 27, 2010 | Reply
Hi, any idea how one might add multipoint touch support to an opengl app that doesn not have a form