Beispiel #1
0
    //-----------------------------------------------------------------------
    void MapUtil::Load()
    {
#ifndef _MAPEDITOR
        mRoot = new Root("plugins.cfg", "ogre.cfg", "MapSplitter.log");     
        // Load resource paths from config file      
       ConfigFile cf;
        cf.load("resources.cfg");
        // Go through all sections & settings in the file
        ConfigFile::SectionIterator seci = cf.getSectionIterator();

        String secName, typeName, archName;
        while (seci.hasMoreElements())
        {
            secName = seci.peekNextKey();
            ConfigFile::SettingsMultiMap *settings = seci.getNext();
            ConfigFile::SettingsMultiMap::iterator i;
            for (i = settings->begin(); i != settings->end(); ++i)
            {
                typeName = i->first;
                archName = i->second;
                ResourceGroupManager::getSingleton().addResourceLocation(
                    archName, typeName, secName);
            }
        }

        mOptions = new PagingLandScapeOptions();
        mOptions->load("maptool.cfg");
#endif //_MAPEDITOR
    }
Beispiel #2
0
void OgreApp::setupResources(void){
	Ogre::ResourceGroupManager* res_manager = Ogre::ResourceGroupManager::getSingletonPtr();
#if 0
	std::string res_path = respath + "materials/programs";
	res_manager->addResourceLocation(res_path, "FileSystem", "General");
	res_path = respath + "materials/scripts";
	res_manager->addResourceLocation(res_path, "FileSystem", "General");
	res_path = respath + "materials/textures";
	res_manager->addResourceLocation(res_path, "FileSystem", "General");
	res_path = respath + "models";
	res_manager->addResourceLocation(res_path, "FileSystem", "General");
#endif

	// Load resource paths from config file
	ConfigFile cf;

#if( CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID )
	if (gAssetMgr) {   
		ArchiveManager::getSingleton().addArchiveFactory( 
				new APKFileSystemArchiveFactory(gAssetMgr) );
		ArchiveManager::getSingleton().addArchiveFactory( 
				new APKZipArchiveFactory(gAssetMgr) );
	} 

	cf.load(openAPKFile(resource_cfg_file));
#else
	cf.load(mResourcePath + resource_cfg_file);
#endif

	// Go through all sections & settings in the file
	ConfigFile::SectionIterator seci = cf.getSectionIterator();

	String sec, type, arch;
	while (seci.hasMoreElements()){
		sec = seci.peekNextKey();
		ConfigFile::SettingsMultiMap *settings = seci.getNext();
		ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i){
			type = i->first;
			arch = i->second;

#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
			// OS X does not set the working directory relative to the app,
			// In order to make things portable on OS X we need to provide
			// the loading with it's own bundle path location
			arch = String(macBundlePath) + "/" + arch;
#elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//			arch= "assets/" + arch;
#else
			//notice: mResourcePath must be prefix
			arch= mResourcePath + arch;
#endif
			res_manager->addResourceLocation(arch, type, sec);
		}
	}

#if( CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID )
	res_manager->initialiseResourceGroup(Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
#endif
}
/// Method which will define the source of resources (other than current folder)
void OgreApp::setupResources(void)
{
	// Load resource paths from config file
	ConfigFile cf;
	cf.load("resources.cfg");

	// Go through all sections & settings in the file
	ConfigFile::SectionIterator seci = cf.getSectionIterator();

	String secName, typeName, archName;
	while (seci.hasMoreElements())
	{
		secName = seci.peekNextKey();
		ConfigFile::SettingsMultiMap *settings = seci.getNext();
		ConfigFile::SettingsMultiMap::const_iterator i;
		for (i = settings->begin(); i != settings->end(); ++i)
		{
			typeName = i->first;
			archName = i->second;
			ResourceGroupManager::getSingleton().addResourceLocation(
				archName, typeName, secName);
		}
	}
	ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}
