Create custom gestures for your app. Simple define the gesture, set a few options, then fine tune for the best results. In the video I’ve defined four gestures, ‘CircleLeft’, ‘CircleRight’, ‘A’, & ‘Greater Than’. I’ve set ‘Greater Than’ to require an exact match of the strokes with no mistakes. ‘A’ is set with only in the correct order but can have one mistake. ‘CircleLeft’ & ‘CircleRight’ are set with up to 2 mistakes and can start at any point in the circle.
[media]http://youtu.be/iptMD49AR38[/media]
and heres the code required to make these gestures work.
local gesture = require('gesture') -- require gesture lib function onGestureRead(e) -- function called when a good gesture is read print("gesture match order: "..e.gestureOrder..", name: "..e.gestureName.. ", rotation: "..e.gestureAngle) end gesture.defineGestures( { {"46", "GreaterThan", 0, 0}, -- requires exact match of greater than symbol {"248", "A", 0, 1}, -- requires no more then one mistake for match {"87654321", "CircleLeft", 45, 2}, -- {"12345678", "CircleRight", 45, 2}}) -- rotates the order around so you can start gesture -- in any direction but requires no more then 2 mistakes gesture.start() -- start reading gestures Runtime:addEventListener( "gesture", onGestureRead ) -- if a good gesture is read go to function