Each tile is implemented using the following function:
Code: Select all
void TutorialApplication::createTile(int x, int y, CEGUI::Window *parent) {
CEGUI::WindowManager &wgmr = CEGUI::WindowManager::getSingleton();
Ogre::String s = Ogre::String("(" + Ogre::StringConverter::toString(x) + ", " + Ogre::StringConverter::toString(y) + ")");
CEGUI::Window *w = wgmr.createWindow("DefaultWindow", s);
w->setPosition(CEGUI::UVector2(CEGUI::UDim((x-1)/20.0f, 0), CEGUI::UDim((y-1)/15.0f, 0)));
w->setSize(CEGUI::UVector2(CEGUI::UDim(0.05f, 0), CEGUI::UDim(0.0666f, 0)));
w->setText(s);
w->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TutorialApplication::overlayTileClick, this));
parent->addChildWindow(w); }
The problem is I can't determine what tile I clicked using the subscribeEvent() function. I was hoping that I could do something like this...
Code: Select all
w->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TutorialApplication::overlayTileClick(x, y), this));
...but then I get a lovely C2661 error: 'CEGUI::SubscriberSlot::SubscriberSlot' : no overloaded function takes 2 arguments
Is it possible to add arguments in this way, so I can determine what tile has been selected? Or is there another / better way to implement what I'm looking for - that is, a way to know what tile was clicked.
Thanks,
-- Rav