#include<mmsystem.h>
#include<stdio.h>
void display()
{
glutSolidTeapot(0.3);
glFlush(); //弄出一個茶壺
}
void keyboard(unsigned char key,int x,int y)
{
if(key=='a')
{
printf("AAA\n"); //如果打A會出現aaa
}
else if(key=='b')
{
printf("BBB\n");
}
}
void keyboard(unsigned char key, int x,int y)
{
if(key=='1')PlaySound("Do.WAV",NULL,SND_ASYNC); //(檔名,NULL,播放模式)
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);
if(key=='6')PlaySound("La.WAV",NULL,SND_ASYNC);
if(key=='7')PlaySound("Si.WAV",NULL,SND_ASYNC); //如果打1234567會出現聲音
}
void mouse(int button,int state,int x,int y)
{
printf("Playing sound\n");
PlaySound("atchoum.wav",NULL,SND_ASYNC); //滑鼠點擊會執行
}
int main(int argc,char **argv)
{
glutInit(&argc, argv);
glutCreateWindow("hello");
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
glutMouseFunc(mouse);
glutMainLoop();
}
沒有留言:
張貼留言