void CAudioManager::Initialize( std::string audio_xml )
{
	m_pXA = CSGD_XAudio2::GetInstance();

	TiXmlDocument x_doc;
	x_doc.LoadFile( audio_xml.c_str() );
	//assert(x_doc.LoadFile( audio_xml.c_str()) != false && " Font XML file could not be loaded");
	TiXmlElement* x_pRoot = x_doc.RootElement();
	//assert( x_pRoot != nullptr && "XML root is NULL");
	TiXmlElement* x_pBGM = x_pRoot->FirstChildElement("BGM");
	TiXmlElement* x_pXWM = x_pBGM->FirstChildElement("XWM");

	XWM* song;
	std::string file;
	TOSTRINGSTREAM wss;

	while(x_pXWM != nullptr )
	{
		song = new XWM;
		song->file = x_pXWM->Attribute("file");

		wss.str(L"");
		wss << song->file.c_str();
		song->id =  m_pXA->MusicLoadSong( wss.str().c_str() );

		m_vBGM.push_back(song);
		x_pXWM = x_pXWM->NextSiblingElement("XWM");
	}


	TiXmlElement* x_pSFX = x_pBGM->NextSiblingElement("SFX");
	TiXmlElement* x_pWAV = x_pSFX->FirstChildElement("WAV");

	WAV* sound;

	while( x_pWAV != nullptr )
	{
		sound = new WAV;
		sound->file = x_pWAV->Attribute("file");

		wss.str(L"");
		wss << sound->file.c_str();
		sound->id = m_pXA->SFXLoadSound( wss.str().c_str() );

		m_vSFX.push_back(sound);
		x_pWAV = x_pWAV->NextSiblingElement("WAV");
	}
}
示例#2
0
///////////////////////////////////////////////////////////////////////////////
// TraceContents
///////////////////////////////////////////////////////////////////////////////
void cFSPropSet::TraceContents(int dl) const
{
    if(dl < 0) 
        dl = cDebug::D_DEBUG;

    cDebug d("cFSPropSet::TraceContents");

    TOSTRINGSTREAM ostr;
    ostr << _T("File Sysytem Prop Set: ");
    for(int i=0; i<GetNumProps(); i++)
    {
        if(mValidProps.ContainsItem(i))
        {
            ostr << _T("[") << i << _T("]") << GetPropName(i) << _T(" = ") << GetPropAt(i)->AsString().c_str() << _T(", ");
        }
    }
    d.Trace(dl, _T("%s\n"), ostr.str().c_str());

}
TSTRING cCharEncoderUtil::char_to_hex( TCHAR ch )
{
    TOSTRINGSTREAM ss;

    ss.imbue( std::locale::classic() );
    ss.fill ( _T('0') );
    ss.width( TCHAR_AS_HEX__IN_TCHARS );
    ss.setf( std::ios_base::hex, std::ios_base::basefield );

    ss << tss::util::char_to_size( ch );

    if( ss.bad() || ss.fail() || 
        ss.str().length() != TCHAR_AS_HEX__IN_TCHARS )
        ThrowAndAssert( eBadHexConversion( TSTRING( 1, ch ) ) );
    return ss.str();
}
///////////////////////////////////////////////////////////////////////////////
// SendFinit
///////////////////////////////////////////////////////////////////////////////
void cPipedMailMessage::SendFinit() //throw ( eMailMessageError )
{
    if (mpFile)
    {
#if !USES_MPOPEN
        int result = fclose(mpFile);
#else
        int result = mpclose(mpFile);
#endif
        if (result != 0)
        {
            TOSTRINGSTREAM estr;
            estr << TSS_GetString(cTripwire, tripwire::STR_ERR2_MAIL_MESSAGE_COMMAND) << mstrSendMailExePath;

            // uh oh! something bad has happened!
            throw eMailPipedCmdFailed(estr.str());
        }
    }
    mpFile = 0;
}
示例#5
0
void CGame::Create_Save_Load_Directory()
{
	char path[MAX_PATH];
	LPWSTR wszPath = NULL;
	size_t pathlen;

	HRESULT hr = SHGetKnownFolderPath( FOLDERID_LocalAppData, 0, 0, &wszPath); 
	wcstombs_s(&pathlen , path, wszPath, MAX_PATH);

	m_szFilepath = path;

	TOSTRINGSTREAM wss;
	 
	wss.str(L"");
	m_szFilepath += "\\Trials Of Mastery";
	wss << m_szFilepath.c_str();

	CreateDirectory(wss.str().c_str(),0);

	m_szFilepath += "\\save_slots.xml";
}
///////////////////////////////////////////////////////////////////////////////
// SendInit
///////////////////////////////////////////////////////////////////////////////
void cPipedMailMessage::SendInit() // throw( eMailMessageError )
{
    ASSERT(mpFile == 0);

    TSTRING strHeader;
    strHeader += cStringUtil::StrToTstr(cMailMessage::Create822Header());

#if !USES_MPOPEN
    mpFile = popen(mstrSendMailExePath.c_str(), _T("w"));
#else
    // call mpopen, our safe version popen
    mpFile = mpopen((char*)mstrSendMailExePath.c_str(), _T("w"));
#endif
    if (!mpFile)
    {
        TOSTRINGSTREAM estr;
        estr << TSS_GetString(cTripwire, tripwire::STR_ERR2_MAIL_MESSAGE_COMMAND) << mstrSendMailExePath;

        throw eMailPipedOpen(estr.str());
    }

    SendString(strHeader);
}
示例#7
0
void GameInfo::Display( int x, int y )
{
    CSGD_Direct3D* pD3D = CSGD_Direct3D::GetInstance();
    FontManager* pFont = CGame::GetInstance()->GetFont();
    CSGD_TextureManager* pTM = CSGD_TextureManager::GetInstance();

    pTM->Draw( m_nMenuArtid, x, y);

    TOSTRINGSTREAM wss;

    wss.str(L"");
    wss << "Stage 0" << m_nLevel;
    pFont->Draw( CHINESE_TAKEAWAY , wss.str().c_str(), x + 43, y+36, 0.5f,0.5f);

    wss.str(L"");
    wss << "EXP: " << m_nExpPts;
    pFont->Draw( CHINESE_TAKEAWAY , wss.str().c_str(), x + 201, y+36, 0.5f,0.5f);


    wss.str(L"");
    wss << m_nFireSpl;
    pFont->Draw( CHINESE_TAKEAWAY ,  wss.str().c_str(), x + 83, y + 78, 0.5f,0.5f);

    wss.str(L"");
    wss << m_nWindSpl;
    pFont->Draw( CHINESE_TAKEAWAY ,  wss.str().c_str(), x + 160, y + 78, 0.5f,0.5f);

    wss.str(L"");
    wss << m_nIceSpl;
    pFont->Draw( CHINESE_TAKEAWAY ,  wss.str().c_str(), x + 237, y + 78, 0.5f,0.5f);

    wss.str(L"");
    wss << m_nEarthSpl;
    pFont->Draw( CHINESE_TAKEAWAY ,  wss.str().c_str(), x + 304, y + 78,0.5f,0.5f);

}