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


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

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


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

示例1:

_MEMBER_FUNCTION_IMPL(Audio, play)
{
	CAudio * pAudio = script_getinstance<CAudio *>(pVM);
	script_pushbool(pVM, pAudio->Play());
	return 1;
}
开发者ID:Dmitriy782,项目名称:iv-online,代码行数:6,代码来源: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::Play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。