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