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


C++ CAudio::Load方法代码示例

本文整理汇总了C++中CAudio::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ CAudio::Load方法的具体用法?C++ CAudio::Load怎么用?C++ CAudio::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAudio的用法示例。


在下文中一共展示了CAudio::Load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CAudio

_MEMBER_FUNCTION_IMPL(Audio, constructor)
{
	bool sqbIsOnlineStream;
	script_getbool(pVM, -3, &sqbIsOnlineStream);
	bool bIsOnlineStream = (sqbIsOnlineStream != 0);

	bool sqbReplay;
	script_getbool(pVM, -2, &sqbReplay);
	bool bReplay = (sqbReplay != 0);

	const char * szSoundName;
	script_getstring(pVM, -1, &szSoundName);

	CAudio * pAudio = new CAudio(szSoundName, bReplay, bIsOnlineStream);

	///SQ metatable = null
	if(!pAudio || !pAudio->Load() || script_setinstance(pVM, pAudio, &_CLASS_DECL(Audio)) != 0)
	{
		CLogFile::Printf("Failed to load audio from file %s",szSoundName);
		SAFE_DELETE(pAudio);
		script_pushnull(pVM);
		return 1;
	}

	g_pClient->GetAudioManager()->Add(pAudio);
	//script_pushbool(pVM, true);
	return 1;
}
开发者ID:Dmitriy782,项目名称:iv-online,代码行数:28,代码来源:AudioNatives.cpp

示例2: WndProc_Hook

LRESULT APIENTRY WndProc_Hook(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    bool bFocused = (GetForegroundWindow() == hWnd);

	// Update HWND state..
	if(bFocused != g_pCore->GetGame()->IsFocused())
		g_pCore->GetGame()->SetFocused(bFocused);

    // Are we focused?
    if(bFocused)
    {
		if (g_pCore->GetGraphics()->GetGUI())
			g_pCore->GetGraphics()->GetGUI()->HandleUserInput(uMsg, wParam);

		if(uMsg == WM_KILLFOCUS || (uMsg == WM_ACTIVATE && LOWORD(wParam) == WA_INACTIVE))
		{
			return true;
		}

		if(uMsg == WM_KEYUP)
		{
			switch(wParam)
			{
				case VK_F7:
				{
					const char *szSoundName = "test.mp3";
					szSoundName = SharedUtility::GetAbsolutePath("resources\\%s", szSoundName);

					CAudio  *pAudio = new CAudio(szSoundName, false, false);
					
					if (pAudio && pAudio->Load())
					{
						g_pCore->GetAudioManager()->Add(pAudio);
						pAudio->Play();
					}
					break;
				}
				case VK_ESCAPE: // Our own main menu
				{
					g_pCore->GetGraphics()->GetMainMenu()->SetVisible(!g_pCore->GetGraphics()->GetMainMenu()->IsMainMenuVisible());	

					if (g_pCore->GetGraphics()->GetMainMenu()->IsMainMenuVisible()) {
						g_pCore->GetGame()->GetLocalPlayer()->SetPlayerControlAdvanced(false, false);
					}
					else {
						g_pCore->GetGame()->GetLocalPlayer()->SetPlayerControlAdvanced(true, true);
					}

					break;
				}
				case VK_F8:
				{
					// Take a screen shot
					if(!CSnapShot::Take())
					{
						g_pCore->GetGraphics()->GetChat()->Print(CString("Screen shot capture failed (%s).", CSnapShot::GetError().Get()));
						CSnapShot::Reset();
					}
					break;
				}
			}
		}

		if(g_pCore->GetGraphics()->GetChat())
			 g_pCore->GetGraphics()->GetChat()->HandleUserInput(uMsg, wParam);
    }

    return CallWindowProc(m_wWndProc, hWnd, uMsg, wParam, lParam);
}
开发者ID:Disinterpreter,项目名称:IV-Network,代码行数:69,代码来源:Input.cpp


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