Moai SDK  1.5 revision 1 (MoaiEdition)
MOAITouchSensor Class Reference
Inheritance diagram for MOAITouchSensor:
MOAISensor

List of all members.

Function List

  down
  getActiveTouches
  getTouch
  hasTouches
  isDown
  setAcceptCancel
  setCallback
  setTapMargin
  setTapTime
  up

Function Documentation

Checks to see if the screen was touched during the last iteration.


function down ( MOAITouchSensor self [, number idx ] )
Parameters:
self ( MOAITouchSensor )
idx ( number ) Optional. Index of touch to check.
Returns:
wasPressed ( boolean )

Returns the IDs of all of the touches currently occurring (for use with getTouch).


function getActiveTouches ( MOAITouchSensor self )
Parameters:
self ( MOAITouchSensor )
Returns:
idx1 ( number ), ..., idxN ( number )

Checks to see if there are currently touches being made on the screen.


function getTouch ( MOAITouchSensor self, number id )
Parameters:
self ( MOAITouchSensor )
id ( number ) The ID of the touch.
Returns:
x ( number ), y ( number ), tapCount ( number )

Checks to see if there are currently touches being made on the screen.


function hasTouches ( MOAITouchSensor self )
Parameters:
self ( MOAITouchSensor )
Returns:
hasTouches ( boolean )

Checks to see if the touch status is currently down.


function isDown ( MOAITouchSensor self [, number idx ] )
Parameters:
self ( MOAITouchSensor )
idx ( number ) Optional. Index of touch to check.
Returns:
isDown ( boolean )

Sets whether or not to accept cancel events ( these happen on iOS backgrounding ), default value is false.


function setAcceptCancel ( MOAITouchSensor self, boolean accept )
Parameters:
self ( MOAITouchSensor )
accept ( boolean ) true then touch cancel events will be sent
Returns:
nil

Sets or clears the callback to be issued when the pointer location changes.


function setCallback ( MOAITouchSensor self [, function callback ] )
Parameters:
self ( MOAITouchSensor )
callback ( function ) Optional. Default value is nil.
Returns:
nil

Sets maximum distance between two touches for them to be considered a tap.


function setTapMargin ( MOAITouchSensor self, number margin )
Parameters:
self ( MOAITouchSensor )
margin ( number ) Max difference on x and y between taps
Returns:
nil

Sets the time between each touch for it to be counted as a tap.


function setTapTime ( MOAITouchSensor self, number time )
Parameters:
self ( MOAITouchSensor )
time ( number ) New time between taps
Returns:
nil
up

Checks to see if the screen was untouched (is no longer being touched) during the last iteration.


function up ( MOAITouchSensor self [, number idx ] )
Parameters:
self ( MOAITouchSensor )
idx ( number ) Optional. Index of touch to check.
Returns:
wasPressed ( boolean )