When I run my game, and click on the button created above, I get an exception on the file type_traits file, and in the: return (((*_STD forward<_Ty1>(_Arg1)).*_Pmf)(_STD forward<_Types2>(_Args2)...)); line (see below).
struct _Invoker_pmf_pointer
{ // INVOKE a pointer to member function on a [smart] pointer
template<class _Decayed,
class _Ty1,
class... _Types2>
static auto _Call(_Decayed _Pmf, _Ty1&& _Arg1, _Types2&&... _Args2)
-> decltype(((*_STD forward<_Ty1>(_Arg1)).*_Pmf)(
_STD forward<_Types2>(_Args2)...))
{ // INVOKE a pointer to member function on a [smart] pointer
return (((*_STD forward<_Ty1>(_Arg1)).*_Pmf)(
_STD forward<_Types2>(_Args2)...));
}
};
I am creating this callback wrong? Has anyone encountered this?
While we’ve moved over to using lamdas for most of our callback code we still have some old 2.x Menu code as well. You seem to be setting up the callback or selector correctly.
My guess is MainMenuLayer derives Layer (which derives Ref) so you don’t need to cast (Ref*)this. Based on the error maybe your mainMenu is a smart ptr (unique/shared_ptr) instead of raw Menu*? Or maybe your method definition for the callback is wrong? It should be this:
I figured out what the error was. The problem was that I was registering a touch listener on a previous scene and I wasn’t removing it when the scene ended.
So when I added the remove touch listener code before changing scenes, everything worked well.