Oxygine C++事件监听器错误

问题描述:

我用Oxygine框架和whem我尝试将事件侦听器添加到一个精灵它给了我这个错误使用闭幕Oxygine C++事件监听器错误

时,这是我

#include "MainActor.h" 
#include "Utils.h" 
#include "Map.h" 
#include "Hero.h" 
#include "res.h" 
#include <iostream> 

using namespace oxygine; 

spHero hero; 

MainActor::MainActor(): _world(0) { 
    setSize(getStage()->getSize()); 
    spMap map = new Map("map.xml", "Sprites.png"); 
    addChild(map); 
    _world = new b2World(b2Vec2(0, 10)); 

    hero = new Hero(100, 10, 0, 100, 
    res::resources.getResAnim("hero_idle_up"), _world, getSize()/2, 
    0.6);  
    addChild(hero); 
    map->addEventListener(TouchEvent::CLICK, CLOSURE(this, 
    &MainActor::Move)); 
} 

void MainActor::Move(Event* ev) { 
    TouchEvent* tev = safeCast<TouchEvent*>(ev); 
    hero->addTween(TweenPosition(tev->localPosition), 1000); 
} 

,并在此线它给出如下因素误差

map->addEventListener(TouchEvent::CLICK, CLOSURE(this, &MainActor::Move)); 

错误:没有重载函数“细节:: CreateClosure”的实例相匹配的参数列表。

这是一种莽撞,因为其中一种方法与头文件中的一种不一致。现在解决了