1. NeHe Lesson32
遊戲畫面
2.聲音
1. #include <mmsystem.h>
2. void mouse(int button,int state,int x,int y)
{
PlaySound("C:\\Users\\user\\Desktop\\Lesson32\\data/shot.wav",NULL,SND_ASYNC);
}
3. glutMouseFunc(mouse);
keyboard
1. void keyboard(unsigned char key,int x,int y)
{
if(key=='1') PlaySound("do.wav",NULL,SND_ASYNC);
if(key=='2')PlaySound("re.wav",NULL,SND_ASYNC);
if(key=='3')PlaySound("mi.wav",NULL,SND_ASYNC);
if(key=='4')PlaySound("fa.wav",NULL,SND_ASYNC);
if(key=='5')PlaySound("so.wav",NULL,SND_ASYNC);
}
2. glutKeyboardFunc(keyboard);
播歌
#include "CMP3_MCI.h" 放在專案檔目錄中
CMP3_MCI meMP3; 宣告
meMP3.Load("C:\\Users\\user\\Desktop\\freeglut\\yukai.mp3");
meMP3.Play();
沒有留言:
張貼留言