本文整理汇总了C++中ogre::StringVectorPtr类的典型用法代码示例。如果您正苦于以下问题:C++ StringVectorPtr类的具体用法?C++ StringVectorPtr怎么用?C++ StringVectorPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringVectorPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: changeWallpaper
void LoadingScreen::changeWallpaper ()
{
if (mResources.isNull ())
{
mResources = Ogre::StringVectorPtr (new Ogre::StringVector);
Ogre::StringVectorPtr resources = Ogre::ResourceGroupManager::getSingleton ().listResourceNames ("General", false);
for (Ogre::StringVector::const_iterator it = resources->begin(); it != resources->end(); ++it)
{
if (it->size() < 6)
continue;
std::string start = it->substr(0, 6);
boost::to_lower(start);
if (start == "splash")
mResources->push_back (*it);
}
}
if (mResources->size())
{
std::string randomSplash = mResources->at (rand() % mResources->size());
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().load (randomSplash, "General");
mBackgroundImage->setImageTexture (randomSplash);
}
else
std::cerr << "No loading screens found!" << std::endl;
}
示例2: updateLevels
void MainWindow::updateLevels()
{
try
{
ClientPluginManager& pluginManager = EditorGlobals::mGrid->getActiveServer().getPluginManager();
LevelManager& levelManager = pluginManager.getPlugin<LevelManager>();
ResourceManager& resourceManager = pluginManager.getPlugin<ResourceManager>();
Ogre::StringVectorPtr levels = levelManager.list();
int numListLevels = qMin( levels->size(), (std::size_t)cMaxLevels );
for( int i = 0; i < numListLevels; ++i )
{
Path filePath = resourceManager.getResourcePath() / levels->at( i );
QString file = QString( filePath.string().c_str() );
QString text = tr( "&%1 %2" ).arg( i + 1 ).arg( strippedName( file ) );
mLevelActions[i]->setText( text );
mLevelActions[i]->setData( file );
mLevelActions[i]->setVisible( true );
}
for( int i = numListLevels; i < cMaxLevels; ++i )
mLevelActions[i]->setVisible( false );
}
catch( Exception e )
{
// Ignore error
}
}
示例3: startRandomTitle
void SoundManager::startRandomTitle()
{
Ogre::StringVector filelist;
if (mMusicFiles.find(mCurrentPlaylist) == mMusicFiles.end())
{
Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups ();
for (Ogre::StringVector::iterator it = groups.begin(); it != groups.end(); ++it)
{
Ogre::StringVectorPtr resourcesInThisGroup = mResourceMgr.findResourceNames(*it,
"Music/"+mCurrentPlaylist+"/*");
filelist.insert(filelist.end(), resourcesInThisGroup->begin(), resourcesInThisGroup->end());
}
mMusicFiles[mCurrentPlaylist] = filelist;
}
else
filelist = mMusicFiles[mCurrentPlaylist];
if(!filelist.size())
return;
int i = rand()%filelist.size();
// Don't play the same music track twice in a row
if (filelist[i] == mLastPlayedMusic)
{
i = (i+1) % filelist.size();
}
streamMusicFull(filelist[i]);
}
示例4:
const std::vector<std::string> ModelDefinitionManager::getAllMeshes() const
{
std::vector<std::string> meshes;
Ogre::StringVectorPtr meshesVector = Ogre::ResourceGroupManager::getSingleton().findResourceNames("General", "*.mesh");
for (Ogre::StringVector::iterator I = meshesVector->begin(); I != meshesVector->end(); ++I) {
meshes.push_back(std::string(*I));
}
meshesVector.setNull();
return meshes;
}
示例5: loadAllMaterialControlFiles
void loadAllMaterialControlFiles(MaterialControlsContainer& controlsContainer)
{
Ogre::StringVectorPtr fileStringVector = Ogre::ResourceGroupManager::getSingleton().findResourceNames( "Popular", "*.controls");
Ogre::StringVector::iterator controlsFileNameIterator = fileStringVector->begin();
while ( controlsFileNameIterator != fileStringVector->end() )
{
loadMaterialControlsFile(controlsContainer, *controlsFileNameIterator);
++controlsFileNameIterator;
}
}
示例6: startRandomTitle
void SoundManager::startRandomTitle()
{
Ogre::StringVectorPtr filelist;
filelist = mResourceMgr.findResourceNames(Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
"Music/"+mCurrentPlaylist+"/*");
if(!filelist->size())
return;
int i = rand()%filelist->size();
streamMusicFull((*filelist)[i]);
}
示例7: loadAllFonts
void FontLoader::loadAllFonts(bool exportToFile)
{
Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups ();
for (Ogre::StringVector::iterator it = groups.begin(); it != groups.end(); ++it)
{
Ogre::StringVectorPtr resourcesInThisGroup = Ogre::ResourceGroupManager::getSingleton ().findResourceNames (*it, "*.fnt");
for (Ogre::StringVector::iterator resource = resourcesInThisGroup->begin(); resource != resourcesInThisGroup->end(); ++resource)
{
loadFont(*resource, exportToFile);
}
}
}
示例8: list
ResourceList ResourceManager::list()
{
ResourceList resourceList;
Ogre::StringVectorPtr resources = mRGM.findResourceNames( mGroup, "*" );
for( Ogre::StringVector::const_iterator i = resources->begin(); i != resources->end(); ++i )
{
resourceList.push_back( Path( *i ) );
}
return resourceList;
}
示例9: mBaseDirectory
CSMWorld::Resources::Resources (const std::string& baseDirectory, UniversalId::Type type,
const char * const *extensions)
: mBaseDirectory (baseDirectory), mType (type)
{
int baseSize = mBaseDirectory.size();
Ogre::StringVector resourcesGroups =
Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
for (Ogre::StringVector::iterator iter (resourcesGroups.begin());
iter!=resourcesGroups.end(); ++iter)
{
if (*iter=="General" || *iter=="Internal" || *iter=="Autodetect")
continue;
Ogre::StringVectorPtr resources =
Ogre::ResourceGroupManager::getSingleton().listResourceNames (*iter);
for (Ogre::StringVector::const_iterator iter (resources->begin());
iter!=resources->end(); ++iter)
{
if (static_cast<int> (iter->size())<baseSize+1 ||
iter->substr (0, baseSize)!=mBaseDirectory ||
((*iter)[baseSize]!='/' && (*iter)[baseSize]!='\\'))
continue;
if (extensions)
{
std::string::size_type index = iter->find_last_of ('.');
if (index==std::string::npos)
continue;
std::string extension = iter->substr (index+1);
int i = 0;
for (; extensions[i]; ++i)
if (extensions[i]==extension)
break;
if (!extensions[i])
continue;
}
std::string file = iter->substr (baseSize+1);
mFiles.push_back (file);
mIndex.insert (std::make_pair (file, static_cast<int> (mFiles.size())-1));
}
}
}
示例10: _CreateMeshPanel
bool CMainFrame::_CreateMeshPanel( CImageList& imageList, Ogre::StringVectorPtr& meshNames )
{
if (!m_resourceSelector.Create(WS_CHILD|WS_VISIBLE, CRect(200,100,400,300), this, IDS_ResourceSelector))
return false;
m_resourceSelector.SetOwner(this);
m_resourceSelector.SetIconSize(CSize(MESH_ICON_SIZE, MESH_ICON_SIZE));
CXTPTaskPanelGroup* pGroup = m_resourceSelector.AddGroup(IDS_ResourceSelector_Mesh);
int itemCount = imageList.GetImageCount();
m_resourceSelector.GetImageManager()->SetImageList(imageList.Detach(), 0);
for (int i=0; i<itemCount; ++i)
{
std::wstring meshname(Utility::EngineToUnicode(meshNames->at(i)));
meshname.erase(meshname.length()-5);
// Add folder entries
CXTPTaskPanelGroupItem* pItem = pGroup->AddLinkItem(i, 0);
pItem->SetIconIndex(i);
pItem->SetCaption(meshname.c_str());
}
m_resourceSelector.SetBehaviour(xtpTaskPanelBehaviourList);
m_resourceSelector.SetSelectItemOnFocus(TRUE);
m_resourceSelector.SetMultiColumn(TRUE);
m_resourceSelector.SetColumnWidth(RES_SELECTOR_COLUMN_WIDTH);
m_resourceSelector.GetAt(0)->SetExpanded(TRUE);
//拖拽支持
m_resourceSelector.AllowDrag(xtpTaskItemAllowDragCopyOutsideControl);
return true;
}
示例11: startRandomTitle
void SoundManager::startRandomTitle()
{
Ogre::StringVector filelist;
Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups ();
for (Ogre::StringVector::iterator it = groups.begin(); it != groups.end(); ++it)
{
Ogre::StringVectorPtr resourcesInThisGroup = mResourceMgr.findResourceNames(*it,
"Music/"+mCurrentPlaylist+"/*");
filelist.insert(filelist.end(), resourcesInThisGroup->begin(), resourcesInThisGroup->end());
}
if(!filelist.size())
return;
int i = rand()%filelist.size();
streamMusicFull(filelist[i]);
}
示例12: while
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
void
ResourceService::getResourceNames(I_ResourceNameVisitor& _visitor,
const std::string& _group,
const std::string& _pattern) const
{
_visitor.begin();
Ogre::StringVectorPtr pStringVector =
m_groupManager.findResourceNames(_group, _pattern);
Ogre::StringVector::iterator iter = pStringVector->begin();
while (iter != pStringVector->end())
{
_visitor.visit(*iter);
iter++;
}
_visitor.end();
}
示例13: changeWallpaper
void LoadingScreen::changeWallpaper ()
{
std::vector<std::string> splash;
Ogre::StringVectorPtr resources = Ogre::ResourceGroupManager::getSingleton ().listResourceNames ("General", false);
for (Ogre::StringVector::const_iterator it = resources->begin(); it != resources->end(); ++it)
{
if (it->size() < 6)
continue;
std::string start = it->substr(0, 6);
boost::to_lower(start);
if (start == "splash")
splash.push_back (*it);
}
std::string randomSplash = splash[rand() % splash.size()];
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().load (randomSplash, "General");
mBackgroundImage->setImageTexture (randomSplash);
}
示例14: DestroyAssetGroup
void ResourceManager::DestroyAssetGroup(const String& GroupName)
{
for( std::vector<String>::iterator it = ResourceGroups.begin() ; it != ResourceGroups.end() ; it++ )
{
if(GroupName == (*it))
{
ResourceGroups.erase(it);
break;
}
}
/// @todo This is a bit of a hack, but needs to be here until we can upgrade our resource system.
Ogre::StringVectorPtr ResourceNames = this->OgreResource->listResourceNames(GroupName,false);
for( Whole X = 0 ; X < ResourceNames->size() ; ++X )
{
if(ResourceNames->at(X).find(".mesh"))
{
MeshManager::GetSingletonPtr()->UnloadMesh(ResourceNames->at(X));
}
}
this->OgreResource->destroyResourceGroup(GroupName);
}
示例15: getResourceGroupFileNames
//----------------------------------------------------------------------------//
size_t OgreResourceProvider::getResourceGroupFileNames(
std::vector<String>& out_vec, const String& file_pattern,
const String& resource_group)
{
// get list of files in the group that match the pattern.
Ogre::StringVectorPtr vp =
Ogre::ResourceGroupManager::getSingleton().findResourceNames(
(resource_group.empty() ?
d_defaultResourceGroup.c_str() :
resource_group.c_str()),
file_pattern.c_str());
size_t entries = 0;
Ogre::StringVector::iterator i = vp->begin();
for (; i != vp->end(); ++i)
{
out_vec.push_back(i->c_str());
++entries;
}
return entries;
}