Im trying to create a debug window that will contain alot of my Debug
information. FPS, IP adress, number of poly's ETC.
Im using the ogre3d graphics engine btw.
I can initialize CEGUI fine:
Code: Select all
void game4::InitializeCEGUI()
{
//create CEGUI
mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
mGUISystem = new CEGUI::System(mGUIRenderer);
//Set Logging
CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);
//CEGUI settings
CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
mGUISystem->setDefaultFont((CEGUI::utf8*)"BlueHighway-12");
mEditorGuiSheet= CEGUI::WindowManager::getSingleton().createWindow((CEGUI::utf8*)"DefaultWindow", (CEGUI::utf8*)"Sheet");
mGUISystem->setGUISheet(mEditorGuiSheet);
//Setup mouse
mGUISystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseMoveCursor");
unsigned int WindowWidth = Ogre::StringConverter::parseUnsignedInt(settings["width"].data());
unsigned int WindowHeight = Ogre::StringConverter::parseUnsignedInt(settings["height"].data());
CEGUI::MouseCursor::getSingleton().setPosition(CEGUI::Point(
(mWindow->getWidth() / 2) - 16,
(mWindow->getHeight() / 2) - 16)
);
//Create button
quitButton = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Button", (CEGUI::utf8*)"HP");
mEditorGuiSheet->addChildWindow(quitButton);
quitButton->setPosition( CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));
quitButton->setSize( CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));
quitButton->setText("Click Here To See Your HP");
//Register for events
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
wmgr.getWindow((CEGUI::utf8*)"HP")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&game4::GUIButtonPressed, this));
}
and i can create my debug window fine:
Code: Select all
void game4::UseDebugWindow()
{
DebugWindow = (CEGUI::Window*) CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/FrameWindow", (CEGUI::utf8*)"Debug");
mEditorGuiSheet->addChildWindow(DebugWindow);
DebugWindow->setPosition( CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.25f)));
DebugWindow->setSize( CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));
DebugWindow->setText("Debug Window");
DebugListBox = (CEGUI::Listbox*) CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Listbox", (CEGUI::utf8*)"Listbox");
DebugListBox->setPosition(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));
DebugListBox->setSize( CEGUI::UVector2(cegui_reldim(0.8f), cegui_reldim( 0.8f)));
DebugListBox->setText("DebugListBox setText");
DebugListBox->setShowVertScrollbar(true);
DebugTime = new CEGUI::ListboxTextItem("TEST TEXT");
DebugListBox->addItem(DebugTime);
DebugFPS = new CEGUI::ListboxTextItem("TEST TEXT2");
DebugListBox->addItem(DebugFPS);
DebugWindow->addChildWindow(DebugListBox);
}
the problem comes when i try to update my elements in my debug window:
Code: Select all
void game4::UpdateDebugWindow(float _time)
{
cout << "UpdateDebugWindow is being called" << endl;
static float time = 0;
time+=_time;
DebugTime->setText("Time: " + Ogre::StringConverter::toString(time));
DebugFPS->setText("FPS: " + Ogre::StringConverter::toString( mWindow->getLastFPS() ));
DebugWindow->update(_time);
DebugListBox->update(_time);
}
The information only updates when i click each item individually. I believe i am injecting inputs properly.
And i have been putting these lines everywhere to try to fix my problem:
DebugWindow->update(_time);
DebugListBox->update(_time);
Why isnt my info updating? Im pretty sure that the update function is being called every frame.
I apologize for the long post. Thx to all who help in advance =)