【发布时间】:2014-08-29 01:38:50
【问题描述】:
我用cocos2d-js做游戏,在浏览器上试了一下,运行良好,所有的触控功能都可以,但是当我编译到android设备时,触控功能根本不工作。
我通过以下方式注册触摸:
cc.eventManager.addListener({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
setTouchEnabled: true,
setSwallowTouches: true,
onTouchBegan: this.onTouchBegan,
}, this)
并通过以下方式实现它:
onTouchBegan:function(touch, event){
var pos = touch.getLocation();
var touch_x = pos.x;
var touch_y = pos.y;
...
}
【问题讨论】:
标签: android cocos2d-x cocos2d-js