Page 1 of 1

Number of arguments in event function

Posted: Sat Aug 27, 2011 02:05
by RoboWarrior
Do you know the funzìction that I ha to pass to subscribe a event are like this one:

Code: Select all

bool function(const CEGUI::EventArgs&)
{
   return true;
}


Is it possible to pass another argument with the const CEGUI::EventArgs& arg like an int?
like this one

Code: Select all

bool function(const CEGUI::EventArgs&, int number)
{
        cout <<number;
   return true;
}
......
int number2=55;
button->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(&function(number2), this));


Re: Number of arguments in event function

Posted: Sat Aug 27, 2011 07:32
by Kulik
You can do this with boost::bind for example but CEGUI itself doesn't have means to achieve this (I think) other than by delegates which is hard to maintain. Look into boost::bind, it's compatible with CEGUI.