Beispiel #4
0
void GameManager::setupResources(void)
{
  // load resource paths from config file
  ConfigFile cf;
  std::string ResourcePath;
  ResourcePath = "..\\media\\";
  cf.load(ResourcePath + "resources.cfg");
  // go through all settings in the file
  ConfigFile::SectionIterator seci = cf.getSectionIterator();
  String secName, typeName, archName;

  while(seci.hasMoreElements())
  {
    secName = seci.peekNextKey();
    ConfigFile::SettingsMultiMap *settings = seci.getNext();
    ConfigFile::SettingsMultiMap::iterator i;

    for(i = settings->begin() ; i != settings->end() ; ++i)
    {
      typeName = i->first;
      archName = i->second;
      ResourceGroupManager::getSingleton().addResourceLocation(
        ResourcePath + archName, typeName, secName);
    }
  }

  ParticleSystemRendererFactory*  mParticleSystemRendererFact;
  ParticleEmitterFactory*     mParticleEmitterFact;
  mParticleSystemRendererFact = OGRE_NEW ShaderParticleRendererFactory();
  mParticleEmitterFact        = OGRE_NEW BoxEmitterFactory();
  ParticleSystemManager::getSingleton().addRendererFactory(mParticleSystemRendererFact);
  ParticleSystemManager::getSingleton().addEmitterFactory(mParticleEmitterFact);
}
void
GraphicsManager::setupResources()
{
    ConfigFile configFile;
    configFile.load(m_resourcePath + "resources.cfg");

    ConfigFile::SectionIterator secItr = configFile.getSectionIterator();

    String secName, typeName, archName;
    while (secItr.hasMoreElements())
    {
        secName = secItr.peekNextKey();
        ConfigFile::SettingsMultiMap *settings = secItr.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
            ResourceGroupManager::getSingleton().addResourceLocation(
                String(macBundlePath() + "/" + archName), typeName, secName);
#else
            ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
#endif
        }
    }
}
Beispiel #6
0
    void defineResources(void){
        String secName, typeName, archName;
        ConfigFile cf;

        #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
            cf.load(macBundlePath() + "/Contents/Resources/resources.cfg");
        #else
            cf.load("resources.cfg"); //parses
        #endif

        ConfigFile::SectionIterator seci = cf.getSectionIterator();
        while (seci.hasMoreElements()){ //start looping in the content
            secName = seci.peekNextKey(); //get all the content
            ConfigFile::SettingsMultiMap *settings = seci.getNext(); //only points to content address
            ConfigFile::SettingsMultiMap::iterator i;

            for (i = settings->begin(); i != settings->end(); ++i){
                typeName = i->first;
                archName = i->second;

                #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
                    ResourceGroupManager::getSingleton().addResourceLocation( String(macBundlePath() + "/" + archName), typeName, secName);
                #else
                    ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName);
                #endif
            }
        }
    }
Beispiel #7
0
void Game::initOgreAssets() {
    using namespace Ogre;

    // Load resource paths from config file
    ConfigFile config_file;
    config_file.load("resources.cfg");

    // Go through all sections & settings in the file
    ConfigFile::SectionIterator section_iter = config_file.getSectionIterator();

    String group_name, location_type, location_name;
    while (section_iter.hasMoreElements()) {
        group_name = section_iter.peekNextKey();
        ConfigFile::SettingsMultiMap* settings = section_iter.getNext();
        for (auto i = settings->begin(); i != settings->end(); ++i) {
            location_type = i->first;
            location_name = i->second;
            static const bool recursive = false;
            ResourceGroupManager::getSingleton().addResourceLocation(
                location_name, location_type, group_name, recursive);
        }
    }

    ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}
