本文整理汇总了C++中OverlayContainer::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ OverlayContainer::setPosition方法的具体用法?C++ OverlayContainer::setPosition怎么用?C++ OverlayContainer::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OverlayContainer
的用法示例。
在下文中一共展示了OverlayContainer::setPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createOverlay
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;
}
示例2: multiplayer
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();
}
示例3: createScene
void Splash::createScene()
{
log("[Loading] Creating the splash screen...");
// Loading picture
overlayManager = &OverlayManager::getSingleton();
overlay = overlayManager->create("LoadingOverlay");
((MaterialPtr)MaterialManager::getSingleton().create("LoadingMaterial","splash"))->getTechnique(0)->getPass(0)->createTextureUnitState("loading.png");
OverlayContainer* panel = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","LoadingPanel"));
panel->setMaterialName("LoadingMaterial");
panel->setDimensions(1,0.96f);
// Progess bar
OverlayContainer* progressBar = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","ProgressBar"));
progressBar->setDimensions(1,0.04f);
progressBar->setPosition(0,0.96f);
MaterialPtr progressBGMat = MaterialManager::getSingleton().create("progressBG","splash");
progressBGMat->getTechnique(0)->getPass(0)->createTextureUnitState()->setColourOperationEx(LBX_SOURCE1,LBS_MANUAL,LBS_CURRENT,ColourValue(0.9f, 0.9f, 0.9f));;
MaterialPtr progressFGMat = MaterialManager::getSingleton().create("progressFG","splash");
progressFGMat->getTechnique(0)->getPass(0)->createTextureUnitState()->setColourOperationEx(LBX_SOURCE1,LBS_MANUAL,LBS_CURRENT,ColourValue(0.23f, 0.88f, 0.5f));;
progressBG = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","ProgressBarBG"));
progressBG->setMaterialName("progressBG");
progressBG->setDimensions(1,1);
progressFG = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","ProgressBarFG"));
progressFG->setMaterialName("progressFG");
progressFG->setDimensions(0,1);
// Loading text
FontManager::getSingleton().getByName("BlueHighway")->load(); // HACK: Workaround for bug #324 in Ogre
progressText = static_cast<TextAreaOverlayElement*>(overlayManager->createOverlayElement("TextArea", "text"));
progressText->setMetricsMode(GuiMetricsMode::GMM_RELATIVE);
progressText->setLeft(0.01f);
progressText->setTop(0.01f);
progressText->setHorizontalAlignment(GHA_LEFT);
progressText->setVerticalAlignment(GVA_TOP);
progressText->setFontName("BlueHighway");
progressText->setCharHeight(0.03f);
progressText->setColour(Ogre::ColourValue(0,0,0));
progressBar->addChild(progressBG);
progressBar->addChild(progressFG);
progressBar->addChild(progressText);
overlay->add2D(panel);
overlay->add2D(progressBar);
overlay->show();
}