Number of arguments in event function

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

RoboWarrior
Just popping in
Just popping in
Posts: 4
Joined: Sat Aug 27, 2011 01:45

Number of arguments in event function

Postby RoboWarrior » Sat Aug 27, 2011 02:05

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


User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Number of arguments in event function

Postby Kulik » Sat Aug 27, 2011 07:32

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.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 13 guests