Hi!
Thanks you very much, now CEGUI detects events well
.
But, I have another problem :-S. That is, I create one button with CEGUI, that when I am playing and I press de 'P' key in order to pause the scene and give control events to Cegui, the button displays on screen and it is waiting for the mouse event (click). When I click on it, the control of events is passed to input (i can play again), but the CEGUI button doesn't delete from screen.
When I trying to delete the CEGUI object, I receive segmentation fault. How can I do that?
Here is the code of the constructor:
Code: Select all
Cegui::Cegui(Ogre::SceneManager *manager) {
Ogre::RenderWindow *window = Ogre::Root::getSingleton().getAutoCreatedWindow();
renderer = new CEGUI::OgreCEGUIRenderer(window, Ogre::RENDER_QUEUE_OVERLAY, false, 0, manager);
system = new CEGUI::System(renderer);
// Default skin
CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
system->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
CEGUI::MouseCursor::getSingleton().setImage(CEGUI::System::getSingleton().getDefaultMouseCursor());
system->setDefaultFont((CEGUI::utf8*)"BlueHighway-12");
}
Here, to create a button:
Code: Select all
void Cegui::menu(Scene *scene) {
CEGUI::WindowManager *window = CEGUI::WindowManager::getSingletonPtr();
//CEGUI::Window *menu = window->loadWindowLayout((CEGUI::utf8*)"ogregui.layout");
CEGUI::Window *menu = window->createWindow("DefaultGUISheet", "CEGUI/Menu");
CEGUI::Window *quit = window->createWindow("TaharezLook/Button", "CEGUI/Menu/QuitButton");
quit->setText("PAUSE");
quit->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(0.10, 0)));
menu->addChildWindow(quit);
system->setGUISheet(menu);
scenePointer = scene;
input::Input::getInstance()->setListeners(this, this); //Cegui is now listening
quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Cegui::close, this));
}
And here, destructor:
Code: Select all
Cegui::~Cegui(void) {
delete renderer;
delete system;
}
Thanks again
.