現在、最初の cocos2d-x JS プロジェクトに取り組んでいますが、MAC プロジェクトの実行で問題が発生しました。WEBでは正常に動作しています。
次の eventListener を作成しました。
var MouseFetcher;
MouseFetcher = cc.EventListener.create({
event: cc.EventListener.MOUSE,
TP: cc.Point,
initial:function(){
this.TP = new cc.p(cc.winSize.width/2, cc.winSize.height/2);
},
onMouseDown: function (event) {
this.TP = event.getLocation();
return true;
},
onMouseMove: function (event) {
},
onMouseUp:function(event){
this.TP = event.getLocation();
var i;
for(i = 0; i < clickables.length; i++){
if(clickables[i].containsPoint(this.TP)){
clickables[i].touchEvent();
}
}
}
});
また、eventManager で使用されるコード部分があります。
this.touchListener = MouseFetcher;
this.touchListener.initial();
cc.eventManager.addListener(this.touchListener, this);
アプリを実行すると、次のエラーが発生します。
frameworks/cocos2d-x/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp: Line: 18190, Function: js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority
Invalid Native Object
JS: /script/jsb_cocos2d.js:1643:Error: Invalid Native Object
誰かがその問題を解決するのを手伝ってくれますか? MAC/IOS バージョンで間違っていることはありますか? その場合の eventListener の初期化方法と使用方法。