Crystal Space
Welcome, Guest. Please login or register.
July 30, 2014, 02:12:20 am

Login with username, password and session length
Search:     Advanced search
9005 Posts in 2043 Topics by 8255 Members
Latest Member: Mslenacarleen0303
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  CEGUI events
« previous next »
Pages: [1] Print
Author Topic: CEGUI events  (Read 2980 times)
[SOM]Roberto
Jr. Member
**
Posts: 79


View Profile Email
« on: January 13, 2006, 06:58:21 pm »

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:efault);
CEGUI::WindowManager* winMgr = cegui->GetWindowManagerPtr ();
cegui->GetSystemPtr ()->setGUISheet(winMgr->loadWindowLayout("ice.layout");
....

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

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

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

csRef<iEventQueue> q =
        CS_QUERY_REGISTRY(GetObjectRegistry(), iEventQueue);
    if (q.IsValid()) q->GetEventOutlet()->Broadcast(csevQuit(GetObjectRegistry()));

return true;
}
« Last Edit: January 13, 2006, 07:00:22 pm by [SOM]Roberto » Logged
[SOM]Roberto
Jr. Member
**
Posts: 79


View Profile Email
« Reply #1 on: January 14, 2006, 11:31:33 am »

Ok Just take the singleton etc on mouse click event and the cegui elemets are running:

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

Thx for helping people. Cheesy
Logged
muffinpeddler
Full Member
***
Posts: 122


View Profile Email
« Reply #2 on: January 17, 2006, 07:39:10 pm »

I was under the impression you shouldn't use the singleton methods from CEGUI due to the static variables across the modules not being shared.  Check out the docs: http://crystalspace3d.org/docs/online/manual/cs_4.21.php#4.21
Logged
[SOM]Roberto
Jr. Member
**
Posts: 79


View Profile Email
« Reply #3 on: January 18, 2006, 02:31:56 pm »

I was under the impression you shouldn't use the singleton methods from CEGUI due to the static variables across the modules not being shared.  Check out the docs: http://crystalspace3d.org/docs/online/manual/cs_4.21.php#4.21

I using this code, all my CEGUI events perfetcly...
Logged
muffinpeddler
Full Member
***
Posts: 122


View Profile Email
« Reply #4 on: January 20, 2006, 08:52:03 am »

Just not good practice?
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.082 seconds with 15 queries.