Touch
Exposes device-level hardware interactions for touch events.
TTMinis.game.onTouchStart(listener)
Registers a listener for touch start events.
Parameters
Field | Type | Description | Required |
|
| The listener function for touch start events. Called with a response object. | Yes |
Response object
Field | Type | Description |
|
| The list of Touch objects for all current touch points |
|
| The list of Touch objects that triggered this event |
|
| The timestamp when the event was triggered |
Example
const listener = function (res) {
console.log("Touch start:", res.touches);
};
TTMinis.game.onTouchStart(listener);TTMinis.game.onTouchMove(listener)
Registers a listener for touch move events.
Parameters
Field | Type | Description | Required |
|
| The listener function for touch move events. Called with a response object. | Yes |
Response object
Field | Type | Description |
|
| The list of Touch objects for all current touch points |
|
| The list of Touch objects that triggered this event |
|
| The timestamp when the event was triggered |
Example
const listener = function (res) {
console.log("Touch move:", res.touches);
};
TTMinis.game.onTouchMove(listener);TTMinis.game.onTouchEnd(listener)
Registers a listener for touch end events.
Parameters
Field | Type | Description | Required |
|
| The listener function for touch end events. Called with a response object. | Yes |
Response object
Field | Type | Description |
|
| The list of Touch objects for all current touch points |
|
| The list of Touch objects that triggered this event |
|
| The timestamp when the event was triggered |
Example
const listener = function (res) {
console.log("Touch end:", res.touches);
};
TTMinis.game.onTouchEnd(listener);TTMinis.game.onTouchCancel(listener)
Registers a listener for touch cancel events.
Parameters
Field | Type | Description | Required |
|
| The listener function for touch cancel events. Called with a response object. | Yes |
Response object
Field | Type | Description |
|
| The list of Touch objects for all current touch points |
|
| The list of Touch objects that triggered this event |
|
| The timestamp when the event was triggered |
Example
const listener = function (res) {
console.log("Touch cancel:", res.touches);
};
TTMinis.game.onTouchCancel(listener);TTMinis.game.offTouchStart(listener)
Removes the listener for touch start events.
Parameters
Field | Type | Description | Required |
|
| The listener function passed to | No |
Example
const listener = function (res) {
console.log(res);
};
TTMinis.game.onTouchStart(listener);
TTMinis.game.offTouchStart(listener); // Must pass the same function object used during registrationTTMinis.game.offTouchMove(listener)
Removes the listener for touch move events.
Parameters
Field | Type | Description | Required |
|
| The listener function passed to | No |
Example
const listener = function (res) {
console.log(res);
};
TTMinis.game.onTouchMove(listener);
TTMinis.game.offTouchMove(listener); // Must pass the same function object used during registrationTTMinis.game.offTouchEnd(listener)
Removes the listener for touch end events.
Parameters
Field | Type | Description | Required |
|
| The listener function passed to | No |
Example
const listener = function (res) {
console.log(res);
};
TTMinis.game.onTouchEnd(listener);
TTMinis.game.offTouchEnd(listener); // Must pass the same function object used during registrationTTMinis.game.offTouchCancel(listener)
Removes the listener for touch cancel events.
Parameters
Field | Type | Description | Required |
|
| The listener function passed to | No |
Example
const listener = function (res) {
console.log(res);
};
TTMinis.game.onTouchCancel(listener);
TTMinis.game.offTouchCancel(listener); // Must pass the same function object used during registration