当前位置: 首页>>代码示例>>C++>>正文


C++ ConfigFile::getSetting方法代码示例

本文整理汇总了C++中ogre::ConfigFile::getSetting方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigFile::getSetting方法的具体用法?C++ ConfigFile::getSetting怎么用?C++ ConfigFile::getSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::ConfigFile的用法示例。


在下文中一共展示了ConfigFile::getSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadCfg

	bool Noise::loadCfg(Ogre::ConfigFile &CfgFile)
	{
		if (CfgFile.getSetting("Noise") == mName)
		{
			return true;
		}

		return false;
	}
开发者ID:heropunch,项目名称:cyberdeck,代码行数:9,代码来源:Noise.cpp

示例2: loadMaterialControlsFile

void loadMaterialControlsFile(MaterialControlsContainer& controlsContainer, const Ogre::String& filename)
{
    // Load material controls from config file
    Ogre::ConfigFile cf;

    try
    {

        cf.load(filename, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, "\t;=", true);

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

        Ogre::String secName, typeName, materialName, dataString;

        while (seci.hasMoreElements())
        {
            secName = seci.peekNextKey();
            Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
            if (!secName.empty() && settings)
            {
                materialName = cf.getSetting("material", secName);
				
				Ogre::MaterialPtr curMat = Ogre::MaterialManager::getSingleton().getByName(materialName);
				curMat->load();
				Ogre::Technique * curTec = curMat->getBestTechnique();
				if (!curTec || !curTec->isSupported())
				{
					continue;
				}

                MaterialControls newMaaterialControls(secName, materialName);
                controlsContainer.push_back(newMaaterialControls);

                size_t idx = controlsContainer.size() - 1;

                Ogre::ConfigFile::SettingsMultiMap::iterator i;

                for (i = settings->begin(); i != settings->end(); ++i)
                {
                    typeName = i->first;
                    dataString = i->second;
                    if (typeName == "control")
                        controlsContainer[idx].addControl(dataString);
                }
            }
        }

	    Ogre::LogManager::getSingleton().logMessage( "Material Controls setup" );
    }
    catch (Ogre::Exception e)
    {
        // Guess the file didn't exist
    }
}
开发者ID:Anti-Mage,项目名称:ogre,代码行数:55,代码来源:MaterialControls.cpp

示例3: loadCfg

	bool Noise::loadCfg(Ogre::ConfigFile &CfgFile)
	{
		if (CfgFile.getSetting("Noise") == mName)
		{
		    HydraxLOG(mName + " options entry found.");
			return true;
		}

        HydraxLOG("Error (Noise::loadCfg):\t" + mName + " options entry can not be found.");
		return false;
	}
开发者ID:Aperion,项目名称:rigsofrods-next-stable,代码行数:11,代码来源:Noise.cpp

示例4: createGUIWindow

void LoginState::createGUIWindow()
{
  assert(pGui);

    // Load the previous login settings from login.cfg, if one exists
  std::string ipAddress(""), playerName("nameless newbie");
  float colorSelection = 0.0f;
  Ogre::ConfigFile loginConfig;
  try {
      loginConfig.load(bundlePath() + "login.cfg");
      ipAddress = loginConfig.getSetting("IPaddress");
      playerName = loginConfig.getSetting("PlayerName");
      if (!from_string<float>(colorSelection, loginConfig.getSetting("PlayerColor"), std::dec))
        colorSelection = 0.0f;
  } catch (Ogre::FileNotFoundException e) {}

  pGui->setupLoginWindow(ipAddress, playerName, colorSelection);
  pGui->setLoginReceiver(this);

  mViewport = new MenuStateViewport(pSceneManager);
}
开发者ID:jdahlbom,项目名称:ApMech,代码行数:21,代码来源:LoginState.cpp

