本文整理汇总了C++中ogre::OverlayContainer::setLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ OverlayContainer::setLeft方法的具体用法?C++ OverlayContainer::setLeft怎么用?C++ OverlayContainer::setLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::OverlayContainer
的用法示例。
在下文中一共展示了OverlayContainer::setLeft方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}