本文整理汇总了C++中sf::String::ToAnsiString方法的典型用法代码示例。如果您正苦于以下问题:C++ String::ToAnsiString方法的具体用法?C++ String::ToAnsiString怎么用?C++ String::ToAnsiString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::String
的用法示例。
在下文中一共展示了String::ToAnsiString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void LogManager::SetLogFile(const sf::String& logFile)
{
myLogFile.open(logFile.ToAnsiString().c_str(), std::ios::out | std::ios::trunc);
if (!myLogFile)
std::cerr << "Impossible d'ouvrir le fichier " << logFile.ToAnsiString() << std::endl;
}
示例2: toDebugLog
void toDebugLog(const sf::String &pStr)
{
#ifndef DEBUG
std::ofstream lfile;
lfile.open(gDebugLog.ToAnsiString(), std::ios::app);
lfile<<pStr.ToAnsiString()<<std::endl;
lfile.close();
#else
//std::cout<<pStr.ToAnsiString()<<std::endl;
#endif
}
示例3: lStr
std::vector<std::string> getAllFolders(const sf::String &pFolder)
{
DIR *lDir;
struct dirent *ent;
std::vector<std::string> mReturn;
// *********** IMAGE LOADING ****/////////////////////////
lDir = opendir (pFolder.ToAnsiString().c_str());
if (lDir != NULL)
{
/* print all the files and directories within directory */
while ((ent = readdir (lDir)) != NULL)
{
if(ent->d_type == DT_DIR)
{
sf::String lStr(ent->d_name);
if(lStr == "." || lStr == "..")
continue;
mReturn.push_back(lStr.ToAnsiString());
}
}
closedir (lDir);
}
return mReturn;
}
示例4: t
std::map<sf::String, sf::String> parseDataFile(const sf::String &pFile)
{
std::map<sf::String, sf::String> lReturn;
std::ifstream t(pFile.ToAnsiString());
if(!t.is_open())
return lReturn;
std::string str;
t.seekg(0, std::ios::end);
str.reserve(t.tellg());
t.seekg(0, std::ios::beg);
str.assign((std::istreambuf_iterator<char>(t)),
std::istreambuf_iterator<char>());
std::string lStrData(str);
lStrData.erase(std::remove_if(lStrData.begin(), lStrData.end(), ::isspace), lStrData.end());
std::vector<std::string> lLine = split(lStrData, ';');
for(int i = 0; i < lLine.size(); i++)
{
std::vector<std::string> lValue = split(lLine.at(i), '=');
lReturn[lValue.at(0)] = lValue.at(1);
}
return lReturn;
}
示例5: initDebugLog
void initDebugLog()
{
#ifndef DEBUG
std::ofstream lfile;
lfile.open(gDebugLog.ToAnsiString(), std::ios::out);
lfile.close();
#endif
}
示例6: glGetUniformLocation
void Program::Send(const sf::String& name, float value)
{
if (!myIsLinked)
return;
GLint loc = glGetUniformLocation(myProgram, name.ToAnsiString().c_str());
glUseProgram(myProgram);
glUniform1f(loc, value);
}
示例7:
ResourceCache::ResourceCache(sf::String& contentDirectory)
{
gLogger.Write("Resource Cache: Created");
ContentDirectory = contentDirectory.ToAnsiString();
gLogger.Write("Resource Cache: Directory: " + ContentDirectory);
}
示例8: glShaderSource
void Shader::LoadFromFile(const sf::String& filename)
{
std::fstream file;
file.open(filename.ToAnsiString().c_str());
if (file.fail())
{
return;
}
std::stringstream bufStr;
bufStr << file.rdbuf();
file.close();
const char* buffer = bufStr.str().c_str();
glShaderSource(myShader, 1, &buffer, NULL);
glCompileShader(myShader);
GLint status, logSize;
glGetShaderiv(myShader, GL_COMPILE_STATUS, &status);
if (status != GL_TRUE)
{
glGetShaderiv(myShader, GL_INFO_LOG_LENGTH, &logSize);
char* log = new char[logSize + 1];
memset(log, 0, logSize + 1);
glGetShaderInfoLog(myShader, logSize, &logSize, log);
std::cerr << "Unable to compile ";
if (myType == VERTEX_SHADER)
std::cerr << "vertex";
else
std::cerr << "fragment";
std::cerr << " shader. Reason :" << std::endl;
std::cerr << log << std::endl;
delete[] log;
return;
}
}
示例9: stringToFloat
float stringToFloat(const sf::String &pStr)
{
return atof(pStr.ToAnsiString().c_str());
}