OverlayContainer* MenuSheet::createOverlay(int id, const std::string& text, int x, int y, int w, int h) { std::string ovname = mName + "/" + Ogre::StringConverter::toString(id); OverlayContainer* ov; if (text.empty()) ov = static_cast<OverlayContainer*>(OverlayManager::getSingleton().createOverlayElement("Panel", ovname)); else ov = static_cast<OverlayContainer*>(OverlayManager::getSingleton().createOverlayElement("TextArea", ovname)); ov->setMetricsMode(GMM_PIXELS); // text area centered around X point, so we create it with w/2 surplus if (text.empty()) ov->setPosition(x, y); else ov->setPosition(x + w/2, y); ov->setDimensions(w, h); ov->setCaption(text); ov->setParameter("font_name", mFont); ov->setParameter("char_height", StringConverter::toString(mFontSize)); ov->setParameter("alignment", "center"); ov->show(); mOverlay->add2D(ov); return ov; }
//----------------------------------------------------------------------- OverlayContainer* Profiler::createContainer() { OverlayContainer* container = (OverlayContainer*) OverlayManager::getSingleton().createOverlayElement( "BorderPanel", "profiler"); container->setMetricsMode(GMM_PIXELS); container->setMaterialName("Core/StatsBlockCenter"); container->setHeight(mGuiHeight); container->setWidth(mGuiWidth * 2 + 15); container->setParameter("border_size", "1 1 1 1"); container->setParameter("border_material", "Core/StatsBlockBorder"); container->setParameter("border_topleft_uv", "0.0000 1.0000 0.0039 0.9961"); container->setParameter("border_top_uv", "0.0039 1.0000 0.9961 0.9961"); container->setParameter("border_topright_uv", "0.9961 1.0000 1.0000 0.9961"); container->setParameter("border_left_uv","0.0000 0.9961 0.0039 0.0039"); container->setParameter("border_right_uv","0.9961 0.9961 1.0000 0.0039"); container->setParameter("border_bottomleft_uv","0.0000 0.0039 0.0039 0.0000"); container->setParameter("border_bottom_uv","0.0039 0.0039 0.9961 0.0000"); container->setParameter("border_bottomright_uv","0.9961 0.0039 1.0000 0.0000"); container->setLeft(5); container->setTop(5); return container; }