Operating System: Win7 (64-bit) OS version/build: SP1
So I've got a UI class that wraps all my CEGUI stuff for me, and it has a member that holds a pointer to my GuiContext like this:
which gets assigned in my initialization code like this:
this->context = &CEGUI::System::getSingleton().createGUIContext(UserInterface::renderer->getDefaultRenderTarget()); this->context->setDefaultFont("DejaVuSans-10"); CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window* root = wmgr.createWindow("DefaultWindow"); this->context->setRootWindow(root);
later on I'm creating some StaticText controls and then updating their text, however if I assign an id of zero then getChild doesn't seem to find my StaticText control (it's not null... but everything inside of it appears to be default values rather than the values for my control from what I can tell... I'm still new to CEGUI so I'm not 100% sure of what I'm seeing). Anywho, if I use ID zero then getChild fails to return my control, but if I use any other number then it works just fine and the text updates as expected.
const int id = 0; //any other value besides zero works fine! CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton(); CEGUI::DefaultWindow* control = static_cast<CEGUI::DefaultWindow*>(wmgr.createWindow("TaharezLook/StaticText")); this->context->getRootWindow()->addChild(control); control->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, 0.0f), CEGUI::UDim(0.5f, 0.0f))); control->setSize(CEGUI::USize(CEGUI::UDim(0.1f, 0.0f), CEGUI::UDim(0.1f, 0.0f))); control->setText("test"); control->setID(id); control = nullptr; //just to be sure we're not using original pointer CEGUI::Window* controlFromGetChild = this->context->getRootWindow()->getChild(id); controlFromGetChild->setText("changed text");
I can work around this by just not using zero as an id, but thought I'd share incase anyone else stumbles on this. :)
Hope this helps, please let me know if you need any more info.
using CEGUI 0.8.7 with Visual Studio 2015 Update 3 (version 14.0.25431.01) and CEGUI's OpenGL renderer module.