当前位置:网站首页>【Cocos Creator 3.5.1】input. Use of on

【Cocos Creator 3.5.1】input. Use of on

2022-06-27 05:44:00 CN-Dust

input.on Instead of 2.x Medium cc.director.on perhaps this.node.on

Usage mode :( Will be automatically generated on the top import Content )

input.on(Input.EventType.MOUSE_UP, this.onMouseUp, this);

describe :

(alias) const input: Input
import input
@en — The singleton of the Input class, this singleton manages all events of input. include: touch, mouse, accelerometer and keyboard.

@zh —  Input class singleton , This singleton manages all input events , Include : touch 、 mouse 、 Accelerometer   and   keyboard .

@example

input.on(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
input.off(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
原网站

版权声明
本文为[CN-Dust]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/178/202206270534251895.html