<!--
/* Font Definitions */
@font-face
{font-family:宋體;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"/@宋體";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋體;
mso-font-kerning:1.0pt;}
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
{margin-top:0cm;
margin-right:0cm;
margin-bottom:6.0pt;
margin-left:0cm;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋體;
mso-font-kerning:1.0pt;}
p.MsoBodyTextFirstIndent, li.MsoBodyTextFirstIndent, div.MsoBodyTextFirstIndent
{mso-style-update:auto;
mso-style-parent:本文;
mso-style-link:" Char Char";
margin:0cm;
margin-bottom:.0001pt;
text-indent:19.85pt;
mso-pagination:none;
font-size:10.5pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋體;
mso-ansi-language:ZH-CN;}
span.CharChar
{mso-style-name:" Char Char";
mso-style-locked:yes;
mso-style-link:本文首行縮排;
mso-ansi-font-size:10.5pt;
mso-bidi-font-size:10.5pt;
font-family:宋體;
mso-fareast-font-family:宋體;
mso-ansi-language:ZH-CN;
mso-fareast-language:ZH-CN;
mso-bidi-language:AR-SA;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
當對
DirectAudio設定完畢後,我們回到
OpenGL中。對
OpenGL的初始化函數
glInit和主迴圈函數
glMain不需要任何更改,需要的是對輸入響應函數
KeyPressed進行修改,當按滑鼠左鍵時開始播放音樂,按右鍵時停止播放音樂。
int KeyPressed()
{
if(buffer[DIK_ESCAPE])
//
這裡的值都是DIK_***
,而不是VK_***
return FALSE;
……
//
前面對鍵盤方向鍵的處理不變
//
按滑鼠左鍵開始播放音樂
if(mouseState.rgbButtons[MOUSE_LEFT] &
0x80)
{
//
播放音樂,迴圈次數為無限
DMPlay(&sound,
DMUS_SEG_REPEAT_INFINITE);
}
//
按滑鼠右鍵停止播放音樂
if(mouseState.rgbButtons[MOUSE_RIGHT] &
0x80)
{
DMStop(&sound);
}
return TRUE;
}