示例5: loadConfig

    StereoManager::StereoMode StereoManager::loadConfig(const Ogre::String &filename)
    {
        Ogre::ConfigFile cf;
        cf.load(filename.c_str());

        StereoMode mode = SM_NONE;

        const Ogre::String &modeName = cf.getSetting("Stereo mode","Stereoscopy");
        const StereoModeList::const_iterator end = available_nodes_.end();
        StereoModeList::iterator it;
        for(it = available_nodes_.begin(); it != end; ++it)
        {
            if(it->second.name_ == modeName)
            {
                mode = it->first;
                break;
            }
        }
        if(it == available_nodes_.end())
            mode = SM_NONE;

        fixFocalPlanePos(Ogre::StringConverter::parseBool(cf.getSetting("Fixed screen","Stereoscopy")));

        if(cf.getSetting("Focal length","Stereoscopy") == "inf")
            infinite_focal_length_ = true;
        else
            setFocalLength(Ogre::StringConverter::parseReal(cf.getSetting("Focal length","Stereoscopy")));

        setEyesSpacing(Ogre::StringConverter::parseReal(cf.getSetting("Eyes spacing","Stereoscopy")));
        setScreenWidth(Ogre::StringConverter::parseReal(cf.getSetting("Screen width","Stereoscopy")));
        inverseStereo(Ogre::StringConverter::parseBool(cf.getSetting("Inverse stereo","Stereoscopy")));

        return mode;
    }
开发者ID:A-K,项目名称:naali,代码行数:34,代码来源:StereoManager.cpp

示例6: getMeshYAdjust

float ArtifexLoader::getMeshYAdjust(Ogre::String meshfile)
{
	Ogre::ConfigFile cfgfile;
	float realY = 0;
	try {
		cfgfile.load("y_correction_tables.cfg");
		realY = Ogre::StringConverter::parseReal(cfgfile.getSetting(meshfile));
	} catch (...){
		cout << "Troubles loading the y_correction_tables.cfg.\n";
		return 0;
	};
	return realY;
};
开发者ID:rodstrom,项目名称:yomibubble,代码行数:13,代码来源:ArtifexLoaderObjects.cpp

示例7: readMaterialsFromFiles

void PhysicsMaterialFactory::readMaterialsFromFiles()
{
	// since we can run this whenever (like when we're tweaking files), we want to clear this first
	materials.clear();

	// get all of the filenames of the files in media/physicsmaterials
	std::string path = "media/physicsmaterials/";
	vector<string> files = direntSearch(path, ".physmat");

	for (string filename : files)
	{
		// rev up those files
		Ogre::ConfigFile cfile;
		cfile.load(filename, "=", true);

		auto sectionIterator = cfile.getSectionIterator();
		while (sectionIterator.hasMoreElements())
		{
			string matname = sectionIterator.peekNextKey();
			sectionIterator.moveNext();
			//if (matname.empty()) continue;
			
			ostringstream ssF,ssB,ssAD,ssLD;
			ssF << PhysicsMaterial::DEFAULT_FRICTION;
			ssB << PhysicsMaterial::DEFAULT_BOUNCINESS;
			ssAD << PhysicsMaterial::DEFAULT_ANGULAR_DAMPING;
			ssLD << PhysicsMaterial::DEFAULT_LINEAR_DAMPING;

			PhysicsMaterial *mat = new PhysicsMaterial(
				(float)atof(cfile.getSetting("Friction", matname, ssF.str()).c_str()),
				(float)atof(cfile.getSetting("Bounciness", matname, ssB.str()).c_str()),
				(float)atof(cfile.getSetting("AngularDamping", matname, ssAD.str()).c_str()),
				(float)atof(cfile.getSetting("LinearDamping", matname, ssLD.str()).c_str())
			);

			materials[matname] = mat;
		}
	}
}
开发者ID:Nuke928,项目名称:PonyKart,代码行数:39,代码来源:PhysicsMaterialFactory.cpp