Beispiel #8
0
void TerrainTests::setUp()
{
	mRoot = OGRE_NEW Root();

	// Load resource paths from config file
	ConfigFile cf;
	cf.load("resources.cfg");

	// Go through all sections & settings in the file
	ConfigFile::SectionIterator seci = cf.getSectionIterator();

	String secName, typeName, archName;
	while (seci.hasMoreElements())
	{
		secName = seci.peekNextKey();
		ConfigFile::SettingsMultiMap *settings = seci.getNext();
		ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i)
		{
			typeName = i->first;
			archName = i->second;
			ResourceGroupManager::getSingleton().addResourceLocation(
				archName, typeName, secName);

		}
	}

	mSceneMgr = mRoot->createSceneManager(ST_GENERIC);

}
Beispiel #9
0
void AApplication::RemoveResourceLocations(std::string path)
{
    // Load resource paths from config file

    ConfigFile cf;
    cf.load(path+"resources.cfg");

    // Go through all sections & settings in the file
    ConfigFile::SectionIterator seci = cf.getSectionIterator();

    String secName, typeName, archName;
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey();
        ConfigFile::SettingsMultiMap *settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
            ResourceGroupManager::getSingleton().removeResourceLocation(archName, secName);
        }
    }

}
// Get the resources sources
void ClientMain::setupResources()
{
    ConfigFile                              cf;
    ConfigFile::SettingsMultiMap*           settings;
    ConfigFile::SettingsMultiMap::iterator  i;
    String                                  secName, typeName, archName;

    // Load other resource paths from config file
    cf.load(ClientConfig::getSingle()   ->getPath(String("resources.cfg")));

    // Go through all sections & settings in the file
    ConfigFile::SectionIterator seci    = cf.getSectionIterator();

    while (seci.hasMoreElements()) {
        secName  = seci.peekNextKey();
        settings = seci.getNext();

        for (i = settings->begin(); i != settings->end(); ++i) {
            typeName = i->first;
            archName = i->second;

            ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
        }
    }
    // Initialise and parse ressources
    TextureManager::getSingleton()       .setDefaultNumMipmaps(5);
    ResourceGroupManager::getSingleton() .initialiseAllResourceGroups();
}
Beispiel #11
0
/// Method which will define the source of resources (other than current folder)
void Renderer::setupResources(void)
{
    // Load resource paths from config file
    ConfigFile cf;
    cf.load(mResourcePath + "resources.cfg");

    // Go through all sections & settings in the file
    ConfigFile::SectionIterator seci = cf.getSectionIterator();

    String secName, typeName, archName;
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey();
        ConfigFile::SettingsMultiMap *settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
            // OS X does not set the working directory relative to the app,
            // In order to make things portable on OS X we need to provide
            // the loading with it's own bundle path location
            ResourceGroupManager::getSingleton().addResourceLocation(
                String(macBundlePath() + "/" + archName), typeName, secName);
#else
            ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
#endif
        }
    }
}
//------------------------------------------------------------------------------------------
/// Method which will define the source of resources (other than current folder)
void CRtcApplication::setupResources()
{
    // Load resource paths from config file
    ConfigFile cf;
    cf.load(mResourcePath + skResourceFilename);

    // Go through all sections & settings in the file
    ConfigFile::SectionIterator seci = cf.getSectionIterator();

    String secName, typeName, archName;
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey();
        ConfigFile::SettingsMultiMap *settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
            ResourceGroupManager::getSingleton().addResourceLocation( String(mOGREResourcePath + "/" + archName), typeName, secName);

            if ( typeName == "FileSystem" )
            {
                ResourceGroupManager::getSingleton().addResourceLocation( String(mResourcePath + archName), typeName, secName);
            }
        }
    }
}
Beispiel #13
0
bool Day::readCfg()
{
    ConfigFile cf;
    cf.load(DAY_DIR(raceName, dayName)+"/"+DAY_CFG);

    dprintf(MY_DEBUG_NOTE, "Read day cfg file: %s / %s\n", raceName.c_str(), dayName.c_str());
    // Go through all sections & settings in the file
    ConfigFile::SectionIterator seci = cf.getSectionIterator();

    std::string secName, keyName, valName;
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey();
        dprintf(MY_DEBUG_NOTE, "\tSection d: %s\n", secName.c_str());
        ConfigFile::SettingsMultiMap *settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            keyName = i->first;
            valName = i->second;
            dprintf(MY_DEBUG_NOTE, "\t\tkey: %s, value: %s\n", keyName.c_str(), valName.c_str());

            if (keyName == "long_name")
            {
                dayLongName = valName;
            }/* else if (keyName == "cache_objects")
            {
                cacheObjects = StringConverter::parseBool(valName, true);
            }*/
        }
    }
    return true;
}
Beispiel #14
0
void GameManager::setupResources( void ) {
    // Load resource paths from config file
    ConfigFile cf;
    cf.load( "resources.cfg" );

    // Go through all settings in the file
    ConfigFile::SectionIterator itSection = cf.getSectionIterator();

    String sSection, sType, sArch;
    while( itSection.hasMoreElements() ) {
        sSection = itSection.peekNextKey();

        ConfigFile::SettingsMultiMap *mapSettings = itSection.getNext();
        ConfigFile::SettingsMultiMap::iterator itSetting = mapSettings->begin();
        while( itSetting != mapSettings->end() ) {
            sType = itSetting->first;
            sArch = itSetting->second;

            ResourceGroupManager::getSingleton().addResourceLocation(
                sArch, sType, sSection );

            ++itSetting;
        }
    }

}
Beispiel #15
0
//--------------------------------------------------------------------------
void MeshLodTests::setUp()
{
    mFSLayer = OGRE_NEW_T(Ogre::FileSystemLayer, Ogre::MEMCATEGORY_GENERAL)(OGRE_VERSION_NAME);

#ifdef OGRE_STATIC_LIB
    mStaticPluginLoader = OGRE_NEW StaticPluginLoader();
    Root* root = OGRE_NEW Root(BLANKSTRING);        
    mStaticPluginLoader.load();
#else
    String pluginsPath = mFSLayer->getConfigFilePath("plugins.cfg");
    Root* root = OGRE_NEW Root(pluginsPath);
#endif

    CPPUNIT_ASSERT(!root->getAvailableRenderers().empty());
    root->setRenderSystem(root->getAvailableRenderers().back());
    root->initialise(false); // Needed for setting up HardwareBufferManager

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
    Ogre::NameValuePairList misc;
    // Tell OGRE that we're using cocoa, so it doesn't need to make a window for us
    misc["macAPI"] = "cocoa";
    root->createRenderWindow("", 320, 240, false, &misc)->setHidden(true);
#else
    root->createRenderWindow("", 320, 240, false, NULL)->setHidden(true);
#endif

    new MeshLodGenerator;

    // Load resource paths from config file
    ConfigFile cf;
    String resourcesPath;

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    resourcesPath = mFSLayer->getConfigFilePath("resources.cfg");
#else
    resourcesPath = mFSLayer->getConfigFilePath("bin/resources.cfg");
#endif

    cf.load(resourcesPath);
    // Go through all sections & settings in the file
    ConfigFile::SectionIterator seci = cf.getSectionIterator();

    String secName, typeName, archName;
    while (seci.hasMoreElements()) {
        secName = seci.peekNextKey();
        ConfigFile::SettingsMultiMap* settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i) {
            typeName = i->first;
            archName = i->second;
            ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
        }
    }

    // Create the mesh for testing
    mMesh = MeshManager::getSingleton().load("Sinbad.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
}
void TerrainTests::setUp()
{
    // set up silent logging to not pollute output
	if(LogManager::getSingletonPtr())
		OGRE_DELETE Ogre::LogManager::getSingletonPtr();

	if(LogManager::getSingletonPtr() == 0)
	{
		LogManager* logManager = OGRE_NEW LogManager();
		logManager->createLog("testTerrain.log", true, false);
	}
    LogManager::getSingleton().setLogDetail(LL_LOW);
    mFSLayer = OGRE_NEW_T(Ogre::FileSystemLayer, Ogre::MEMCATEGORY_GENERAL)(OGRE_VERSION_NAME);

#ifdef OGRE_STATIC_LIB
	mRoot = OGRE_NEW Root(BLANKSTRING);
        
	mStaticPluginLoader.load();
#else
    String pluginsPath = mFSLayer->getConfigFilePath("plugins.cfg");
	mRoot = OGRE_NEW Root(pluginsPath);
#endif
	mTerrainOpts = OGRE_NEW TerrainGlobalOptions();

	// Load resource paths from config file
	ConfigFile cf;
    String resourcesPath;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    resourcesPath = mFSLayer->getConfigFilePath("resources.cfg");
#else
    resourcesPath = mFSLayer->getConfigFilePath("bin/resources.cfg");
#endif

    cf.load(resourcesPath);

	// Go through all sections & settings in the file
	ConfigFile::SectionIterator seci = cf.getSectionIterator();

	String secName, typeName, archName;
	while (seci.hasMoreElements())
	{
		secName = seci.peekNextKey();
		ConfigFile::SettingsMultiMap *settings = seci.getNext();
		ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i)
		{
			typeName = i->first;
			archName = i->second;
			ResourceGroupManager::getSingleton().addResourceLocation(
				archName, typeName, secName);

		}
	}

	mSceneMgr = mRoot->createSceneManager(ST_GENERIC);

}
Beispiel #17
0
/* static */ void RaceManager::readGlobalObjects(const std::string& fileName, RaceManager::globalObjectList_t& globalObjectList)
{
    ConfigFile cf;
    cf.load(fileName);

    dprintf(MY_DEBUG_NOTE, "Read global objects cfg file: %s\n", fileName.c_str());
    // Go through all sections & settings in the file
    ConfigFile::SectionIterator seci = cf.getSectionIterator();

    std::string secName, keyName, valName;
    while (seci.hasMoreElements())
    {
        std::string objectPoolName;
        irr::core::vector3df apos;
        irr::core::vector3df rot;
        irr::core::vector3df scale(1.0f, 1.0f, 1.0f);

        secName = seci.peekNextKey();
        dprintf(MY_DEBUG_NOTE, "\tSection: %s\n", secName.c_str());
        ConfigFile::SettingsMultiMap *settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            keyName = i->first;
            valName = i->second;
            dprintf(MY_DEBUG_NOTE, "\t\tkey: %s, value: %s\n", keyName.c_str(), valName.c_str());

            if (keyName == "type")
            {
                objectPoolName = valName;
            } else if (keyName == "pos")
            {
                StringConverter::parseFloat3(valName, apos.X, apos.Y, apos.Z);
            } else if (keyName == "rot")
            {
                StringConverter::parseFloat3(valName, rot.X, rot.Y, rot.Z);
            } else if (keyName == "scale")
            {
                StringConverter::parseFloat3(valName, scale.X, scale.Y, scale.Z);
            }
        }

        ObjectPool* objectPool = 0;
        ObjectPoolManager::objectPoolMap_t::const_iterator poolIt = ObjectPoolManager::getInstance()->getObjectPoolMap().find(objectPoolName);
        if (poolIt != ObjectPoolManager::getInstance()->getObjectPoolMap().end())
        {
            objectPool = poolIt->second;
        }

        if (objectPool)
        {
            ObjectWireGlobalObject* globalObject = new ObjectWireGlobalObject(objectPool, apos, rot, scale);
            globalObjectList.push_back(globalObject);
        }
    }
}
Beispiel #18
0
OgreApp::OgreApp()
{
    root = new Root;

    ConfigFile cf;
    cf.load("resources.cfg");

    // Go through all sections & settings in the file
    ConfigFile::SectionIterator seci = cf.getSectionIterator();

    String secName, typeName, archName;
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey();
        ConfigFile::SettingsMultiMap *settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
            ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
        }
    }

	ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
	
	// Restore the old config
	if(!root->restoreConfig())
	{
		// If there is no existing config, bring up the config dialog
		if(!root->showConfigDialog())
		{
			// If the user cancels the dialog, close the app
			exit(0);
		}
	}

    win = root->initialise(true, "Ogre Framework");

	sceneMgr = root->createSceneManager(ST_GENERIC, "MainSceneManager");

    camera = sceneMgr->createCamera("SimpleCamera");
    viewPort = root->getAutoCreatedWindow()->addViewport(camera);
    viewPort->setBackgroundColour(ColourValue(0,0,0));
    camera->setAspectRatio(Real(viewPort->getActualWidth()) / Real(viewPort->getActualHeight()));
    camera->setNearClipDistance(1.0);

	soundManager = new OgreAL::SoundManager();

	createScene();

    listener = new DeviceListener(win, camera, sceneMgr);
    root->addFrameListener(listener);
}
Beispiel #19
0
void TerrainTests::setUp()
{
    // set up silent logging to not pollute output
	if(LogManager::getSingletonPtr())
		OGRE_DELETE Ogre::LogManager::getSingletonPtr();

	if(LogManager::getSingletonPtr() == 0)
	{
		LogManager* logManager = OGRE_NEW LogManager();
		logManager->createLog("testTerrain.log", true, false);
	}
    LogManager::getSingleton().setLogDetail(LL_LOW);

	mRoot = OGRE_NEW Root();
	mTerrainOpts = OGRE_NEW TerrainGlobalOptions();

	// Load resource paths from config file
	ConfigFile cf;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
	cf.load(macBundlePath() + "/Contents/Resources/resources.cfg");
#else
	cf.load("resources.cfg");
#endif

	// Go through all sections & settings in the file
	ConfigFile::SectionIterator seci = cf.getSectionIterator();

	String secName, typeName, archName;
	while (seci.hasMoreElements())
	{
		secName = seci.peekNextKey();
		ConfigFile::SettingsMultiMap *settings = seci.getNext();
		ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i)
		{
			typeName = i->first;
			archName = i->second;
			ResourceGroupManager::getSingleton().addResourceLocation(
				archName, typeName, secName);

		}
	}

	mSceneMgr = mRoot->createSceneManager(ST_GENERIC);

}
Beispiel #20
0
void LogoState::defineResources(void)
{
    String secName, typeName, archName;
    ConfigFile cf;
    cf.load("resources.cfg");

    ConfigFile::SectionIterator seci = cf.getSectionIterator();
    while (seci.hasMoreElements()) {
        secName = seci.peekNextKey();
        ConfigFile::SettingsMultiMap *settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i) {
            typeName = i->first;
            archName = i->second;
            ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
        }
    }
}
Beispiel #21
0
/** Reads configuration from "media/config/splash.res" and loads all ressource groups inside.\n
	The options must be initialized.\n
	Ogre must be initialized with a scene manager, camera and viewport.\n
	@sa Ponykart::Core::Options, Kernel/LKernel.h
*/
Splash::Splash()
{
	current=0;

	log("[Loading] Loading splash screen ressources...");
	ConfigFile configFile;
	configFile.load("media/config/splash.res");
	ConfigFile::SectionIterator seci = configFile.getSectionIterator();
	while (seci.hasMoreElements())
	{
		String secName = seci.peekNextKey();
		ConfigFile::SettingsMultiMap *settings = seci.getNext();
		for (auto i = settings->begin(); i != settings->end(); ++i)
			ResourceGroupManager::getSingleton().addResourceLocation(i->second, i->first, secName);
	}
	ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

	createScene();
	updateGUI();
}
Beispiel #22
0
void BaseApp::setupResources()
{
	ConfigFile cf;
	cf.load(mResourcesCfg);

	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();

	String secName,typeName,archName;
	while(seci.hasMoreElements())
	{
		secName = seci.peekNextKey();
		ConfigFile::SettingsMultiMap * settings = seci.getNext();
		ConfigFile::SettingsMultiMap::iterator i;
		for(i=settings->begin();i!=settings->end();++i)
		{
			typeName = i->first;
			archName = i->second;
			ResourceGroupManager::getSingleton().addResourceLocation(archName,typeName,secName);
		}
	}
}
Beispiel #23
0
	void loadResources()
	{
		ConfigFile cf;
		cf.load("resources_d.cfg");
		ConfigFile::SectionIterator sectionIter = cf.getSectionIterator();
		String sectionName, typeName, dataName;

		while (sectionIter.hasMoreElements())
		{
			sectionName = sectionIter.peekNextKey();
			ConfigFile::SettingsMultiMap *settings = sectionIter.getNext();
			ConfigFile::SettingsMultiMap::iterator i;
			for (i = settings->begin(); i != settings->end(); ++i)
			{
				typeName = i->first;
				dataName = i->second;
				ResourceGroupManager::getSingleton().addResourceLocation(dataName, typeName, sectionName);
			}
		}
		ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
	}
Beispiel #24
0
//-------------------------------------------------------------------------------------
void BaseApplication::setupResources(void) {
	// Load resource paths from config file
	ConfigFile cf;
	cf.load(_resourcesCfg);

	// Go through all sections & settings in the file
	ConfigFile::SectionIterator seci = cf.getSectionIterator();

	while (seci.hasMoreElements()) {
		String secName = seci.peekNextKey();
		ConfigFile::SettingsMultiMap *settings = seci.getNext();

		for (auto i = settings->begin(); i != settings->end(); ++i) {
			String
				typeName = i->first,
				archName = i->second;

			ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
		}
	}
}
Beispiel #25
0
void Application::loadResources()
{
    //Chargement de la configuration
    ConfigFile configFile;
    configFile.load("resources.cfg");

    //Lecture des ressources
    ConfigFile::SectionIterator seci = configFile.getSectionIterator();
    String secName, typeName, archName;
    while (seci.hasMoreElements()) {
        secName = seci.peekNextKey();
        ConfigFile::SettingsMultiMap *settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); i++) {
            typeName = i->first;
            archName = i->second;
            ResourceGroupManager::getSingleton().
                addResourceLocation(archName, typeName, secName);
        }
    }
}
Beispiel #26
0
void Engine::setupResources() {
	//carrega os recursos do arquivo de recursos(resources.cfg)
    ConfigFile cf;
    cf.load(_configuration->getResourcePath() + "resources.cfg");

    //agora jogamos pro ResourceGroupManager todos os recursos do arquivo
    ConfigFile::SectionIterator seci = cf.getSectionIterator();

    String secName, typeName, archName;
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey();
        ConfigFile::SettingsMultiMap *settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
            ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
        }
    }
}
Beispiel #27
0
	void GameManager::setupResources(std::string inPath) {

		// Load resource paths from config file
		ConfigFile cf;
		cf.load( inPath );

		// Go through all settings in the file
		ConfigFile::SectionIterator itSection = cf.getSectionIterator();

		String sSection, sType, sArch;
		while( itSection.hasMoreElements() ) {
		    sSection = itSection.peekNextKey();

		    ConfigFile::SettingsMultiMap *mapSettings = itSection.getNext();
		    ConfigFile::SettingsMultiMap::iterator itSetting = mapSettings->begin();
		    while( itSetting != mapSettings->end() ) {
		        sType = itSetting->first;
		        sArch = itSetting->second;
				    ResourceGroupManager::getSingleton().addResourceLocation( sArch, sType, sSection);
		        ++itSetting;
		    }
		}
		// Initialise resources
		ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap");
		OgreBites::SdkTrayManager *mTrayMgr =
		  new OgreBites::SdkTrayManager(HAX_APP_NAME_STR + "/Loader", mRenderWindow, InputManager::getSingletonPtr()->getMouse(), 0);
		//mTrayMgr->showAll();
		mTrayMgr->showLoadingBar(1,1, 1);
		//ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
		ResourceGroupManager::getSingleton().initialiseResourceGroup("General");
		ResourceGroupManager::getSingleton().initialiseResourceGroup("Scripts");
		mTrayMgr->hideLoadingBar();
		delete mTrayMgr;

    // TODO: when do we clean these up?
		//mRenderWindow->removeViewport(-1);
		//mRoot->getSceneManager("LoadingScene")->destroyCamera("LoadingCamera");
		//mRoot->destroySceneManager(mRoot->getSceneManager("LoadingScene"));
	}
Beispiel #28
0
void    setupResources(const String &filename){
    using namespace Ogre;
    ConfigFile cf;
    cf.load(filename);    // Go through all sections & settings in the file
    ConfigFile::SectionIterator seci = cf.getSectionIterator();

    String secName, typeName, archName;
    while (seci.hasMoreElements()) {
        secName = seci.peekNextKey();
        ConfigFile::SettingsMultiMap *settings = seci.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;

            ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
        }
    }
    ResourceGroupManager::getSingleton().addResourceLocation(".", typeName, secName);

    ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); /// Although the override is optional, this is mandatory
}
Beispiel #29
0
bool ShortStory::Initialize ()
{
#ifdef _DEBUG
	Ogre::String pluginFile = "plugins_d.cfg";
#else
	Ogre::String pluginFile = "plugins.cfg";
#endif

	// on créée le noeud root de la scène
	mRoot = OGRE_NEW
	Root(pluginFile);
	// on charge les objets
	ConfigFile configFile;
	configFile.load("resources.cfg");
	ConfigFile::SectionIterator seci = configFile.getSectionIterator();
	Ogre::String secName, typeName, archName;
	while (seci.hasMoreElements())
	{
		secName = seci.peekNextKey();
		ConfigFile::SettingsMultiMap *settings = seci.getNext();
		ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i)
		{
			typeName = i->first;
			archName = i->second;
			ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
		}
	}
	// récupération des config de l'utilisateur
	if (!(mRoot->restoreConfig() || mRoot->showConfigDialog()))
	{
		return false;
	}
	initScene();

	return true;
}
Beispiel #30
0
void CharacterInput::readConfigFile()
{
	ConfigFile cf;
	cf.load("bindings.cfg");

	ConfigFile::SectionIterator sectionIter = cf.getSectionIterator();
	String device, bindName, bindKey;
	ConfigFile::SettingsMultiMap * settings;
	ConfigFile::SettingsMultiMap::iterator i;

	while (sectionIter.hasMoreElements())
	{
		device = sectionIter.peekNextKey();
		settings = sectionIter.getNext();

		for (i = settings->begin(); i != settings->end(); ++i)
		{
			bindName = i->first;
			bindKey = i->second;

			parseBinding(device, bindName, bindKey);
		}
	}
}