Yes Kevin was that the problem thanks alot mate
But now i have another problem :S in the tutorials and exemples i only found code that we can interact with buttons loading an existing overlay, if i want to add a quit default button i must load an overlay file or i can create a new button like i did with the FrameWindow?
Here is the code i have until now:
Constructor:
Code: Select all
cGUIInterface::cGUIInterface(cGraphicalInterface *graphicalInterface)
{
// setup GUI system
mGraphInterface = graphicalInterface;
mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mGraphInterface->getWindow() , Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mGraphInterface->getSceneManager());
mGUISystem = new CEGUI::System(mGUIRenderer);
CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);
winMgr = &CEGUI::WindowManager::getSingleton();
root = (DefaultWindow*)winMgr->createWindow("DefaultWindow", "Root");
CEGUI::System::getSingleton().setGUISheet(root);
vendorWindow = 0;
}
Other functions needed for this example:
Code: Select all
CEGUI::MouseButton cGUIInterface::convertOISMouseButtonToCegui(int buttonID)
{
switch (buttonID)
{
case 0: return CEGUI::LeftButton;
case 1: return CEGUI::RightButton;
case 2: return CEGUI::MiddleButton;
case 3: return CEGUI::X1Button;
default: return CEGUI::LeftButton;
}
}
Code: Select all
bool cGUIInterface::handleQuit(const CEGUI::EventArgs& e)
{
if (vendorWindow)
CEGUI::WindowManager::getSingleton().destroyWindow(vendorWindow);
return true;
}
Vendor Menu window where i want to put the button to buy or sell:
Code: Select all
void cGUIInterface::vendorMenu()
{
//CEGUI::SchemeManager::getSingleton().unloadAllSchemes();
//loadScheme("TaharezLookSkin.scheme");
//CEGUI::FontManager::getSingleton().createFont("Commonwealth-10.font");
//CEGUI::WidgetLookManager::getSingleton().parseLookNFeelSpecification("TaharezLook.looknfeel");
if (vendorWindow)
CEGUI::WindowManager::getSingleton().destroyWindow(vendorWindow);
vendorWindow = (FrameWindow*)CEGUI::WindowManager::getSingleton().createWindow((CEGUI::utf8*)"TaharezLook/FrameWindow", (CEGUI::utf8*)"Window");
root->addChildWindow(vendorWindow);
mGUISystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
vendorWindow->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.25f)));
vendorWindow->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));
vendorWindow->setMaxSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f)));
vendorWindow->setMinSize(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));
vendorWindow->setText("Weapons Vendor");
CEGUI::PushButton* pQuitButton = (CEGUI::PushButton *)CEGUI::WindowManager::getSingleton().getWindow("DefaultWindow");
pQuitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&cGUIInterface::handleQuit, this));
//winMgr->getWindow((CEGUI::utf8*)"TaharezLook/Button")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&cGUIInterface::handleQuit, this));
}
Here is the log error:
Code: Select all
14/08/2008 01:36:28 (Error) CEGUI::UnknownObjectException in file \Projects\CEGUI\cegui_mk2-v0-6-2003\src\CEGUIWindowManager.cpp(180) : WindowManager::getWindow - A Window object with the name 'DefaultWindow' does not exist within the system
But the default window is beeing created in the contructor :S
or all this things it seems to be easier to load Windows and buttons from a overlay file created previously.
What you advice? What is the best way? Create de windows and buttons or load them from a overlay?
Thanks in advance!