DirectX SDK下載與設定

DirectX SDK下載與設定

DirectX本是用於取替OpenGL給遊戲廠商使用.但遊戲廠商集體反抗.才另microsoft支持OpenGL.而且自DirectX6全面使用COM模型開發.DirectX是設計用於『影片』『聲音』『輸入』『網絡』抽象軟件界面結口.DirectX接口由microsoft定義.而底層則有驅動程式與硬件進行通信.開發者完全無需理會硬件之間差異.如果硬件不支持則由DirectX進行模擬.

  1. DirectX SDK 下載『DirectX Software Development Kit
  2. 下載『exe』運行後自動進行解壓.
  3. 其實你只需要『Lib』與『Include』這兩個『資料夾』.『Lib』下面分別有『x86』與『x64』
  4. 接下來讓工程生成『DirectX』目錄並複製『Lib』與『Include』下所有『頭文檔』與『庫文檔』
  5. 包含『頭文檔』

#include “..\DirectX\Include\ddraw.h”

#include “..\DirectX\Include\dinput.h”

#include “..\DirectX\Include\dsound.h”

  1. 包含『庫文檔』你編譯時需要分開x86與x64的LIB文檔

#ifdef  _WIN64

#pragma comment(lib, “DirectX\Lib\x64\ddraw.LIB”)

#pragma comment(lib, “DirectX\Lib\x64\dinput8.LIB”)

#pragma comment(lib, “DirectX\Lib\x64\dxguid.LIB”)

#pragma comment(lib, “DirectX\Lib\x64\dsound.LIB”)

#else

#pragma comment(lib, “DirectX\Lib\x86\ddraw.LIB”)

#pragma comment(lib, “DirectX\Lib\x86\dinput8.LIB”)

#pragma comment(lib, “DirectX\Lib\x86\dxguid.LIB”)

#pragma comment(lib, “DirectX\Lib\x86\dsound.LIB”)

#endif

 

上面方法是指定工程目錄.令外你還可制定Visual Studio搜索目錄:

  1. 設定『項目』『屬性』『VC++目錄』.然後分別設定『Include目錄』與『程式庫目錄』
  2. 『Include目錄』包含『D:\ DirectX\Include』.
  3. Win32平臺『程式庫目錄』包含『D:\DirectX\Lib\x64』
  4. Win64平臺『程式庫目錄』包含『D:\DirectX\Lib\x86』
  5. 在包含『頭文檔』與『庫文檔』時無需設定相對路徑

 

在DirectX8之前分別使用DirectSound和DirectMusic處理音頻播放. DirectSound用于處理聲波回放和捕足,而DirectMusic則是加載和播放所有聲音主要組件.但在DirectX8之後合平DirectXAudio組件.若你需要播放MIDI睇『DirectMusic之播放MIDI

 

 

 

評論