本文整理汇总了C++中CConfigFile::ReadInt方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfigFile::ReadInt方法的具体用法?C++ CConfigFile::ReadInt怎么用?C++ CConfigFile::ReadInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConfigFile
的用法示例。
在下文中一共展示了CConfigFile::ReadInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Destroy
bool
CProject::Open(const char* filename)
{
Destroy();
// set the game directory
m_Directory = filename;
if (m_Directory.rfind('\\') != std::string::npos)
m_Directory[m_Directory.rfind('\\')] = 0;
// set the game filename
m_Filename = filename;
if (1) {
char directory[MAX_PATH];
GetCurrentDirectory(MAX_PATH, directory);
if (SetCurrentDirectory(m_Directory.c_str()) == 0)
return false;
FILE* file = fopen(m_Filename.c_str(), "a");
if (!file) return false;
fclose(file);
SetCurrentDirectory(directory);
}
// load the game.sgm
CConfigFile config;
if (!config.Load(m_Filename.c_str()))
return false;
m_GameTitle = config.ReadString("", "name", "Untitled");
m_Author = config.ReadString("", "author", "Unknown");
m_Description = config.ReadString("", "description", "");
m_GameScript = config.ReadString("", "script", "");
// screen dimensions
m_ScreenWidth = config.ReadInt("", "screen_width", 320);
m_ScreenHeight = config.ReadInt("", "screen_height", 240);
RefreshItems();
return true;
}
示例2: LoadConfiguration
void LoadConfiguration(std::string sphere_dir)
{
CConfigFile file;
file.Load((sphere_dir + "/system/video/sdl32.cfg").c_str());
Config.fullscreen = file.ReadBool("sdl32", "Fullscreen", false);
Config.vsync = file.ReadBool("sdl32", "VSync", false);
Config.scale = file.ReadBool("sdl32", "Scale", false);
Config.filter = file.ReadInt ("sdl32", "Filter", 0);
int vexpand = file.ReadInt ("sdl32", "VExpand", 0);
int hexpand = file.ReadInt ("sdl32", "HExpand", 0);
if (vexpand < 0 || vexpand > 1024)
vexpand = 0;
if (hexpand < 0 || hexpand > 1024)
hexpand = 0;
Config.border.top = (int)(vexpand / 2);
Config.border.bottom = (int)(vexpand / 2) + (vexpand % 2);
Config.border.left = (int)(hexpand / 2);
Config.border.right = (int)(hexpand / 2) + (hexpand % 2);
}