2017年4月24日 星期一

2017 Week10 ID張凱盛

進入http://nehe.gamedev.net




下載visul c++




試玩小遊戲


開啟GLUT檔
加入聲音
#include <mmsystem.h>
void mouse(int button, int state, int x, int y)
{
    PlaySound("C:\\Users\\user\\Desktop\\Lesson32\\data/shot.wav",NULL,SND_ASYNC);
}

glutMouseFunc(mouse);



輸入鍵盤發聲
glutKeyboardFunc(keyboard);

void keyboard(unsigned char key, int x,int y)
{
    if(key=='1') PlaySound("1.WAV",NULL,SND_ASYNC);
    if(key=='2') PlaySound("2.WAV",NULL,SND_ASYNC);
    if(key=='3') PlaySound("3.WAV",NULL,SND_ASYNC);
    if(key=='4') PlaySound("4.WAV",NULL,SND_ASYNC);
    if(key=='5') PlaySound("5.WAV",NULL,SND_ASYNC);
}


播MP3檔

#include "CMP3_MCI.h"
CMP3_MCI myMP3;

main
 myMP3.Load("C:/Users/user/Desktop/2017/Mozart1.mp3");
 myMP3.Play();












沒有留言:

張貼留言