Page 1 of 1

subscribeEvent() problem

Posted: Mon Aug 05, 2013 07:53
by PoulpyBlast
Hi,
I found some topics talking about subscribeEvent() in this forum, but I didn't understand where my problem was... So I create a new one.

I'm starting using CEGUI 0.7.9 with Ogre, following a french tutorial.
I implemented all my CEGUI code in a class called "InputListener", and I created the quit() function :

Code: Select all

bool InputListener::quit()
{
   mContinue = false;

   return mContinue;
}


Also, I created a "Quit" button in my scene. I want to call the subscribeEvent() function, also in my InputListener class, and I wrote it like the tutorial said :

Code: Select all

quitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&InputListener::quit, this));


Unfortunately, I have this error message :

Code: Select all

error C2661: 'CEGUI::SubscriberSlot::SubscriberSlot' : no overloaded function takes two parameters


So I tried to delete the "this" argument, and it said :

Code: Select all

error C2064 : term does not evaluate to a function taking 'number' arguments


I am at a loss... What can I do to fix those errors ?

Re: subscribeEvent() problem

Posted: Mon Aug 05, 2013 12:23
by tyrolite
I think the problem is with your event handler declaration. Your quit function

Code: Select all

bool InputListener::quit()
{
   mContinue = false;

   return mContinue;
}


should look like this:

Code: Select all

bool InputListener::quit(const CEGUI::EventArgs &e)
{
   mContinue = false;

   return mContinue;
}

Re: subscribeEvent() problem

Posted: Mon Aug 05, 2013 12:51
by PoulpyBlast
It worked perfectly, thank you very much ! :D