Game Development Reference
In-Depth Information
A simplified version of a pull-to-refresh blob
Touch Events
On mobile devices, which have no mouse pointer but instead react to touch, we can set the callback
for touches. The object to set a callback on is MOAIInputMgr.device.touch . This captures the touch
events. The callback function is passed an eventType , which can be one of the following:
MOAITouchSensor.TOUCH_DOWN
MOAITouchSensor.TOUCH_UP
MOAITouchSensor.TOUCH_MOVE
MOAITouchSensor.TOUCH_CANCEL
function onTouch(eventType, idx, x, y, tapCount)
print(eventType)
end
MOAIInputMgr.device.touch:setCallback(onTouch)
If you run this code on the desktop, it will result in an error, as there is no touch device.
 
Search WWH ::




Custom Search