week11
鍵盤 聲音 滑鼠、轉動
像前幾周一樣下載freeglut 並開啟
week11-1
*按下Sources 中的Main.pp
Ctrl+F尋找key
Ctrl+F尋找key
#include <GL/glut.h>
void display(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
void keyboard(unsigned char key, int x, int y){
if(key == 27) exit(1234);///step 01-1
}
int main(int argc, char *argv[]){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week11");
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);///step 01-1
glutMainLoop();
}
按123會有聲音
week11-2
#include <windows.h>
#include <GL/glut.h>
void display(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
void keyboard(unsigned char key, int x, int y){
if(key == '1') PlaySound("C:\\Users\\Administrator\\Desktop\\do-re-mi\\do.wav", NULL, SND_ASYNC);
if(key == '2') PlaySound("C:\\Users\\Administrator\\Desktop\\do-re-mi\\re.wav", NULL, SND_ASYNC);
if(key == '3') PlaySound("C:\\Users\\Administrator\\Desktop\\do-re-mi\\mi.wav", NULL, SND_ASYNC);
}
int main(int argc, char *argv[]){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week11");
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);///step 01-1
glutMainLoop();
}
不用GLUT專案做出同樣效果
week11-3
*先設定setting -> compiler -> Linker setting -> winmm
#include <windows.h>
#include <stdio.h>
int main(int argc, char *argv[]){
PlaySound("C:\\Users\\Administrator\\Desktop\\do-re-mi\\do.wav", NULL, SND_SYNC);
PlaySound("C:\\Users\\Administrator\\Desktop\\do-re-mi\\re.wav", NULL, SND_SYNC);
PlaySound("C:\\Users\\Administrator\\Desktop\\do-re-mi\\mi.wav", NULL, SND_SYNC);
printf("Hello World\n");
}
把YOUTUBE轉MP3
*wav檔案較大較方便開啟
mp3檔案較小,有壓縮較麻煩
mp3檔案較小,有壓縮較麻煩
week11-4
在137行
#include "CMP3_MCI.h"
CMP3_MCI myMP3;
int main(int argc, char *argv[])
{
char filename[] = "C:/Users/Administrator/Desktop/do-re-mi/suzume.mp3";
myMP3.Load(filename);
myMP3.Play();
音樂放入資料夾
week11-5
如何github
1. 開啟 Git Bash
2. cd desktop 進入桌面
git clone https://github.com/jsyeh/2021cce2 把雲端複製下來
cd 2021cce2 進入你的目錄
3. 把你的 桌面\2021cce2 裡面, 放好你本週的程式 ex. week06 裡面有今天的程式
4. 先把你放好的程式,加入 git 的帳冊
git status (看到紅紅的檔案)
git add .
git status (看到綠綠的檔案)
5. 你要 commit 它
git config --global user.email jsyeh@mail.mcu.edu.tw
git config --global user.name jsyeh
git commit -m "add week06"
6. git push 推送上雲端







沒有留言:
張貼留言