2015年4月8日 星期三

week07 02161095 陳薇亘

#include <GL/glut.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");
    }
    if(key=='b'){
        printf("bbb\n");
    }


}
int main(int argc,char **argv)
{
    glutInit(&argc,argv);
    glutCreateWindow("hello");
    glutDisplayFunc(display);

    glutKeyboardFunc(keyboard);//呼叫鍵盤
    glutMainLoop();

}

#include <GL/glut.h>
#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");
    }
    if(key=='b'){
        printf("bbb\n");
    }


}
void mouse(int botton,int state,int x,int y)//按滑鼠加入音樂
{
    printf("播放\n");
    PlaySound("fart.wav",NULL,SND_ASYNC);
}
int main(int argc,char **argv)
{
    glutInit(&argc,argv);
    glutCreateWindow("hello");
    glutDisplayFunc(display);

    glutKeyboardFunc(keyboard);
    glutMouseFunc(mouse);//增加滑鼠
    glutMainLoop();

}
#include <GL/glut.h>
#include <mmsystem.h>//聲音
#include <stdio.h>
void display()
{
    glutSolidTeapot(0.3);
    glFlush();
}
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("Sol.wav",NULL,SND_ASYNC);
    if(key=='6')PlaySound("La.wav",NULL,SND_ASYNC);
    if(key=='7')PlaySound("Si.wav",NULL,SND_ASYNC);
}
void mouse(int botton,int state,int x,int y)
{
    printf("播放\n");
    PlaySound("fart.wav",NULL,SND_ASYNC);
}
int main(int argc,char **argv)
{
    glutInit(&argc,argv);
    glutCreateWindow("hello");
    glutDisplayFunc(display);

    glutKeyboardFunc(keyboard);
    glutMouseFunc(mouse);
    glutMainLoop();

}

沒有留言:

張貼留言