本文整理汇总了C++中LoadFromFile函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadFromFile函数的具体用法?C++ LoadFromFile怎么用?C++ LoadFromFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LoadFromFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AnsiString
LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(char *Name, bool Dynamic,
float *fSamplingRate)
{ // wyszukanie dŸwiêku w pamiêci albo wczytanie z pliku
AnsiString file;
if (Dynamic)
{ // próba wczytania z katalogu pojazdu
file = Global::asCurrentDynamicPath + AnsiString(Name);
if (FileExists(file))
Name = file.c_str(); // nowa nazwa
else
Dynamic = false; // wczytanie z "sounds/"
}
TSoundContainer *Next = First;
DWORD dwStatus;
for (int i = 0; i < Count; i++)
{
if (strcmp(Name, Next->Name) == 0)
{
if (fSamplingRate)
*fSamplingRate = Next->fSamplingRate; // czêstotliwoœæ
return (Next->GetUnique(pDS));
// DSBuffers.
/*
Next->pDSBuffer[Next->Oldest]->Stop();
Next->pDSBuffer[Next->Oldest]->SetCurrentPosition(0);
if (Next->Oldest<Next->Concurrent-1)
{
Next->Oldest++;
return (Next->pDSBuffer[Next->Oldest-1]);
}
else
{
Next->Oldest= 0;
return (Next->pDSBuffer[Next->Concurrent-1]);
};
/* for (int j=0; j<Next->Concurrent; j++)
{
Next->pDSBuffer[j]->GetStatus(&dwStatus);
if ((dwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING)
return (Next->pDSBuffer[j]);
} */
}
else
Next = Next->Next;
};
if (Dynamic) // wczytanie z katalogu pojazdu
Next = LoadFromFile("", Name, 1);
else
Next = LoadFromFile(Directory, Name, 1);
if (Next)
{ //
if (fSamplingRate)
*fSamplingRate = Next->fSamplingRate; // czêstotliwoœæ
return Next->GetUnique(pDS);
}
ErrorLog("Missed sound: " + AnsiString(Name));
return (NULL);
};
示例2: Shader
Shader::Shader(std::string vertexFile, std::string fragmentFile) : Shader()
{
mVertex =glCreateShader(GL_VERTEX_SHADER);
mFragment =glCreateShader(GL_FRAGMENT_SHADER);
mProgram =glCreateProgram();
LoadFromFile(FragmentShader, fragmentFile);
LoadFromFile(VertexShader, vertexFile);
}
示例3: Log
CMapzoneData::CMapzoneData(const char *szMapName)
{
if (!LoadFromFile(szMapName))
{
Log("Unable to find map zones! Trying to create them...\n");
saveZonFile(szMapName);//try making the zon file if the map has the entities
LoadFromFile(szMapName);
}
}
示例4: LoadAndCreateShaderProgram
/*!
Loads a shader program from a file and creates the related program
@param vertex_file - the file which stores the vertex shader code
@param fragment_file - the file which stores the fragment shader code
@return - Gluint of the shader program
*/
GLuint LoadAndCreateShaderProgram(string vertex_file, string fragment_file)
{
string vertex_source = LoadFromFile(vertex_file);
string fragment_source= LoadFromFile(fragment_file);
// create and return the pgoram.
return CreateShaderProgram(vertex_source, fragment_source);
}
示例5: m_userDataFolder
CFavouritesService::CFavouritesService(std::string userDataFolder) : m_userDataFolder(std::move(userDataFolder))
{
CFileItemList items;
std::string favourites = "special://xbmc/system/favourites.xml";
if(XFILE::CFile::Exists(favourites))
LoadFromFile(favourites, m_favourites);
else
CLog::Log(LOGDEBUG, "CFavourites::Load - no system favourites found, skipping");
favourites = URIUtils::AddFileToFolder(m_userDataFolder, "favourites.xml");
if(XFILE::CFile::Exists(favourites))
LoadFromFile(favourites, m_favourites);
else
CLog::Log(LOGDEBUG, "CFavourites::Load - no userdata favourites found, skipping");
}
示例6: LoadRank
bool cPlayer::LoadFromDisk(cWorldPtr & a_World)
{
LoadRank();
// Load from the UUID file:
if (LoadFromFile(GetUUIDFileName(m_UUID), a_World))
{
return true;
}
// Load from the offline UUID file, if allowed:
AString OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName());
const char * OfflineUsage = " (unused)";
if (cRoot::Get()->GetServer()->ShouldLoadOfflinePlayerData())
{
OfflineUsage = "";
if (LoadFromFile(GetUUIDFileName(OfflineUUID), a_World))
{
return true;
}
}
// Load from the old-style name-based file, if allowed:
if (cRoot::Get()->GetServer()->ShouldLoadNamedPlayerData())
{
AString OldStyleFileName = Printf("players/%s.json", GetName().c_str());
if (LoadFromFile(OldStyleFileName, a_World))
{
// Save in new format and remove the old file
if (SaveToDisk())
{
cFile::Delete(OldStyleFileName);
}
return true;
}
}
// None of the files loaded successfully
LOG("Player data file not found for %s (%s, offline %s%s), will be reset to defaults.",
GetName().c_str(), m_UUID.c_str(), OfflineUUID.c_str(), OfflineUsage
);
if (a_World == NULL)
{
a_World = cRoot::Get()->GetDefaultWorld();
}
return false;
}
示例7: LoadFromFile
NameGenerator::NameGenerator()
{
//ctor
LoadFromFile("data/letter_chances.txt");
std::string key, value;
for(auto it = m_values.begin(); it != m_values.end(); it++)
{
key = it->first;
value = it->second;
try
{
if(key.size() == 1)
{
m_first[key.at(0)] = std::stof(value);
}
if(key.size() == 2)
{
m_second[key.at(0)][key.at(1)] = std::stof(value);
}
if(key.size() == 3)
{
m_third[key.at(0)][key.at(1)][key.at(2)] = std::stof(value);
}
}
catch(...)
{
std::cout << "Could not convert " << value << std::endl;
}
}
}
示例8: IsEditorMode
void Ide::LoadLastMain()
{
bool editor = IsEditorMode();
LoadFromFile(THISBACK(SerializeLastMain), ConfigFile("lastmain.cfg"));
if(editor)
main <<= Null;
}
示例9: main
int main() {
MyTree<int>* root = CreateEmptyTree<int>();
LoadFromFile(root, "C:\\input.txt");
Square(root);
SaveToFile(root, "C:\\out.txt");
DeleteTree(root);
}
示例10: Initialize
bool pawsConfigPopup::Initialize()
{
if (!LoadFromFile("configpopup.xml"))
return false;
return true;
}
示例11: OleRegisterServerDoc
/*
constructor
-----------
if "szPath" is NULL then we create an untitled document and default object
the type is "doctypeNew" if "lhDoc" is NULL and "doctypeEmbedded" if
"lhDoc" is non NULL
if "szPath" is non NULL we create a document of type "doctypeFromFile"
and initialize it from file "szPath"
if "lhDoc" is NULL then we call OleRegisterServerDoc() otherwise we
just use "lhDoc" as our registration handle
*/
TOLEDocument::TOLEDocument (TOLEServer &server,
LHSERVERDOC lhDoc,
LPSTR szPath,
BOOL dirty)
{
szName = 0;
lpvtbl = &_vtbl;
fRelease = FALSE;
fDirty = dirty;
server.pDocument = this;
//
// since we only have one object we can create it now...
//
pObject = new TOLEObject;
if (szPath)
LoadFromFile (szPath);
else {
SetDocumentName (UNNAMED_DOC);
type = lhDoc ? doctypeEmbedded : doctypeNew;
}
if (lhDoc != 0)
this->lhDoc = lhDoc; // use registration handle we were given
else
OleRegisterServerDoc (server.lhServer, szName, this, (LHSERVERDOC FAR *) &this->lhDoc);
}
示例12: LoadFromFile
Bitmap::Bitmap(const WCHAR *path) {
data = NULL;
xOffsets = NULL;
yOffsets = NULL;
LoadFromFile(path);
}
示例13: Initialize
bool pawsConfigChatFilter::Initialize()
{
if (!LoadFromFile("configchatfilter.xml"))
return false;
return true;
}
示例14: m_jazzPath
//-----------------------------------------------------------------------------------------------
ResourceStream::ResourceStream( const std::string& fileToOpenForReading, bool failSilently )
: m_jazzPath( fileToOpenForReading )
, m_startOfData( NULL )
, m_currentReadOffset( 0 )
, m_dataBytesAvailable( 0 )
, m_capacity( 0 )
, m_internalFormat( RESOURCE_STREAM_FORMAT_INVALID )
, m_currentIndentationDepth( 0 )
, m_consecutiveNewLineCount( 1 )
, m_justWroteBlockBegin( false )
, m_justWroteBlockEnd( false )
, m_integrity( RESOURCE_STREAM_INTEGRITY_VALID )
{
// DEBUGGING - { int q = 5; } //ConsolePrintf( "ResourceStream is being constructed from JazzPath...\n" );
// { int q = 5; } //ConsolePrintf( "ResourceSteam being contructed from JazzPath, relative \"%s\" to marker #%d, resolved \"%s\".\n", fileToOpenForReading.GetRelativePathAsString().c_str(), fileToOpenForReading.GetFileFolderID(), fileToOpenForReading..c_str() );
LoadFromFile( fileToOpenForReading );
// { int q = 5; } //ConsolePrintf( "Finished loading ResourceStream from file \"%s\"; resource stream contains %d bytes (capacity=%d).\n", m_jazzPath..c_str(), m_dataBytesAvailable, m_capacity );
if( IsValid() )
{
{ int q = 5; } //ConsolePrintf( Rgba::GREY, "Loaded ResourceStream from file \"%s\"; resource stream contains %d bytes (capacity=%d).\n", m_jazzPath.c_str(), m_dataBytesAvailable, m_capacity );
}
else if( !failSilently )
{
{ int q = 5; } //ConsolePrintf( Rgba::RED, "FAILED TO LOAD ResourceStream from file \"%s\".\n", m_jazzPath..c_str() );
}
}
示例15: Initialize
bool pawsConfigSound::Initialize()
{
if ( ! LoadFromFile("configsound.xml"))
return false;
return true;
}