C2664无法将*转换为^

时间:2016-02-17 03:00:15

标签: c# c++ cocos2d-x-3.0

我使用cocos2dx 3.8在Windows 10 UWP中进行编码,我希望在游戏中使用xaml调用c ++ / cx中的函数(cocos2d,c ++)。 现在 错误C2664

  

“空隙   CocosAppWinRT :: PayHelper :: SetGetPay(CocosAppWinRT :: OnStateChanged ^)“:   无法将参数1从“Platform :: String ^(__ cdecl CocosAppWinRT :: OpenGLESPage :: *   )(void)“转换为”CocosAppWinRT :: OnStateChanged ^“.....

错误pos: m_helper-> SetGetPay(安培; OpenGLESPage :: GetOnPay);

代码在那里:

payhelper.h:
public delegate int OnStateChanged();
public ref class PayHelper sealed
{
public:
    PayHelper();
    int onPay()
    {
     if (m_getDelegate)
     {
        return m_getDelegate->Invoke();
     }
    };
    void SetGetPay(OnStateChanged^ del)
    {
        m_getDelegate = del;
    };
private:
    property static OnStateChanged^ m_getDelegate;
};

gamesence.h
CocosAppWinRT::PayHelper^ m_payHelper;
m_payHelper = ref new CocosAppWinRT::PayHelper();
m_payHelper->onPay();

OpenGLESPage.xaml.h
private:
    PayHelper^ m_helper=nullptr;
public:
    int GetOnPay();
cpp
m_helper = ref new PayHelper();
m_helper->SetGetPay(&OpenGLESPage::GetOnPay);

int OpenGLESPage::GetOnPay()
{
  return 8;
}

0 个答案:

没有答案