示例8: WinMain

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, int) {
	char  **argv;
    int    argc;

    // obtain command-line arguments in argv[] style array
    argv = GetArgvCommandLine(&argc);
#else
int main( int argc, char **argv ) {
#endif

    std::string cmdvar;
    int cmd = 0;

    Ogre::ConfigFile lconfig;
    lconfig.load("server.cfg");

    Ogre::String address = lconfig.getSetting("LocalAddress", "Network");
    unsigned int port = Ogre::StringConverter::parseInt(lconfig.getSetting("DefaultPort", "Network"));

    Server::ServerMain server = Server::ServerMain(lconfig);
    return 0;
}
开发者ID:9981juhehua,项目名称:Hardwar,代码行数:22,代码来源:main.cpp

示例9: LoadOgrePlugins

bool OgreSubsystem::LoadOgrePlugins(Ogre::String const & pluginsfile)
{
	Ogre::StringVector pluginList;
	Ogre::String pluginDir;
	Ogre::ConfigFile cfg;

	try
	{
		cfg.load( pluginsfile );
	}
	catch (Ogre::Exception)
	{
		Ogre::LogManager::getSingleton().logMessage(pluginsfile + " not found, automatic plugin loading disabled.");
		return false;
	}

	pluginDir = cfg.getSetting("PluginFolder"); // Ignored on Mac OS X, uses Resources/ directory
	pluginList = cfg.getMultiSetting("Plugin");

#if OGRE_PLATFORM != OGRE_PLATFORM_APPLE && OGRE_PLATFORM != OGRE_PLATFORM_IPHONE
	if (pluginDir.empty())
	{
		// User didn't specify plugins folder, try current one
		pluginDir = ".";
	}
#endif

	char last_char = pluginDir[pluginDir.length()-1];
	if (last_char != '/' && last_char != '\\')
	{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
		pluginDir += "\\";
#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
		pluginDir += "/";
#endif
	}

	for ( Ogre::StringVector::iterator it = pluginList.begin(); it != pluginList.end(); ++it )
	{
		Ogre::String pluginFilename = pluginDir + (*it);
		try
		{
			m_ogre_root->loadPlugin(pluginFilename);
		} 
		catch(Ogre::Exception &e)
		{
			LOG("failed to load plugin: " + pluginFilename + ": " + e.getFullDescription());
		}
	}
	return true;
}
开发者ID:TechGiga,项目名称:rigs-of-rods,代码行数:51,代码来源:OgreSubsystem.cpp

示例10: loadRecord

void loadRecord()
{
    Ogre::ConfigFile cfg;

    try
    {
        cfg.loadDirect(RECORD_FILE);
    }
    catch (Ogre::FileNotFoundException &)
    {
        std::ofstream out(RECORD_FILE);
        out << std::endl;
        out.close();

        cfg.loadDirect(RECORD_FILE);
    }

    GlbVar.records.firstTime = Ogre::StringConverter::parseBool(cfg.getSetting("firstTime", Ogre::StringUtil::BLANK, "yes"));

    Ogre::String highestLevelStr = cfg.getSetting("highestLevelIndex", Ogre::StringUtil::BLANK, "n");
    if (highestLevelStr != "n")
    {
        GlbVar.records.highestLevelIndex = Ogre::StringConverter::parseInt(highestLevelStr);
        if (GlbVar.records.highestLevelIndex >= GlbVar.woMgr->getNumWorlds())
            GlbVar.records.highestLevelIndex = GlbVar.firstLevel;
    }
    else
        GlbVar.records.highestLevelIndex = GlbVar.firstLevel;

    //Deserialise recordMap from string.
    Ogre::String recordMapStr = cfg.getSetting("records", Ogre::StringUtil::BLANK, "n");
    if (recordMapStr != "n")
    {
        std::stringstream recordMapStream(std::stringstream::in | std::stringstream::out);
        recordMapStream << recordMapStr;
        boost::archive::text_iarchive ia(recordMapStream);
        ia >> GlbVar.records.recordMap;
    }
开发者ID:brownman,项目名称:grall2,代码行数:38,代码来源:Record.cpp

示例11: if

Render::Render(wxWindow* parent) : wxPanel(parent,
	wxID_ANY, wxPoint(), wxSize(100, 100)),
	mMapView(NULL), mWindow(NULL), mViewport(NULL), mActive(true)
{
	// Create Ogre render window.
	Ogre::NameValuePairList params;

	params["externalWindowHandle"] =
		Ogre::StringConverter::toString((size_t)GetHandle());

	Ogre::ConfigFile config;
	config.load("Ogre.cfg");

	if (config.getSetting("Render System") == "Direct3D9 Rendering Subsystem")
	{
		std::string aa = config.getSetting("Anti aliasing", "Direct3D9 Rendering Subsystem");
		std::string vs = config.getSetting("VSync", "Direct3D9 Rendering Subsystem");

		if (aa == "None") params["FSAA"] = "0";
		else if (aa == "Level 2") params["FSAA"] = "2";
		else if (aa == "Level 4") params["FSAA"] = "4";

		if (vs == "Yes") params["vsync"] = "1";
		else params["vsync"] = "0";
	}
	else if (config.getSetting("Render System") == "OpenGL Rendering Subsystem")
	{
		params["FSAA"] = config.getSetting("FSAA", "OpenGL Rendering Subsystem", "0");
		std::string vs = config.getSetting("VSync", "OpenGL Rendering Subsystem");

		if (vs == "Yes") params["vsync"] = "1";
		else params["vsync"] = "0";
	}

	// Create render window (Ogre).
	mWindow = Ogre::Root::getSingleton().createRenderWindow("3d-city", 1600, 1200, false, &params);
	mWindow->setActive(false);

	Ogre::Root::getSingleton().addFrameListener(this);

	// Connect events to wxWidgets window.
	Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(Render::onEnterWindow), NULL, this);
	Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(Render::onLeftDown), NULL, this);
	Connect(wxEVT_LEFT_UP, wxMouseEventHandler(Render::onLeftUp), NULL, this);
	Connect(wxEVT_MOTION, wxMouseEventHandler(Render::onMotion), NULL, this);
	Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(Render::onRightDown), NULL, this);
	Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(Render::onRightUp), NULL, this);
	Connect(wxEVT_SIZE, wxSizeEventHandler(Render::onSize), NULL, this);
	Connect(wxEVT_MOUSEWHEEL, wxMouseEventHandler(Render::onWheel), NULL, this);

	// Set background colour to black.
	SetBackgroundColour(wxColour(0, 0, 0));

	// Start rendering.
	start();
}
开发者ID:wojciech-holisz,项目名称:3d-city,代码行数:56,代码来源:Render.cpp

