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


C++ LoadFromFile函数代码示例

本文整理汇总了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);
};
开发者ID:shaxbee,项目名称:maszyna,代码行数:60,代码来源:Sound.cpp

示例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);
}
开发者ID:Fumasu,项目名称:MazeGame,代码行数:9,代码来源:Shader.cpp

示例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);
    }
}
开发者ID:Ravennholm,项目名称:game,代码行数:9,代码来源:mapzones.cpp

示例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);

}
开发者ID:yuanfen1,项目名称:G_557_2015_YC,代码行数:17,代码来源:Shaders.cpp

示例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");
}
开发者ID:anaconda,项目名称:xbmc,代码行数:15,代码来源:FavouritesService.cpp

示例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;
}
开发者ID:cedeel,项目名称:MCServer,代码行数:48,代码来源:Player.cpp

示例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;
        }
    }
}
开发者ID:Panzareon,项目名称:RoguePG,代码行数:30,代码来源:NameGenerator.cpp

示例8: IsEditorMode

void Ide::LoadLastMain()
{
	bool editor = IsEditorMode();
	LoadFromFile(THISBACK(SerializeLastMain), ConfigFile("lastmain.cfg"));
	if(editor)
		main <<= Null;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:7,代码来源:Config.cpp

示例9: main

int main() {
	MyTree<int>* root = CreateEmptyTree<int>();
	LoadFromFile(root, "C:\\input.txt");
	Square(root);
	SaveToFile(root, "C:\\out.txt");
	DeleteTree(root);
}
开发者ID:GZNigmatzyanova,项目名称:KPFUExercises,代码行数:7,代码来源:Обход+дерева+стеком.cpp

示例10: Initialize

bool pawsConfigPopup::Initialize()
{
    if (!LoadFromFile("configpopup.xml"))
        return false;

    return true;
}
开发者ID:Chettie,项目名称:Eulora-client,代码行数:7,代码来源:pawsconfigpopup.cpp

示例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);
}
开发者ID:LucasvBerkel,项目名称:TweedejaarsProject,代码行数:47,代码来源:DOCUMENT.CPP

示例12: LoadFromFile

Bitmap::Bitmap(const WCHAR *path) {
	data = NULL;
	xOffsets = NULL;
	yOffsets = NULL;
	
	LoadFromFile(path);
}
开发者ID:damianGray77,项目名称:SoftwareRenderer,代码行数:7,代码来源:Bitmap.cpp

示例13: Initialize

bool pawsConfigChatFilter::Initialize()
{
    if (!LoadFromFile("configchatfilter.xml"))
        return false;

    return true;
}
开发者ID:garinh,项目名称:planeshift,代码行数:7,代码来源:pawsconfigchatfilter.cpp

示例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() );
	}
}
开发者ID:SquirrelEiserloh,项目名称:Rules-of-Enragement,代码行数:27,代码来源:ResourceStream.cpp

示例15: Initialize

bool pawsConfigSound::Initialize()
{
    if ( ! LoadFromFile("configsound.xml"))
        return false;

    return true;
}
开发者ID:randomcoding,项目名称:PlaneShift-PSAI,代码行数:7,代码来源:pawsconfigsound.cpp


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