本文整理汇总了C++中ogre::OverlayElement类的典型用法代码示例。如果您正苦于以下问题:C++ OverlayElement类的具体用法?C++ OverlayElement怎么用?C++ OverlayElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OverlayElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enter
void SplashScreenState::enter()
{
OgreFramework::getSingletonPtr()->m_pLog->logMessage("Entering SplashScreenState...");
m_pSceneMgr = OgreFramework::getSingletonPtr()->m_pRoot->createSceneManager(Ogre::ST_GENERIC, "SplashSceneMgr");
m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.7f, 0.7f, 0.7f));
m_pSceneMgr->addRenderQueueListener(OgreFramework::getSingletonPtr()->m_pOverlaySystem);
m_pCamera = m_pSceneMgr->createCamera("SplashCam");
m_pCamera->setPosition(Ogre::Vector3(0, 25, -50));
m_pCamera->lookAt(Ogre::Vector3(0, 0, 0));
m_pCamera->setNearClipDistance(1);
m_pCamera->setAspectRatio(Ogre::Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualWidth()) /
Ogre::Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualHeight()));
OgreFramework::getSingletonPtr()->m_pViewport->setCamera(m_pCamera);
createScene();
OgreFramework::getSingletonPtr()->m_pTrayMgr->destroyAllWidgets();
new ObjectCache(m_pSceneMgr);
Ogre::OverlayElement * btn = OgreFramework::getSingletonPtr()->m_pTrayMgr->createButton(OgreBites::TL_NONE, "SplashBtn", "Press Enter to continue...", 250)->getOverlayElement();
btn->setPosition(Ogre::Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualWidth()) * 50 / 100 - 125,
Ogre::Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualHeight()) * 75 / 100);
OgreFramework::getSingletonPtr()->m_pTrayMgr->hideCursor();
}
示例2:
GameplayScreen::~GameplayScreen()
{
//Destroy our game objects
delete mWhacker;
for(unsigned int i=0; i<mDragons.size(); i++)
{
delete mDragons[i];
}
//Destroy all entities created
Ogre::SceneManager* mSceneManager = Ogre::Root::getSingletonPtr()->getSceneManager("ApplicationSceneManager");
mSceneManager->destroyEntity("Stage");
//Remove the stage mesh
mStageNode->removeAndDestroyAllChildren();
mStageNode->getParentSceneNode()->removeAndDestroyChild(mStageNode->getName());
//Destroy our score overlay
//To do this, we must traverse all elements contained within
//the overlay and remove them one at a time.
Ogre::OverlayManager* overlayMgr = Ogre::OverlayManager::getSingletonPtr();
Ogre::Overlay::Overlay2DElementsIterator iter = mOverlay->get2DElementsIterator();
for(;iter.hasMoreElements();)
{
Ogre::OverlayContainer * childContainer = iter.getNext();
Ogre::OverlayContainer::ChildIterator contIter = childContainer->getChildIterator();
for(;contIter.hasMoreElements();)
{
Ogre::OverlayElement* curElement = contIter.getNext();
overlayMgr->destroyOverlayElement(curElement->getName());
}
overlayMgr->destroyOverlayElement(childContainer->getName());
}
overlayMgr->destroy(mOverlay->getName());
}
示例3: visitRecursivelyRenderablesFrom
void ResourceGroupReloader::visitRecursivelyRenderablesFrom(Ogre::OverlayContainer* pOverlayContainer, Ogre::Renderable::Visitor& pVisitor, bool debugRenderable)
{
// call on 'this'
pOverlayContainer->visitRenderables(&pVisitor,false);
// call on 'leaf' (cf composite pattern)
{
Ogre::OverlayContainer::ChildIterator childIter = pOverlayContainer->getChildIterator();
for(;childIter.hasMoreElements();)
{
Ogre::OverlayElement* lOverElem = childIter.getNext();
lOverElem->visitRenderables(&pVisitor,false);
}
}
// call on 'not-leaf' (cf composite pattern)
{
Ogre::OverlayContainer::ChildContainerIterator childContainerIter = pOverlayContainer->getChildContainerIterator();
for(;childContainerIter.hasMoreElements();)
{
Ogre::OverlayContainer * childContainer = childContainerIter.getNext();
visitRecursivelyRenderablesFrom(childContainer, pVisitor,debugRenderable);
}
}
}
示例4: showDialogue
void Menu::showDialogue(const std::string& first, const std::vector<std::string>& options)
{
Ogre::OverlayManager& om = Ogre::OverlayManager::getSingleton();
std::cout << "getByName(overlay)\n";
Ogre::Overlay* dialOverlay = om.getByName(cDialogueOverlay);
if (dialOverlay == NULL)
{
std::cout << "create(overlay)\n";
dialOverlay = om.create(cDialogueOverlay);
}
Ogre::OverlayContainer* dialCont = NULL;
std::cout << "getOE(Box)\n";
dialCont = static_cast<Ogre::OverlayContainer*> (om.getOverlayElement(cDialogueOverlay+"/Box"));
if (dialCont == NULL)
{
std::cout << "createOE(Box)\n";
dialCont = static_cast<Ogre::OverlayContainer*>
(om.createOverlayElement("Panel", cDialogueOverlay+"/Box"));
dialCont->setPosition(0.0, 0.75);
dialCont->setDimensions(1.0, 0.25);
dialCont->setMaterialName("Dusk/Dialogue/Black");
}
std::cout << "getOE(Box/First)\n";
Ogre::OverlayElement* dialElem;
dialElem = om.getOverlayElement(cDialogueOverlay+"/Box/First");
if (dialElem==NULL)
{
std::cout << "createOE(Box/First)\n";
dialElem = om.createOverlayElement("TextArea", cDialogueOverlay+"/Box/First");
dialElem->setDimensions(1.0, 0.0625);
dialElem->setPosition(0.0, 0.0);
dialElem->setMaterialName("Dusk/Dialogue/Element");
dialCont->addChild(dialElem);
}
dialElem->setCaption(first);
dialElem->show();
unsigned int elemCount = options.size();
if (elemCount > cMaxDialogueOptions)
{
elemCount = cMaxDialogueOptions;
}
killDialogueOverlayLines();
unsigned int i;
const float elemHeight = 0.8/(float)elemCount;
for (i=0; i<elemCount; i=i+1)
{
//dialElem = om.createOverlayElement("TextArea", cDialogueOverlay+"/Box/Line"+IntToString(i));
dialElem = om.createOverlayElementFromTemplate(cDialogueOverlay+"/LineTemplate", "TextArea", cDialogueOverlay+"/Box/Line"+IntToString(i));
dialElem->setPosition(0.1, dialCont->getHeight()*(0.2+i*elemHeight));
dialElem->setDimensions(0.8, elemHeight*dialCont->getHeight());
dialElem->setCaption(IntToString(i+1)+": "+options[i]);
dialElem->show();
dialCont->addChild(dialElem);
m_DialogueLineCount = i+1;
}//for
dialOverlay->show();
}
示例5: updateOverlayData
void PendulumTest::updateOverlayData(unsigned int trialNum)
{
Ogre::OverlayElement* trialElement =
Ogre::OverlayManager::getSingleton().getOverlayElement(
"Verve/TrialNumber/Trial");
trialElement->setCaption("Trial " +
Ogre::StringConverter::toString(trialNum));
}
示例6: processMessageBoxVisibilityChanged
void HUDInGame::processMessageBoxVisibilityChanged(MsgBoxVisibilityChangedEventPtr evt)
{
Ogre::OverlayElement* diamondPanel = Ogre::OverlayManager::getSingleton().getOverlayElement(PANEL_DIAMONDS);
if (evt->mVisible)
diamondPanel->hide();
else diamondPanel->show();
}
示例7: frameEnded
bool wxOgre::frameEnded(const Ogre::FrameEvent& evt)
{
static const wxString camPosCaption(wxT("CamPos:X:%06.3f, Y:%06.3f, Z:%06.3f"));
Ogre::OverlayElement* guiCurr = Ogre::OverlayManager::getSingleton().getOverlayElement("TextAreaOverlayElement");
Ogre::Vector3 camPos(mCamera->getRealPosition());
wxString camText(wxString::Format(camPosCaption, camPos.x, camPos.y, camPos.z));
guiCurr->setCaption(Ogre::String(camText.mb_str(wxConvUTF8)));
return true;
}
示例8: createChildPanel
void COverlay::createChildPanel(const std::string& name,
float left, float top, float width, float height,
const std::string& material)
{
assert( !_overlayManager->hasOverlayElement(name) && "Ya existe un elemento hijo con el mismo nombre" );
Ogre::OverlayElement* newChild =
createChildElement(TChildType::PANEL, name, left, top, width, height);
if(material.length() > 0)
newChild->setMaterialName(material);
_overlay->add2D( static_cast<Ogre::OverlayContainer*>(newChild) );
} //createChildPanel
示例9: createChildElement
Ogre::OverlayElement* COverlay::createChildElement(const std::string &type, const std::string& name,
float left, float top, float width, float height)
{
assert( !_overlayManager->hasOverlayElement(name) && "Ya existe un elemento hijo con el mismo nombre" );
Ogre::OverlayElement* newChild = _overlayManager->createOverlayElement(type, name);
newChild->setMetricsMode(_metricsMode);
newChild->setPosition(left, top); // segun metricsMode: relativas o en pixeles
newChild->setDimensions(width, height);
_childElements[name] = newChild;
return newChild;
} // createChildTextArea
示例10: SetText
void TextRenderer::SetText(const std::string &id, const char *fmt, /* args */ ...)
{
char text[256] = {'\0'};
va_list ap;
if (fmt)
{
va_start(ap, fmt);
vsprintf(text, fmt, ap);
va_end(ap);
}
Ogre::OverlayElement *textBox = m_overlayMgr->getOverlayElement(id);
textBox->setCaption(text);
}
示例11: updateOverlayInfo
void Application::updateOverlayInfo()
{
m_debug_1 = "";
m_debug_2 = "";
if (onSurface)
{
m_debug_1 = "On surface";
}
else
{
m_debug_1 = "On air";
last_hit_position = NxOgre::Vec3(0,0,0);
last_hit_normal = NxOgre::Vec3(0,0,0);
last_hit_sliding = NxOgre::Vec3(0,0,0);
angle_normal = 0;
}
m_debug_1 = m_debug_1 + " :: " + "P["
" " + Ogre::StringConverter::toString(last_hit_position.x) +
" " + Ogre::StringConverter::toString(last_hit_position.y) +
" " + Ogre::StringConverter::toString(last_hit_position.z) +
" " + "]" + " :: " + "N[" +
" " + Ogre::StringConverter::toString(last_hit_normal.x) +
" " + Ogre::StringConverter::toString(last_hit_normal.y) +
" " + Ogre::StringConverter::toString(last_hit_normal.z) +
" " + "]" + " :: " + "S[" +
" " + Ogre::StringConverter::toString(last_hit_sliding.x) +
" " + Ogre::StringConverter::toString(last_hit_sliding.y) +
" " + Ogre::StringConverter::toString(last_hit_sliding.z) +
" " + "]" + " :: " + "A[" +
" " + Ogre::StringConverter::toString(Ogre::Real(angle_normal)) +
" " + "]";
if (m_showInfo)
{
Ogre::OverlayElement* overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelFps");
overlay->setCaption("Current FPS: "+Ogre::StringConverter::toString(m_window->getLastFPS()));
overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelNTriangles");
overlay->setCaption("Triangle count: "+Ogre::StringConverter::toString(m_window->getTriangleCount()));
}
else
{
Ogre::OverlayElement* overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelFps");
overlay->setCaption(m_debug_2);
overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelNTriangles");
overlay->setCaption("");
}
if (m_showDebug)
{
Ogre::OverlayElement* overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelDebug");
overlay->setCaption(m_debug_1);
}
else
{
Ogre::OverlayElement* overlay_2 = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelDebug");
}
}
示例12:
void ResourceGroupReloader::UpdateMaterialRenderableVisitor::visit(
Ogre::Renderable *rend, Ogre::ushort lodIndex, bool isDebug, Ogre::Any *pAny)
{
const Ogre::MaterialPtr mat = rend->getMaterial();
if(!mat.isNull())
{
std::string newMatName = mat->getName();
Ogre::MaterialPtr newMat = Ogre::MaterialManager::getSingleton().getByName(newMatName);
if(newMat.isNull())
{
// this can happen if there was error during the reloading of the material.
// in that case, we keep the ancient one.
// Ice::Log::Instance().LogMessage(newMatName+" : new material is null!");
return;
}
// unfortunately, the renderable gives access only to a const MaterialPtr.
// and there is no 'setMaterial' or 'setMaterialName' method on renderables.
// so I have to try to down cast with known classes...
{
Ogre::SubEntity* lRend = dynamic_cast<Ogre::SubEntity*>(rend);
if(lRend){lRend->setMaterialName(newMatName);return;}
}
{
Ogre::SimpleRenderable* lRend = dynamic_cast<Ogre::SimpleRenderable*>(rend);
if(lRend){lRend->setMaterial(newMatName);return;}
}
{
Ogre::ShadowRenderable* lRend = dynamic_cast<Ogre::ShadowRenderable*>(rend);
if(lRend){lRend->setMaterial(newMat);return;}
}
{
Ogre::BillboardChain* lRend = dynamic_cast<Ogre::BillboardChain*>(rend);
if(lRend){lRend->setMaterialName(newMatName);return;}
}
{
Ogre::BillboardSet* lRend = dynamic_cast<Ogre::BillboardSet*>(rend);
if(lRend){lRend->setMaterialName(newMatName);return;}
}
{
Ogre::OverlayElement* lRend = dynamic_cast<Ogre::OverlayElement*>(rend);
if(lRend){lRend->setMaterialName(newMatName);return;}
}
}else{
// was there for debug...
// Ice::Log::Instance().LogMessage("material of renderable is null!");
}
}
示例13: catch
bool
COgreDebugOverlay::frameEnded( const Ogre::FrameEvent& evt )
{GUCE_TRACE;
if ( NULL != m_debugOverlay )
{
static Ogre::String currFps = "Current FPS: ";
static Ogre::String avgFps = "Average FPS: ";
static Ogre::String bestFps = "Best FPS: ";
static Ogre::String worstFps = "Worst FPS: ";
static Ogre::String tris = "Triangle Count: ";
// update stats when necessary
try
{
Ogre::OverlayElement* guiAvg = m_overlayManager->getOverlayElement( "Core/AverageFps" );
Ogre::OverlayElement* guiCurr = m_overlayManager->getOverlayElement( "Core/CurrFps" );
Ogre::OverlayElement* guiBest = m_overlayManager->getOverlayElement( "Core/BestFps" );
Ogre::OverlayElement* guiWorst = m_overlayManager->getOverlayElement( "Core/WorstFps" );
const Ogre::RenderTarget::FrameStats& stats = m_window->GetOgreWindowPtr()->getStatistics();
guiAvg->setCaption( avgFps + Ogre::StringConverter::toString( stats.avgFPS ) );
guiCurr->setCaption( currFps + Ogre::StringConverter::toString( stats.lastFPS ) );
guiBest->setCaption( bestFps + Ogre::StringConverter::toString( stats.bestFPS )
+" "+Ogre::StringConverter::toString(stats.bestFrameTime)+" ms");
guiWorst->setCaption(worstFps + Ogre::StringConverter::toString(stats.worstFPS )
+" "+Ogre::StringConverter::toString(stats.worstFrameTime)+" ms");
Ogre::OverlayElement* guiTris = m_overlayManager->getOverlayElement( "Core/NumTris" );
guiTris->setCaption( tris + Ogre::StringConverter::toString( stats.triangleCount ) );
//Ogre::OverlayElement* guiDbg = m_overlayManager->getOverlayElement( "Core/DebugText" );
//guiDbg->setCaption( m_window->GetOgreWindowPtr()->getDebugText() );
}
catch( Ogre::Exception& )
{
// ignore
}
}
return true;
}
示例14: game
Display::Display(Game * game) :
game(game),
overlay(overlayMgr()->getByName(OVERLAY_NAME)),
infoBar(overlay->getChild(INFO_BAR_NAME)),
levelTextBox(getTextArea(LEVEL_TEXT_BOX_NAME, infoBar)),
distanceTextBox(getTextArea(DISTANCE_TEXT_BOX_NAME, infoBar)),
statsPanel(overlay->getChild(STATS_PANEL_NAME)),
positionTextBox(getTextArea(POSITION_TEXT_BOX_NAME)),
velocityTextBox(getTextArea(VELOCITY_TEXT_BOX_NAME)),
pitchRollYawTextBox(getTextArea(PITCH_ROLL_YAW_TEXT_BOX_NAME)),
thrustTextBox(getTextArea(THRUST_TEXT_BOX_NAME)),
speedTextBox(getTextArea(SPEED_TEXT_BOX_NAME)),
aoaTextBox(getTextArea(AOA_TEXT_BOX_NAME)) {
Ogre::OverlayElement * elt = overlayMgr()->getOverlayElement(TEXT_BOX_TEMPLATE_NAME, true);
normalValueColor = elt->getColour();
elt = overlayMgr()->getOverlayElement(MAXED_TEXT_BOX_TEMPLATE_NAME, true);
maxedValueColor = elt->getColour();
}
示例15: AddTextBox
void TextRenderer::AddTextBox(const std::string &id,
const std::string &text,
Ogre::Real x, Ogre::Real y,
Ogre::Real width, Ogre::Real height,
const Ogre::ColourValue &color)
{
Ogre::OverlayElement *textBox = m_overlayMgr->createOverlayElement("TextArea", id);
textBox->setDimensions(width, height);
textBox->setMetricsMode(Ogre::GMM_PIXELS);
textBox->setPosition(x, y);
textBox->setWidth(width);
textBox->setHeight(height);
textBox->setParameter("font_name", "DebugFont");
textBox->setParameter("char_height", "16");
textBox->setColour(color);
textBox->setCaption(text);
m_panel->addChild(textBox);
}