Skip to content

Instantly share code, notes, and snippets.

@dlprows
Created April 30, 2015 19:40
Show Gist options
  • Save dlprows/4a13db52e2720fe2df1b to your computer and use it in GitHub Desktop.
Save dlprows/4a13db52e2720fe2df1b to your computer and use it in GitHub Desktop.
Register a callback for all multitouch devices
static NSArray* devices;
void startMT(){
devices = CFBridgingRelease(MTDeviceCreateList());
for(int i = 0; i < devices.count; i++)
{
MTDeviceRef device = (__bridge MTDeviceRef)devices[i];
MTRegisterContactFrameCallback(device, mtcallback);
MTDeviceStart(device, 0);
}
}
void stopMT(){
for(int i = 0; i < devices.count; i++)
{
MTDeviceRef device = (__bridge MTDeviceRef)devices[i];
MTDeviceStop(device);
}
devices = nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment