Example #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
    }
Example #2
0
/// 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();
}
Example #3
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;
}
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
        }
    }
}
Example #5
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
            }
        }
    }
// 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();
}
Example #7
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);

}
Example #8
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);
}
Example #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);
        }
    }

}
Example #10
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);
            }
        }
    }
}
Example #12
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
}
Example #13
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;
        }
    }

}
Example #14
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);
}
Example #15
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);
    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);

}
Example #16
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);
        }
    }
}
Example #17
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);
}
Example #18
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);

}
Example #19
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);
        }
    }
}
Example #20
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();
}
Example #21
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();
	}
Example #22
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);
		}
	}
}
Example #23
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);
        }
    }
}
Example #24
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"));
	}
Example #25
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);
        }
    }
}
Example #26
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
}
Example #27
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;
}
Example #28
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);
		}
	}
}
Example #29
0
void WheelFactory::readWheelsFromFiles()
{
	wheels.clear(); // since we can run this whenever (like when we're tweaking files), we want to clear our dictionary first

	std::vector<string> files = direntSearchRec("media/vehicles/", ".wheel"); // Recursively get all filenames matching the extension

	for (string filename : files)
	{
		ConfigFile cfile;
		cfile.load(filename, "=", true);

		// each .wheel file can have multiple [sections]. We'll use each section name as the wheel name
		ConfigFile::SectionIterator sectionIterator = cfile.getSectionIterator();
		while(sectionIterator.hasMoreElements())
		{
			string wheelname = sectionIterator.peekNextKey();
			unordered_map<string,float> wheeldict;
			for (auto curPair : *(sectionIterator.getNext())) // go over every property in the file and add it to the dictionary, parsing it as a float
				wheeldict.insert(pair<string,float>(curPair.first, (float)atof(curPair.second.c_str())));

			wheels[wheelname] = wheeldict;
		}
	}
}
Example #30
0
void EventReceiver::loadKeyMapping()
{
    // Load resource paths from config file
    clearKeyMapping();

    ConfigFile cf;
    cf.load(keyMappingFilename);

    dprintf(MY_DEBUG_NOTE, "Read keymapping file:\n");
    // Go through all sections & settings in the file
    ConfigFile::SectionIterator seci = cf.getSectionIterator();

    std::string secName, keyName, valueName;
    while (seci.hasMoreElements())
    {
        bool primary = false;
        bool secondary = false;
        unsigned int p_type = 0;
        unsigned int p_key = (unsigned int)-1;
        unsigned int p_key2 = (unsigned int)-1;
        int p_from = 0;
        int p_to = 0;
        unsigned int s_type = 0;
        unsigned int s_key = (unsigned int)-1;
        unsigned int s_key2 = (unsigned int)-1;
        int s_from = 0;
        int s_to = 0;

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

            if (keyName == "primary_type")
            {
                primary = true;
                p_type = StringConverter::parseUnsignedInt(valueName, 0);
            } else
            if (keyName == "secondary_type")
            {
                secondary = true;
                s_type = StringConverter::parseUnsignedInt(valueName, 0);
            } else
            if (keyName == "primary_key")
            {
                primary = true;
                p_key = StringConverter::parseUnsignedInt(valueName, (unsigned int)-1);
            } else
            if (keyName == "secondary_key")
            {
                secondary = true;
                s_key = StringConverter::parseUnsignedInt(valueName, (unsigned int)-1);
            } else
            if (keyName == "primary_key2")
            {
                primary = true;
                p_key2 = StringConverter::parseUnsignedInt(valueName, (unsigned int)-1);
            } else
            if (keyName == "secondary_key2")
            {
                secondary = true;
                s_key2 = StringConverter::parseUnsignedInt(valueName, (unsigned int)-1);
            } else
            if (keyName == "primary_from")
            {
                primary = true;
                p_from = StringConverter::parseInt(valueName, 0);
            } else
            if (keyName == "secondary_from")
            {
                secondary = true;
                s_from = StringConverter::parseInt(valueName, 0);
            } else
            if (keyName == "primary_to")
            {
                primary = true;
                p_to = StringConverter::parseInt(valueName, 0);
            } else
            if (keyName == "secondary_to")
            {
                secondary = true;
                s_to = StringConverter::parseInt(valueName, 0);
            }
        }
        keyNameMap_t::iterator kit = keyNameMap.find(secName);
        if (kit != keyNameMap.end())
        {
            KeyName kn = kit->second;
            assert(kn < NUMBER_OF_KEYNAMES);
            if (primary)
            {
                keyMap[kn].primaryKeyConfig = KeyConfig::getKeyConfig((KeyConfig::type_t)p_type, p_key, p_key2, p_from, p_to, keyMap[kn].continous);
            }
            if (secondary)
            {
                keyMap[kn].secondaryKeyConfig = KeyConfig::getKeyConfig((KeyConfig::type_t)s_type, s_key, s_key2, s_from, s_to, keyMap[kn].continous);
            }
        }
    }
}