本文整理汇总了C++中ogre::Overlay类的典型用法代码示例。如果您正苦于以下问题:C++ Overlay类的具体用法?C++ Overlay怎么用?C++ Overlay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Overlay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleInput
void PendulumTest::handleInput(opal::real elapsedRealTime,
const SimulationEngine& engine)
{
OIS::Keyboard* keyboard = engine.getKeyboard();
// This variable can be used to keep keys from repeating too fast.
static Ogre::Real toggleTimer = 0;
if (toggleTimer >= 0)
{
toggleTimer -= elapsedRealTime;
}
// Toggle GUI.
if (keyboard->isKeyDown(OIS::KC_G) && toggleTimer <= 0)
{
Ogre::Overlay* debugOverlay = Ogre::OverlayManager::getSingleton().
getByName("Verve/TrialNumber");
if (debugOverlay->isVisible())
{
debugOverlay->hide();
mAgentDebugger->setDisplayEnabled(false);
}
else
{
debugOverlay->show();
mAgentDebugger->setDisplayEnabled(true);
}
toggleTimer = 0.5;
}
}
示例2: createOverlay
// create overlay uv test
void Test::createOverlay(void)
{
// load the fade
mFader = 0;
Ogre::MaterialPtr mFaderMaterial;
Ogre::TextureUnitState *mTexture = 0;
Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
mFader = static_cast<Ogre::PanelOverlayElement*>(
overlayManager.createOverlayElement("Panel", "Fader"));
mFader->setMetricsMode(Ogre::GMM_RELATIVE);
mFader->setPosition(0, 0);
mFader->setDimensions(0.25f, 0.25f);
mFader->setMaterialName("BotonTest"); // Optional background material
// Ensures that the material exists
mFader->setUV(0,0,0.5,1);
// show the fade
mFader->show();
// Create an overlay, and add the panel
Ogre::Overlay *mOverlay = 0;
mOverlay = overlayManager.create("FaderOverlay");
mOverlay->add2D(mFader);
mOverlay->show();
}
示例3: createTextArea
// Create text area for SkyX parameters
void createTextArea()
{
// Create a panel
Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(
OverlayManager::getSingleton().createOverlayElement("Panel", "SkyXParametersPanel"));
panel->setMetricsMode(Ogre::GMM_PIXELS);
panel->setPosition(10, 10);
panel->setDimensions(400, 400);
// Create a text area
mTextArea = static_cast<Ogre::TextAreaOverlayElement*>(
OverlayManager::getSingleton().createOverlayElement("TextArea", "SkyXParametersTextArea"));
mTextArea->setMetricsMode(Ogre::GMM_PIXELS);
mTextArea->setPosition(0, 0);
mTextArea->setDimensions(100, 100);
mTextArea->setCaption("SkyX plugin demo");
mTextArea->setCharHeight(16);
mTextArea->setFontName("BlueHighway");
mTextArea->setColourBottom(ColourValue(0.3, 0.5, 0.3));
mTextArea->setColourTop(ColourValue(0.5, 0.7, 0.5));
// Create an overlay, and add the panel
Ogre::Overlay* overlay = OverlayManager::getSingleton().create("OverlayName");
overlay->add2D(panel);
// Add the text area to the panel
panel->addChild(mTextArea);
// Show the overlay
overlay->show();
}
示例4: showDebugOverlay
void FrameListener::showDebugOverlay(bool show) {
Ogre::Overlay *overlay = Ogre::OverlayManager::getSingleton().getByName("Core/DebugOverlay");
if (show)
overlay->show();
else
overlay->hide();
}
示例5: setVisible
void setVisible(bool bShow) {
if (bShow) {
m_pOverlay->show();
}
else {
m_pOverlay->hide();
}
}
示例6: createScene
void OgreApp::createScene()
{
sceneMgr->setSkyBox(true, "Sky", 5, 8, 4000);
sceneMgr->setAmbientLight(ColourValue(0.5f, 0.5f, 0.5f));
sceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
node = sceneMgr->getRootSceneNode()->createChildSceneNode("OgreHead");
ent = sceneMgr->createEntity("Ogre", "ogrehead.mesh");
node->attachObject(ent);
node->setPosition(0, 50, 0);
OgreAL::Sound *bgSound = soundManager->createSound("5.1 Test", "6chan.ogg", true);
bgSound->setGain(2);
bgSound->setRelativeToListener(true);
bgSound->play();
node = sceneMgr->getRootSceneNode()->createChildSceneNode("CameraNode");
node->setPosition(0, 100, 100);
node = node->createChildSceneNode("PitchNode");
node->attachObject(camera);
node->attachObject(soundManager->getListener());
node->pitch(Ogre::Degree(-30));
// Create a ground plane
Plane plane(Vector3::UNIT_Y, 0);
MeshManager::getSingleton().createPlane("ground",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
15000,15000,20,20,true,1,5,5,Vector3::UNIT_Z);
ent = sceneMgr->createEntity("GroundEntity", "ground");
sceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
ent->setMaterialName("Ground");
ent->setCastShadows(false);
light = sceneMgr->createLight("sun");
light->setType(Light::LT_DIRECTIONAL);
light->setDirection(-1,-1,-1);
OverlayManager& overlayMgr = OverlayManager::getSingleton();
Ogre::OverlayContainer* panel = static_cast<OverlayContainer*>(
overlayMgr.createOverlayElement("Panel", "PanelName"));
panel->setMetricsMode(Ogre::GMM_PIXELS);
panel->setPosition(10, 10);
panel->setDimensions(100, 100);
TextAreaOverlayElement* textArea = static_cast<TextAreaOverlayElement*>(
overlayMgr.createOverlayElement("TextArea", "TextAreaName"));
textArea->setMetricsMode(Ogre::GMM_PIXELS);
textArea->setPosition(0, 0);
textArea->setDimensions(100, 100);
textArea->setCharHeight(16);
textArea->setFontName("Arial");
textArea->setCaption("Hello, World!");
Ogre::Overlay* overlay = overlayMgr.create("AverageFps");
overlay->add2D(panel);
panel->addChild(textArea);
overlay->show();
}
示例7: 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();
}
示例8: Init
void cStateEndRun::Init(){
printf("cStateMenu: Init\n");
MenuSet[0] = "MenuOpt1";
MenuSet[1] = "MenuOpt2";
MenuSet[2] = "MenuOpt3";
MenuSet[3] = "MenuOpt4";
MenuSet[4] = "MenuOpt5";
m_pOverlayMgr = Ogre::OverlayManager::getSingletonPtr();
//m_pProgLPanel = static_cast<Ogre::OverlayContainer*>(m_pOverlayMgr->createOverlayElement("Panel","ProgLPanel"));
//m_pProgLPanel->setMetricsMode(Ogre::GMM_PIXELS);
//m_pProgLPanel->setPosition(10, 10);
//m_pProgLPanel->setDimensions(32, 32);
//m_pProgLPanel->setMaterialName( "Programs/Crash" );
//m_pProgRPanel = static_cast<Ogre::OverlayContainer*>(m_pOverlayMgr->createOverlayElement("Panel","ProgRPanel"));
//m_pProgRPanel->setMetricsMode(Ogre::GMM_PIXELS);
//m_pProgRPanel->setPosition(900, 10);
//m_pProgRPanel->setDimensions(32, 32);
//m_pProgRPanel->setMaterialName( "Programs/Validate" );
m_pMenuPanel = static_cast<Ogre::OverlayContainer*>(m_pOverlayMgr->createOverlayElement("Panel","MenuP"));
m_pMenuPanel->setMetricsMode(Ogre::GMM_PIXELS);
m_pMenuPanel->setPosition(400, 200);
m_pMenuPanel->setDimensions(200, 200);
m_pMenuPanel->setMaterialName( "BaseWhite" );
TextRenderer::getSingleton().addLTextBox( MenuSet[0], "MenuP", "Controls", 10, 10, 100, 40, Ogre::ColourValue::Red);
TextRenderer::getSingleton().addLTextBox( MenuSet[1], "MenuP", "Video", 10, 50, 100, 40, Ogre::ColourValue::Black);
TextRenderer::getSingleton().addLTextBox( MenuSet[2], "MenuP", "Audio", 10, 90, 100, 40, Ogre::ColourValue::Black);
TextRenderer::getSingleton().addLTextBox( MenuSet[3], "MenuP", "OPP", 10, 130, 100, 40, Ogre::ColourValue::Black);
TextRenderer::getSingleton().addLTextBox( MenuSet[4], "MenuP", "About", 10, 170, 100, 40, Ogre::ColourValue::Black);
m_pDeckPanel = static_cast<Ogre::OverlayContainer*>(m_pOverlayMgr->createOverlayElement("Panel","DeckP"));
m_pDeckPanel->setMetricsMode(Ogre::GMM_PIXELS);
m_pDeckPanel->setPosition(500, 300);
m_pDeckPanel->setDimensions(400, 400);
m_pDeckPanel->setMaterialName( "BaseWhite" );
m_pActionPanel = static_cast<Ogre::OverlayContainer*>(m_pOverlayMgr->createOverlayElement("Panel","ActionP"));
m_pActionPanel->setMetricsMode(Ogre::GMM_PIXELS);
m_pActionPanel->setPosition(300, 200);
m_pActionPanel->setDimensions(200, 400);
m_pActionPanel->setMaterialName( "BaseWhite" );
Ogre::Overlay* overlay = m_pOverlayMgr->getByName("overlay1");
overlay->add2D(m_pMenuPanel);
overlay->add2D(m_pDeckPanel);
overlay->add2D(m_pActionPanel);
if(m_pMenuPanel->isVisible() == true) m_pMenuPanel->hide();
if(m_pDeckPanel->isVisible() == true) m_pDeckPanel->hide();
if(m_pActionPanel->isVisible() == true) m_pActionPanel->hide();
//m_pMainPanel->addChild(m_pProgLPanel);
//m_pMainPanel->addChild(m_pProgRPanel);
//TextRenderer::getSingleton().addTextBox("txtGreeting", "container1", "Hello", 10, 10, 100, 20, Ogre::ColourValue::Green);
}
示例9: createOverlay
void MenuState::createOverlay()
{
unsigned int width, height, depth;
int left, top;
Ogre::Overlay *overlay = _overlayManager->getByName("Menu");
_root->getAutoCreatedWindow()->getMetrics(width, height, depth, left, top);
overlay->setScale(((float(width) / 100) / 1024) * 100, ((float(height) / 100) / 768) * 100);
overlay->show();
// _fader->startFadeIn(0);
}
示例10: hideDialogue
void Menu::hideDialogue()
{
Ogre::OverlayManager* olMgr =Ogre::OverlayManager::getSingletonPtr();
/*If overlay manager is NULL, then it is not present any more and all overlays
should already be destroyed at that point. So we can return anyway. */
if (olMgr==NULL) return;
Ogre::Overlay* ol = olMgr->getByName(cDialogueOverlay);
if (ol!=NULL)
{
ol->hide();
}
}
示例11: exit
void MenuState::exit ()
{
// delete _fader;
// musica del menu STOP
IntroState::getSingleton().getMenuTrackPtr()->stop();
CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().hide();
CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->hide();
Ogre::Overlay *overlay = _overlayManager->getByName("Menu");
overlay->hide();
_sceneMgr->clearScene();
_root->getAutoCreatedWindow()->removeAllViewports();
}
示例12: updateOnEveryRenderable
void ResourceGroupReloader::updateOnEveryRenderable()
{
//1/ get all the available object type (entity, light, user defined types ...)
std::vector<std::string> allAvailableTypes;
Ogre::Root::MovableObjectFactoryIterator iterFactory = Ogre::Root::getSingleton().getMovableObjectFactoryIterator();
for(;iterFactory.hasMoreElements();)
{
Ogre::MovableObjectFactory* factory = iterFactory.getNext();
allAvailableTypes.push_back(factory->getType());
}
UpdateMaterialRenderableVisitor lRenderableVisitor;
//2/ for each scene manager, lets visit renderables!
// unfortunately that does not cover all renderables type... (overlays...)
Ogre::SceneManagerEnumerator::SceneManagerIterator iterSceneManager = Ogre::Root::getSingleton().getSceneManagerIterator();
for(;iterSceneManager.hasMoreElements();)
{
Ogre::SceneManager * scMgr = iterSceneManager.getNext();
std::vector<std::string>::iterator iterMovableType = allAvailableTypes.begin();
std::vector<std::string>::iterator iterMovableTypeEnd = allAvailableTypes.end();
for(;iterMovableType!=iterMovableTypeEnd;iterMovableType++)
{
Ogre::SceneManager::MovableObjectIterator iterMovable = scMgr->getMovableObjectIterator(*iterMovableType);
for(;iterMovable.hasMoreElements();)
{
Ogre::MovableObject * movable = iterMovable.getNext();
movable->visitRenderables(&lRenderableVisitor,false);
}
}
}
// 3 / visit overlays!
{
Ogre::OverlayManager::OverlayMapIterator iterOverlay = Ogre::OverlayManager::getSingleton().getOverlayIterator();
for(;iterOverlay.hasMoreElements();)
{
Ogre::Overlay* lOverlay = iterOverlay.getNext();
// get the first level of OverlayContainer in the Overlay
Ogre::Overlay::Overlay2DElementsIterator iterOverlayElem = lOverlay->get2DElementsIterator();
for(;iterOverlayElem.hasMoreElements();)
{
Ogre::OverlayContainer * lOverlayCont = iterOverlayElem.getNext();
visitRecursivelyRenderablesFrom(lOverlayCont,lRenderableVisitor, false);
}
}
}
}
示例13: createGui
void Gui::createGui(Ogre::SceneManager* p_scene_manager, OgreBites::SdkTrayManager* p_tray_manager){
m_tray_manager = p_tray_manager;
m_button = m_tray_manager->createButton(OgreBites::TL_TOPLEFT, "MyButton", "Click me!");
if(m_button->getName() == "MyButton"){
int p = 0;
}
// Load layout
Ogre::ResourceGroupManager::getSingletonPtr();
Ogre::OverlayManager* mg = Ogre::OverlayManager::getSingletonPtr();
Ogre::Overlay* ov = mg->getByName("testOverlay");
ov->show();
}
示例14: fade
void fade(Ogre::Real tpf) {
if (m_eFadeOperation != FADE_NONE && m_pTextUnitState) {
m_pTextUnitState->setAlphaOperation(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_TEXTURE, m_fAlpha);
if (m_eFadeOperation == FADE_IN) {
m_fCurrentDuration -= tpf;
m_fAlpha = m_fCurrentDuration / m_fTotalDuration;
if (m_fAlpha < 0.0) {
m_pOverlay->hide();
m_eFadeOperation = FADE_NONE;
if (m_pFaderCallback) {
m_pFaderCallback->fadeInCallback();
}
}
}
else if (m_eFadeOperation == FADE_OUT) {
m_fCurrentDuration += tpf;
m_fAlpha = m_fCurrentDuration / m_fTotalDuration;
if (m_fAlpha > 1.0) {
m_eFadeOperation = FADE_NONE;
if (m_pFaderCallback) {
m_pFaderCallback->fadeOutCallback();
}
}
}
}
#ifdef USE_SPRITE_SHADER
m_SpritePixelShaderParameters->setNamedConstant("colour", Ogre::ColourValue(1, 1, 1, m_fAlpha));
#endif
}
示例15: startFadeIn
void startFadeIn(Ogre::Real fDuration) {
if (fDuration < 0) fDuration = -fDuration;
m_fAlpha = 1.0;
m_fTotalDuration = fDuration;
m_fCurrentDuration = fDuration;
m_eFadeOperation = FADE_IN;
m_pOverlay->show();
}