subscribeEvent() problem

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

PoulpyBlast
Just popping in
Just popping in
Posts: 6
Joined: Mon Aug 05, 2013 07:14
Location: Nîmes, France

subscribeEvent() problem

Postby PoulpyBlast » Mon Aug 05, 2013 07:53

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 ?

tyrolite
Just popping in
Just popping in
Posts: 5
Joined: Mon Jul 08, 2013 20:07

Re: subscribeEvent() problem

Postby tyrolite » Mon Aug 05, 2013 12:23

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;
}

PoulpyBlast
Just popping in
Just popping in
Posts: 6
Joined: Mon Aug 05, 2013 07:14
Location: Nîmes, France

Re: subscribeEvent() problem

Postby PoulpyBlast » Mon Aug 05, 2013 12:51

It worked perfectly, thank you very much ! :D


Return to “Help”

Who is online

Users browsing this forum: No registered users and 3 guests