Page 1 of 1

CEGUI events

Posted: Fri Jan 13, 2006 17:09
by SOMRoberto
I got a beginner problem. I write to cegui fonts layout etc /demo7/ and I implemented the Quit button event.
But it not do anything.
My code:
...
cegui->Initialize ();
cegui->GetLoggerPtr ()->setLoggingLevel(CEGUI::Informative);
cegui->GetSchemeManagerPtr ()->loadScheme("ice.scheme");
cegui->GetSystemPtr ()->setDefaultMouseCursor("ice", "MouseArrow");
cegui->GetFontManagerPtr ()->createFont("Vera", "/fonts/ttf/Vera.ttf", 10,
CEGUI::Default);
CEGUI::WindowManager* winMgr = cegui->GetWindowManagerPtr ();
cegui->GetSystemPtr ()->setGUISheet(winMgr->loadWindowLayout("ice.layout"));
....

void Demo7::initDemoEventWiring(void)
{
using namespace CEGUI;

WindowManager::getSingleton().getWindow("Demo7/Window1/Quit")->
subscribeEvent(PushButton::EventClicked, Event::Subscriber(&Demo7::HandleQuit, this));
}

bool Demo7::HandleQuit(const CEGUI::EventArgs& e)
{

-event-

return true;
}

Re: CEGUI events

Posted: Fri Jan 13, 2006 17:29
by lindquist
It looks fine. what are you saying the problem is?

Re: CEGUI events

Posted: Fri Jan 13, 2006 17:32
by SOMRoberto
lindquist wrote:
It looks fine. what are you saying the problem is?


Hmm. This event not do anything. Is layout reading automatic muont the elements too?

Re: CEGUI events

Posted: Fri Jan 13, 2006 17:34
by lindquist
I'm sorry I don't understand your issue. What is it you're asking?

Re: CEGUI events

Posted: Fri Jan 13, 2006 17:37
by SOMRoberto
I see elements position in Layout file, but not declaration. My code is good?

Re: CEGUI events

Posted: Fri Jan 13, 2006 19:48
by lindquist
It's possible to define elements and their sizes etc. entirely from xml layouts, yes. You'll need to load the layout it self in code, but it's easy.

You could consider joining the #cegui IRC channel on irc.freenode.net - at least I am find it a little hard to understand exactly what you mean.

Re: CEGUI events

Posted: Sat Jan 14, 2006 10:37
by SOMRoberto
Just take the singleton and etc on mouse click event:

if (mouse->GetLastButton(0)) //left mouse button
{
using namespace CEGUI;
WindowManager::getSingleton().getWindow("Demo7/Window1/Quit")->
subscribeEvent(PushButton::EventClicked, Event::Subscriber(&TTViewer::HandleQuit, this));
}

U can using this code in Crystal Space engine. ;)