本文整理汇总了C++中ConfigFile::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigFile::Get方法的具体用法?C++ ConfigFile::Get怎么用?C++ ConfigFile::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigFile
的用法示例。
在下文中一共展示了ConfigFile::Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: System
PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
: System(params)
, m_DbgConfigForceRespawn(false)
{
EVENT_SUBSCRIBE_MEMBER(m_OnInputCommand, &PlayerSpawnSystem::OnInputCommand);
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerSpawnerd, &PlayerSpawnSystem::OnPlayerSpawned);
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerDeath, &PlayerSpawnSystem::OnPlayerDeath);
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
m_NetworkEnabled = config->Get("Networking.StartNetwork", false);
m_ForcedRespawnTime = config->Get("Debug.RespawnTime", -1.0f);
m_DbgConfigForceRespawn = m_ForcedRespawnTime > 0 && IsServer;
}
示例2: Init
void Frontend::Init(Communicator *c) {
#if 1
const char *config_file;
#ifdef _CONFIG_FILE
if((config_file = getenv("CONFIG_FILE")) == NULL)
config_file = _CONFIG_FILE;
#else
config_file = "gvirtus.properties";
#endif
ConfigFile *cf = new ConfigFile(config_file);
string communicator;
#ifndef _WIN32
char *tmp;
if((tmp = getenv("COMMUNICATOR")) != NULL)
communicator = string(tmp);
else
#endif
communicator = cf->Get("communicator");
mpCommunicator = Communicator::Get(communicator);
#else
mpCommunicator = c;
#endif
mpCommunicator->Connect();
mpInputBuffer = new Buffer();
mpOutputBuffer = new Buffer();
mpLaunchBuffer = new Buffer();
mExitCode = -1;
initialized = true;
}
示例3: Load
bool Config::Load(){
serverPort = 666;
isPublic = true;
memset(serverName,0,SERVERNAME_MAX); sprintf(serverName,"G Server");
enableLogging = true;
ignoreUnknownPackets = false;
spriteMaxX = 50;
spriteMaxY = 50;
usernameMax = 20;
ConfigFile file; file.Construct();
if(file.Load(CONFIG_FILE)){
file.Get("serverPort",&serverPort);
file.Get("isPublic",&isPublic);
file.Get("serverName",serverName,SERVERNAME_MAX);
file.Get("enableLogging",&enableLogging);
file.Get("ignoreUnknownPackets",&ignoreUnknownPackets);
file.Get("spriteMaxX",&spriteMaxX);
file.Get("spriteMaxY",&spriteMaxY);
file.Get("usernameMax",&usernameMax);
}else{
fprintf(stderr,"WARNING: %s not found. Generating with default settings.\n",CONFIG_FILE);
}
file.Clear();
file.Set("serverPort",serverPort);
file.Set("isPublic",isPublic);
file.Set("serverName",serverName);
file.Set("enableLogging",enableLogging);
file.Set("ignoreUnknownPackets",ignoreUnknownPackets);
file.Set("spriteMaxX",spriteMaxX);
file.Set("spriteMaxY",spriteMaxY);
file.Set("usernameMax",usernameMax);
if(file.Save(CONFIG_FILE)){
file.Destruct();
return true;
}else{
fprintf(stderr,"ERROR: Unable to save %s.\n",CONFIG_FILE);
file.Destruct();
return false;
}
}
示例4: if
Core::Core(const string& cLog, const string& cConfig)
: CoreObject("CORE", new ofstream(cLog), WorkPriority::WP_MAIN)
{
mLogger = mOutFileStream;
m_pRenderSystem = nullptr;
m_pInputSystem = nullptr;
m_pFileSystem = nullptr;
AddSystem(new FileSystem(mLogger), true);
ConfigFile* config = new ConfigFile(cConfig, mLogger);
for (auto it : config->Get())
{
if (it.first == "load_module")
{
LoadModule(it.second);
}
else if (it.first == "set_render_system")
{
if (it.second == "11.2")
{
ChangeSystem(SystemsType::SYSTEM_RENDER_DIRECTX_11_2);
}
else
{
DrawLine("Core: Íåâåðíûé ïàðàìåòîð! set_render_system");
}
}
else if (it.first == "set_input_system")
{
ChangeSystem(SystemsType::SYSTEM_INPUT_DX);
}
else if (it.first == "load_resource_folder")
{
m_pFileSystem->AddResourceFolder(it.second);
}
}
DrawLine("Core: Çàãðóçêà çàâåðøåíà!");
}