示例12: setupResources

		virtual void setupResources(void)
		{
			GraphicsSystem::setupResources();

			Ogre::ConfigFile cf;
			cf.load(mResourcePath + "resources2.cfg");

			Ogre::String dataFolder = cf.getSetting("DoNotUseAsResource", "Hlms", "");

			if (dataFolder.empty())
				dataFolder = "./";
			else if (*(dataFolder.end() - 1) != '/')
				dataFolder += "/";

			dataFolder += "2.0/scripts/materials/PbsMaterials";

			addResourceLocation(dataFolder, "FileSystem", "General");
		}
开发者ID:fulletron,项目名称:BlockGame,代码行数:18,代码来源:main_OLD.cpp

示例13: LoadOgrePlugins

bool OgreSubsystem::LoadOgrePlugins(Ogre::String const & pluginsfile)
{
    Ogre::ConfigFile cfg;

    try
    {
        cfg.load( pluginsfile );
    }
    catch (Ogre::Exception e)
    {
        Ogre::LogManager::getSingleton().logMessage(pluginsfile + " not found, automatic plugin loading disabled. Message: " + e.getFullDescription());
        return false;
    }

    Ogre::String pluginDir = cfg.getSetting("PluginFolder");
    Ogre::StringVector pluginList = cfg.getMultiSetting("Plugin");

    if (pluginDir.empty())
    {
        pluginDir = RoR::App::sys_process_dir.GetActive();
    }

    for ( Ogre::StringVector::iterator it = pluginList.begin(); it != pluginList.end(); ++it )
    {
        Ogre::String pluginFilename = pluginDir + PATH_SLASH + (*it);
        try
        {
            m_ogre_root->loadPlugin(pluginFilename);
        }
        catch (Ogre::Exception &e)
        {
            LOG("failed to load plugin: " + pluginFilename + ": " + e.getFullDescription());
        }
    }
    return true;
}
开发者ID:monwarez,项目名称:rigs-of-rods,代码行数:36,代码来源:OgreSubsystem.cpp

