Page 1 of 1

CEGUI - assigning an event to a button

Posted: Sun Aug 26, 2012 01:17
by Stenr Reisa
I am attempting to integrate CEGUI into the advanced ogre framework example that is on their site. I have gotten to the point where I am trying to assign an event to happen when a button is clicked, and I am having trouble with this line:

Code: Select all

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


When I try to compile this, I get the error:

Code: Select all

1>c:\users\stenr\basics\xxx\projects\development\client\xxx\xxx\menustate.cpp(46): error C2661: 'CEGUI::SubscriberSlot::SubscriberSlot' : no overloaded function takes 2 arguments


Can anyone help me out here? What is it I have done wrong? Was pretty much smooth sailing up till here, buttons and everything show up, I just can't get the event to apply to the button for some reason. :oops: Any help is greatly appreciated!

Re: CEGUI - assigning an event to a button

Posted: Sun Aug 26, 2012 12:47
by MorbidAngel
Declare your shutdown event function as so:

bool shutdown(const CEGUI::EventArgs& e);

Re: CEGUI - assigning an event to a button

Posted: Sun Aug 26, 2012 19:42
by Stenr Reisa
Yup, that was it, thanks!

Re: CEGUI - assigning an event to a button

Posted: Sun Aug 26, 2012 21:32
by Stenr Reisa
Well, actually now I have declared the function in that way and am still getting the error...what could be causing that? Here's relevant things

Code: Select all

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


Code: Select all

bool DemoApp::stopDemo(const CEGUI::EventArgs& e)
{
   OgreFramework::getSingletonPtr()->m_pLog->logMessage("Demo stopped!");
   m_pAppStateManager->popAllState();

   return true;
}


Here's the part of the log I am supposed to post:
25/08/2012 19:06:46 (Std) ---- Version 0.7.6 (Build: May 30 2012 Debug Microsoft Windows MSVC++ 10.0 32 bit) ----
25/08/2012 19:06:46 (Std) ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
25/08/2012 19:06:46 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
25/08/2012 19:06:46 (Std) ---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
25/08/2012 19:06:46 (Std) ---- Scripting module is: None ----

Re: CEGUI - assigning an event to a button

Posted: Mon Aug 27, 2012 00:52
by Stenr Reisa
I'm trying something different, what would be an eventarg that I would pass to the function? I was thinking it would be like a specific button mouseclick or a specific keypress. Am I wrong?

Re: CEGUI - assigning an event to a button

Posted: Mon Aug 27, 2012 01:03
by Stenr Reisa
OK nevermind i figured it out :lol: :lol: :lol: thanks!