Detect if multitouch is available

-----------
Note: I originally posted this as a question in the developer support forum(http://developer.anscamobile.com/forum/2011/11/02/detect-multitouch-capability), but I now realize that this is an important feature missing from the API, so I'm re-posting it as a feature request.
------------

It could be very useful if we can detect during runtime if multitouch was successfully activated. Maybe the best solution to this is if system.activate() could return a boolean. Something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
--[[ Pseudo-code:
--(This doesn't really work, since the system.activate API doesn't --return anything, but it should explain what I'm trying to accomplish)
--]]
-------------------------------------
 
--again, I know the next line is not supposed to work...
local multiTouchIsOn = system.activate("multitouch");
 
if multiTouchIsOn then
    --Multitouch is working on this device, use pinch zoom
else
    --No multitouch available on this device, draw a zoom slider
end

better yet, if such a feature was implemented, I think it would be more useful if it returned a number, which would reference the total number of supported touchpoints (if that's a possibility).

For example, some devices only support 2 touchpoints, while others (iPad) support up to 11!

so

local multiTouchIsOn = system.activate("multitouch");

should really return anything from a 1 to 11.

I posted this approach with your thread in the Developer Forum as producerism has prescribed above. Single touch is the default, just flag if you turn multitouch on in your app. You control if multitouch is enabled.

-David

Hi David, I don't understand. How do you you know if the device supports multitouch to begin with? (unless you compile a long list of supporting devices, which is very impractical).

If you try to turn multitouch on with

1
system.activate("multitouch");
views:1522 update:2011/11/3 9:30:30
corona forums © 2003-2011