示例14: UpdateControls

void CLASS::UpdateControls()
{

	int valuecounter = 0; // Going to be usefull for selections

	//Lang (Still not done)
	if (!IsLoaded)
	{
		m_lang->addItem("English (U.S.)");
	}
	m_lang->setIndexSelected(0); //TODO

	if (!IsLoaded)
	{
		m_gearbox_mode->addItem("Automatic shift");
		m_gearbox_mode->addItem("Manual shift - Auto clutch");
		m_gearbox_mode->addItem("Fully Manual: sequential shift");
		m_gearbox_mode->addItem("Fully Manual: stick shift");
		m_gearbox_mode->addItem("Fully Manual: stick shift with ranges");
	}

	//Gearbox
	Ogre::String gearbox_mode = GameSettingsMap["GearboxMode"];
	if (gearbox_mode == "Manual shift - Auto clutch")
		m_gearbox_mode->setIndexSelected(1);
	else if (gearbox_mode == "Fully Manual: sequential shift")
		m_gearbox_mode->setIndexSelected(2);
	else if (gearbox_mode == "Fully Manual: stick shift")
		m_gearbox_mode->setIndexSelected(3);
	else if (gearbox_mode == "Fully Manual: stick shift with ranges")
		m_gearbox_mode->setIndexSelected(4);
	else
		m_gearbox_mode->setIndexSelected(0);


	Ogre::RenderSystem* rs = Ogre::Root::getSingleton().getRenderSystem();
	// add all rendersystems to the list
	if (m_render_sys->getItemCount() == 0)
	{
		const Ogre::RenderSystemList list = Application::GetOgreSubsystem()->GetOgreRoot()->getAvailableRenderers();
		int selection = 0;
		for (Ogre::RenderSystemList::const_iterator it = list.begin(); it != list.end(); it++, valuecounter++)
		{
			if (rs && rs->getName() == (*it)->getName())
			{
				ExOgreSettingsMap["Render System"] = rs->getName();
				selection = valuecounter;
			}
			else if (!rs) {
				LOG("Error: No Ogre Render System found");
			}
			if (!IsLoaded)
			{
				m_render_sys->addItem(Ogre::String((*it)->getName()));
			}
		}
		m_render_sys->setIndexSelected(selection);
	}

	Ogre::ConfigFile cfg;
	cfg.load(SSETTING("ogre.cfg", "ogre.cfg"));

	//Few GameSettingsMap
	Ogre::String bFullScreen = cfg.getSetting("Full Screen", rs->getName());
	if (bFullScreen == "Yes")
	{
		ExOgreSettingsMap["Full Screen"] = "Yes";
		m_fullscreen->setStateCheck(true);
	}
	else
	{
		ExOgreSettingsMap["Full Screen"] = "No";
		m_fullscreen->setStateCheck(false);
	}

	Ogre::String bVsync = cfg.getSetting("VSync", rs->getName());
	if (bVsync == "Yes")
	{
		ExOgreSettingsMap["VSync"] = "Yes";
		m_vsync->setStateCheck(true);
	}
	else
	{
		ExOgreSettingsMap["VSync"] = "No";
		m_vsync->setStateCheck(false);
	}
		
	// store available rendering devices and available resolutions
	Ogre::ConfigOptionMap& CurrentRendererOptions = rs->getConfigOptions();
	Ogre::ConfigOptionMap::iterator configItr = CurrentRendererOptions.begin();
	Ogre::StringVector mFoundResolutions;
	Ogre::StringVector mFoundFSAA;
	while (configItr != CurrentRendererOptions.end())
	{
		if ((configItr)->first == "Video Mode")
		{
			// Store Available Resolutions
			mFoundResolutions = ((configItr)->second.possibleValues);
		}
		if ((configItr)->first == "FSAA")
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:rigs-of-rods,代码行数:101,代码来源:GUI_GameSettings.cpp

示例15: if

Water::Water(const Ogre::ConfigFile &mTerrainConfig) :
	maxampl(0),
	free_wavetrain(0),
	visible(true),
	haswaves(BSETTING("Waves", false)),
	mScale(1.0f),
	vRtt1(0),
	vRtt2(0), 
	mRenderCamera(gEnv->mainCamera),
	pWaterNode(0),
	framecounter(0),
	rttTex1(0),
	rttTex2(0),
	mReflectCam(0),
	mRefractCam(0)
{
	//Ugh.. Why so ugly and hard to read
	mapSize = gEnv->terrainManager->getMaxTerrainSize();
	fade = gEnv->sceneManager->getFogColour();
	waterSceneMgr = gEnv->sceneManager;

	wHeight = PARSEREAL(mTerrainConfig.getSetting("WaterLine", "General"));
	wbHeight = PARSEREAL(mTerrainConfig.getSetting("WaterBottomLine", "General"));

	if (mapSize.x < 1500 && mapSize.z < 1500)
		mScale = 1.5f;

	// disable waves in multiplayer
	if (gEnv->multiplayer)
		haswaves = false;

	// and the type
	String waterSettingsString = SSETTING("Water effects", "Reflection + refraction (speed optimized)");
	if (waterSettingsString == "Basic (fastest)")
		mType = WATER_BASIC;
	if (waterSettingsString == "Reflection")
		mType = WATER_REFLECT;
	else if (waterSettingsString == "Reflection + refraction (speed optimized)")
		mType = WATER_FULL_SPEED;
	else if (waterSettingsString == "Reflection + refraction (quality optimized)")
		mType = WATER_FULL_QUALITY;

	if (haswaves)
	{
		char line[1024] = {};
		FILE *fd = fopen((SSETTING("Config Root", "")+"wavefield.cfg").c_str(), "r");
		if (fd)
		{
			while (!feof(fd))
			{
				int res = fscanf(fd," %[^\n\r]",line);
				if (line[0] == ';') continue;
				float wl,amp,mx,dir;
				res = sscanf(line,"%f, %f, %f, %f",&wl,&amp,&mx,&dir);
				if (res < 4) continue;
				wavetrains[free_wavetrain].wavelength=wl;
				wavetrains[free_wavetrain].amplitude=amp;
				wavetrains[free_wavetrain].maxheight=mx;
				wavetrains[free_wavetrain].direction=dir/57.0;
				wavetrains[free_wavetrain].dir_sin=sin(wavetrains[free_wavetrain].direction);
				wavetrains[free_wavetrain].dir_cos=cos(wavetrains[free_wavetrain].direction);
				free_wavetrain++;
			}
			fclose(fd);
		}
		for (int i=0; i<free_wavetrain; i++)
		{
			wavetrains[i].wavespeed=1.25*sqrt(wavetrains[i].wavelength);
			maxampl+=wavetrains[i].maxheight;
		}
	}

	processWater(mType);
}
开发者ID:gbandyein,项目名称:rigs-of-rods,代码行数:74,代码来源:Water.cpp


注:本文中的ogre::ConfigFile::getSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。