Exemple #1
0
    //-----------------------------------------------------------------------
    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;

    }
Exemple #2
0
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;
}
Exemple #3
0
void HUD::multiplayer()
{
	OverlayManager& overlayManager = OverlayManager::getSingleton();

	// Create a panel
	OverlayContainer* panel = static_cast<OverlayContainer*>(
	overlayManager.createOverlayElement("Panel", "MultiplayerPanel"));
	panel->setMetricsMode(Ogre::GMM_PIXELS);
	panel->setPosition(20, 20);
	panel->setDimensions(200, 250);
	panel->setMaterialName("PanelAchtergrondImage"); // Optional background material

	// Create a text area
	m_textMessages = static_cast<TextAreaOverlayElement*>(
	overlayManager.createOverlayElement("TextArea", "MultiplayerTextArea"));

	m_textMessages->setMetricsMode(Ogre::GMM_PIXELS);
	m_textMessages->setPosition(10, 50);
	m_textMessages->setDimensions(150, 100);
	m_textMessages->setCaption("GoClient 0.1");
	m_textMessages->setCharHeight(16);
	m_textMessages->setFontName("ArialFont");
	m_textMessages->setColourBottom(ColourValue(0.6, 0.6, 0.6));
	m_textMessages->setColourTop(ColourValue(1, 1, 1));

	// Create an overlay, and add the panel
	m_overlay = overlayManager.create("MultiplayerOverlay");
	m_overlay->add2D(panel);

	// Add the text area to the panel
	panel->addChild(m_textMessages);

	// Show the overlay
	m_overlay->show();
}