本文整理汇总了C++中ogre::OverlayContainer类的典型用法代码示例。如果您正苦于以下问题:C++ OverlayContainer类的具体用法?C++ OverlayContainer怎么用?C++ OverlayContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OverlayContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: _finalizeCalibration
void ViargoOgreKinectTrackingCalibrationMetaphor::_finalizeCalibration() {
// Build extended positions (calculates average normal plane and adds translated points to list, needed for opencv affine transformation solver)
//_buildExtendedPositions(_screenPositions3D);
//_buildExtendedPositions(_worldPositions);
cv::Point3f origin = _worldPositions[2];
cv::Point3f xAxis = _worldPositions[3];
cv::Point3f yAxis = _worldPositions[0];
_buildTransformationMatrix(origin, xAxis, yAxis);
// SVD
//_solveRigidBodyTransformation(_worldPositions, _screenPositions3D);
// Store transformation matrix in file
_storeCalibrationData();
storeTransformation("kinect_calibration.txt");
// Reset state
_calibrating = false;
_calibrated = true;
// Hide overlays
_overlay->hide();
_backgroundOverlayContainer->hide();
for (unsigned int i = 0; i < _markers.size(); i++) {
Ogre::OverlayContainer* currentMarkerOverlay = _markers[i];
currentMarkerOverlay->hide();
}
_worldPositions.clear();
}
开发者ID:Instinctlol,项目名称:gamelab2014,代码行数:32,代码来源:viargo_ogre_kinect_tracking_calibration_metaphor.cpp
示例3: showQuestLogEntries
void Menu::showQuestLogEntries()
{
Ogre::OverlayManager* om = Ogre::OverlayManager::getSingletonPtr();
if (om==NULL) return;
Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(
om->getOverlayElement(cQuestLogOverlay+"/Panel"));
if (panel==NULL)
{
std::cout << "Menu::showQuestLogEntries: ERROR: Panel not found!\n";
return;
}//if
std::vector<QLogEntry> entries = QuestLog::getSingleton().listQuestEntries(m_QuestLogOffset, cQuestLogEntriesPerPage);
if (m_QuestLogOffset>0 and entries.empty())
{ //reset offset, because we've gone too far, and fetch entries again
m_QuestLogOffset = 0;
entries = QuestLog::getSingleton().listQuestEntries(m_QuestLogOffset, cQuestLogEntriesPerPage);
}
Ogre::TextAreaOverlayElement* text_elem = NULL;
const Ogre::FontPtr glyphs = Ogre::FontManager::getSingleton().getByName("Console");
unsigned int i;
//create text areas for entries
for (i=0; i<entries.size(); ++i)
{
text_elem = static_cast<Ogre::TextAreaOverlayElement*>(
om->createOverlayElement("TextArea", cQuestLogOverlay+"/"+IntToString(i)));
text_elem->setMetricsMode(Ogre::GMM_RELATIVE);
text_elem->setPosition(0.025, cQuestLogEntryHeight*i+0.5*cQuestLogEntryHeight);
text_elem->setDimensions(0.725, cQuestLogEntryHeight);
text_elem->setAlignment(Ogre::TextAreaOverlayElement::Left);
text_elem->setCaption(chopString(Journal::getSingleton().getText(entries[i].questID, entries[i].index),
cQuestLogCharHeight, glyphs));
text_elem->setFontName("Console");
text_elem->setColour(Ogre::ColourValue(1.0, 0.5, 0.0));
text_elem->setCharHeight(cQuestLogCharHeight);
panel->addChild(text_elem);
}//for
//delete unneccessary textareas, if present
for (i=entries.size(); i<m_QuestLogEntryCount; ++i)
{
om->destroyOverlayElement(cQuestLogOverlay+"/"+IntToString(i));
}//for
m_QuestLogEntryCount = entries.size();
//show notification, if no elements are present yet
if (entries.empty())
{
text_elem = static_cast<Ogre::TextAreaOverlayElement*>(
om->createOverlayElement("TextArea", cQuestLogOverlay+"/0"));
text_elem->setMetricsMode(Ogre::GMM_RELATIVE);
text_elem->setPosition(0.025, 0.0+0.5*cQuestLogEntryHeight);
text_elem->setDimensions(0.725, cQuestLogEntryHeight);
text_elem->setAlignment(Ogre::TextAreaOverlayElement::Center);
text_elem->setCaption("You don't have any journal entries yet!");
text_elem->setFontName("Console");
text_elem->setColour(Ogre::ColourValue(1.0, 0.5, 0.0));
text_elem->setCharHeight(cQuestLogCharHeight);
panel->addChild(text_elem);
m_QuestLogEntryCount = 1;
}//if
}//func
示例4:
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());
}
示例5:
Ogre::OverlayContainer *GUIHelper::findContainer(Ogre::OverlayContainer *overlay,
const Ogre::String subStrName)
{
ASSERT(overlay);
std::queue<Ogre::OverlayContainer *> q;
q.push(overlay);
Ogre::OverlayContainer *parent = 0;
while(!q.empty()){
parent = q.back();
q.pop();
if(parent->getName().find(subStrName) != Ogre::String::npos){
// we find it
return parent;
}
// else we have to iterate over all the children an put it in the queue
Ogre::OverlayContainer *child = 0;
Ogre::OverlayContainer::ChildIterator it = parent->getChildIterator();
while(it.hasMoreElements()){
child = static_cast<Ogre::OverlayContainer *>(it.peekNextValue());
if(!child){
break;
}
// else we put it in the queue
q.push(child);
it.moveNext();
}
}
return 0;
}
示例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: reposContainer
void GUIHelper::reposContainer(Ogre::OverlayContainer *o)
{
ASSERT(o);
if(!o->getParent()){
debugWARNING("This overlay has no parent (%s)\n", o->getName().c_str());
return;
}
// if we have parent then we call the other function
Ogre::OverlayContainer *parent = o->getParent();
reposContainer(o, parent->getLeft(), parent->getTop(),parent->getHeight(),
parent->getWidth());
}
示例8: deleteOverlayContainerContents
void LoadingBar::deleteOverlayContainerContents(Ogre::OverlayContainer& container) const
{
{
OverlayContainer::ChildContainerIterator I = container.getChildContainerIterator();
while (I.hasMoreElements()) {
deleteOverlayContainerContents(*I.getNext());
}
}
OverlayContainer::ChildIterator I = container.getChildIterator();
while (I.hasMoreElements()) {
OverlayManager::getSingleton().destroyOverlayElement(I.getNext());
}
}
示例9: createOverlay
void DirectShowControl::createOverlay()
{
mOverlay = Ogre::OverlayManager::getSingleton().create(mName);
Ogre::OverlayContainer *mContainer = (Ogre::OverlayContainer*)
(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Ogre/DebugTexPanel" +mName));
mContainer->setMetricsMode(Ogre::GMM_PIXELS);
mContainer->setDimensions(mVp->getActualWidth(),mVp->getActualHeight());
mContainer->setMaterialName(mMaterial->getName());
mOverlay->add2D(mContainer);
mOverlay->show();
PlayMovie();
}
示例10: killDialogueOverlayLines
void Menu::killDialogueOverlayLines()
{
Ogre::OverlayManager* om = 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 (om==NULL) return;
Ogre::OverlayContainer* oc = static_cast<Ogre::OverlayContainer*> (om->getOverlayElement(cDialogueOverlay+"/Box"));
unsigned int i;
for (i=0; i<m_DialogueLineCount; i=i+1)
{
oc->removeChild(cDialogueOverlay+"/Box/Line"+IntToString(i));
om->destroyOverlayElement(cDialogueOverlay+"/Box/Line"+IntToString(i));
}//for
m_DialogueLineCount = 0;
}
示例11: 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();
}
示例12: opendir
//-------------------------------------------------------------------------------------
///Load all songs, initializes overlay and play first
Sound::Sound(const char* path, int width, int height):volumeDiff(1),actualSongNumber(0),overlayIsShowed(false),durationOverlay(0),startVolume(5)
{
volume = startVolume; //50%
engine = irrklang::createIrrKlangDevice();
struct dirent *entry;
DIR *dp;
dp = opendir(path);
std::string stringName;
if (dp == NULL) {
perror("opendir: Path does not exist or could not be read.");
}else{
while ((entry = readdir(dp))){
stringName = entry->d_name;
if(!(!strcmp(".", stringName.c_str())||!strcmp("..",stringName.c_str()))){
songNames.push_back(std::string(path)+ '/'+ entry->d_name);
}
}
}
song = engine->play2D(songNames[0].c_str(), false, false, true);
song->setVolume(volume);
closedir(dp);
//Event Listener
song->setSoundStopEventReceiver(this);
//overlay
Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
//Create a panel
Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "MusicPanel"));
panel->setMetricsMode(Ogre::GMM_PIXELS);
panel->setDimensions(width*9/10, 50);
panel->setLeft((width - panel->getWidth()) / 2);
panel->setMaterialName("Core/StatsBlockCenter"); // Optional background material
// Create a text area
musicTextArea = static_cast<Ogre::TextAreaOverlayElement*>(overlayManager.createOverlayElement("TextArea", "MusicTextArea"));
musicTextArea->setMetricsMode(Ogre::GMM_PIXELS);
musicTextArea->setTop(5);
musicTextArea->setLeft((( panel->getWidth())) / 4);
musicTextArea->setCharHeight(14);
musicTextArea->setFontName("StarWars");
// Add the text area to the panel
panel->addChild(musicTextArea);
// Create an overlay, and add the panel
overlay = overlayManager.create("MusicBox");
overlay->add2D((panel));
actualSong();
}
示例13: mListener
// -------------------------------------------------------------------------
OgreBulletGuiListener::OgreBulletGuiListener(OgreBulletListener *listener, Ogre::RenderWindow *win) :
mListener(listener),
mWindow(win),
mMouseOverlay(0),
mMousePanel(0)
{
/******************* CREATE Cursor Overlay ***************************/
mMouseOverlay = (Overlay*)OverlayManager::getSingleton().getByName("GuiOverlay");
if (mMouseOverlay)
{
mMousePanel = OverlayManager::getSingleton().getOverlayElement ("GUIMouse");
}
else
{
mMouseOverlay = OverlayManager::getSingletonPtr()->create("GuiOverlay");
mMouseOverlay->setZOrder(600);
mMousePanel = (Ogre::OverlayElement *)
OverlayManager::getSingletonPtr()->createOverlayElement("Panel", "GUIMouse");
mMousePanel->setMaterialName("OgreBulletDemos/TargetSights");
TexturePtr mouseTex = TextureManager::getSingleton().load("target.png", "Bullet");
mMousePanel->setWidth (mouseTex->getWidth() / (float)win->getWidth());
mMousePanel->setHeight (mouseTex->getHeight() / (float)win->getHeight());
Ogre::OverlayContainer *mouseContainer = (Ogre::OverlayContainer*)
OverlayManager::getSingletonPtr()->createOverlayElement("Panel", "GUIContainer");
mMouseOverlay->add2D(mouseContainer);
mouseContainer->addChild(mMousePanel);
}
mMouseOverlay->show();
TexturePtr mouseTex = TextureManager::getSingleton().load("target.png", "Bullet");
mMouseCursorHalfWidth = (Real(mouseTex->getWidth()) / mWindow->getWidth()) * 0.5;
mMouseCursorHalfHeight = (Real(mouseTex->getHeight()) / mWindow->getHeight ()) * 0.5;
/******************* CREATE GUI ***************************/
mGui = new BetaGUI::GUI("OgreBulletGui", "BlueHighway", 14, win);
OverlayContainer* mouseCursor = mGui->createMousePointer(Vector2(32, 32), "bgui.pointer");
mouseCursor->hide();
mGui->injectMouse(mWindow->getWidth() * 0.5, mWindow->getHeight() * 0.5, false);
}
示例14:
/**
* @inheritDoc
*/
BrowserWindow::BrowserWindow() {
m_texture = Ogre::TextureManager::getSingleton().createManual("HUDTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, 500, 500, 0, Ogre::PF_BYTE_BGRA, Ogre::TU_DYNAMIC);
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("HUDMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
material->getTechnique(0)->getPass(0)->createTextureUnitState("HUDTexture");
material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
m_overlay = overlayManager.create("OverlayName");
Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "PanelName"));
panel->setPosition(0.0, 0.0);
panel->setDimensions(1.0, 1.0);
panel->setMaterialName("HUDMaterial");
m_overlay->add2D(panel);
m_overlay->show();
}
示例15: setUpOverlay
void GameScreen::setUpOverlay(){
// Load the Font
FontManager &fontMgr = FontManager::getSingleton();
ResourcePtr font = fontMgr.create("GameFont","General");
font->setParameter("type","truetype");
font->setParameter("source","Smirnof.ttf");
font->setParameter("size","20");
font->setParameter("resolution","96");
font->load();
// Load the overlay
OverlayManager& overlayMgr = OverlayManager::getSingleton();
Ogre::OverlayContainer* panel = static_cast<OverlayContainer*>(
overlayMgr.createOverlayElement("Panel", "PanelName"));
panel->_setPosition(0.05, 0.925);
panel->setDimensions(300, 120);
TextAreaOverlayElement* textArea = static_cast<TextAreaOverlayElement*>(
overlayMgr.createOverlayElement("TextArea", "TextAreaName"));
textArea->setMetricsMode(Ogre::GMM_PIXELS);
textArea->setPosition(0, 0);
textArea->setDimensions(300, 120);
textArea->setCharHeight(24);
textArea->setColour(ColourValue(1,1,0));
// set the font name to the font resource that you just created.
textArea->setFontName("GameFont");
// say something
std::stringstream ss;
ss << "Score: " << score;
textArea->setCaption(ss.str().c_str());
overlay = overlayMgr.create("OverlayName");
overlay->add2D(panel);
panel->addChild(textArea);
}