Detect if multitouch is available

4 replies [Last post]
amirfl7's picture
amirfl7
User offline. Last seen 8 hours 55 min ago. Offline
Joined: 2 Feb 2011

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

Replies

producerism's picture
producerism
User offline. Last seen 4 days 14 hours ago. Offline
Joined: 31 Mar 2011

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.

david97
User offline. Last seen 8 weeks 3 days ago. Offline
Joined: 8 Oct 2011

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

amirfl7's picture
amirfl7
User offline. Last seen 8 hours 55 min ago. Offline
Joined: 2 Feb 2011

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");

you will not know if was activated on this device, so you can't set a flag.

wunderwuzzi's picture
wunderwuzzi
User offline. Last seen 6 days 9 hours ago. Offline
Joined: 17 Jan 2012

I have a similar question, what happens if we call
system.activate( "multitouch" )
on a device that doesn't have multitouch capabilities. Is the call just a no-op? Or might it crash or something?

--wunderwuzzi

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.