[SOLVED] Another Subscribing events 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

mrGREEN
Just popping in
Just popping in
Posts: 12
Joined: Wed Apr 01, 2009 12:49

[SOLVED] Another Subscribing events problem

Postby mrGREEN » Mon May 04, 2009 13:22

Hi

I'm currently integrating CEGUI into ORX (a 2D game engine written by iarwain http://orx-project.org/). My idea is to include CEGUI as an ORX plugin. One of the requirements is to Subscribe all the Objects Events into a single function. The source code looks something like this:

Code: Select all

bool CEGUI_InternalHandler(const CEGUI::EventArgs& args)
{
 ....
 
}

void CEGUI_LoadLayout()
{
   ...
   
   for(i=0;i<TotalObjects;i++)
   {
         
         CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
         CEGUI::Window* wnd = wmgr.getWindow(getObject(i));
         
         for (j=0;j<getTotalEvent(i);j++)
         {
            wnd->subscribeEvent (getEvent(i,j), CEGUI::Event::Subscriber(&CEGUI_InternalHandler));
         }
   
   ...

}


My question is, in the function "CEGUI_InternalHandler" there is someway to recover which object generate the event from "CEGUI::EventArgs& args". If this is not possible, there is someway to add this information to the args?

Thanks

mrGREEN

EDIT:

I found how to recover the info. I just need to do

const CEGUI::WindowEventArgs* cWindowEventArgs = static_cast<const CEGUI::WindowEventArgs*>(&args);

const char * zObjectName = cWindowEventArgs->window->getName().c_str();

mrGREEN

Return to “Help”

Who is online

Users browsing this forum: Bing [Bot] and 7 guests