2018年6月2日 星期六

Week12 計時器

主題: 計時器 / 內插 / 線性內插 / 動畫

 playSound  MP3播放
(1) 建立GLUT project
(2) 把 CodeBlock的 .cbp檔 裡的working-dir 改成 "."
(3) 把C:\Users\user\Desktop\freeglut\bin\freeglut.dll copy and paste in your project file

(4) #include"CMP3_MCI.h"
      CMP3_MCI mymp3;
      int main(int argc, char *argv[])
      {
          mymp3.Load("Do.mp3");
          mymp3.Play();
          ...
          ...
      }


計時器
(1) int main(int argc, char *argv[]){
          ....
          glutCreateWindow("GLUT Shapes");
          glutTimerFunc(2000, timer, 0); // 要在 glutCreateWindow() 之後,
          ....
      }
(2) void timer(int t){
         glutTimerFunc(1000, timer, 0);
         PlaySound("Do.wav", NULL, SND_ASYNC);
  }


內插
new*alpha+old*(1-alpha)







沒有留言:

張貼留言