Trang

26/1/13

Hướng dẫn tích hợp SMFL Audio vào Irrlicht


Hướng dẫn tích hợp SMFL Audio vào Irrlicht

Hiện mình dùng bản 1.5 do nó tương thích bản release và debug

Download SFML : http://www.sfml-dev.org/download.php

Giải nén :

Cài đặt đường dẫn trong VC++ :


Tích hợp trong chương trình Irrlicht :

 

#include

#ifdef _DEBUG

#pragma comment(lib, "sfml-audio-d.lib")//thu vien am thanh SFML debug

#else

#pragma comment(lib, "sfml-audio.lib")//thu vien am thanh SFML release

#endif

#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")

#endif

 

Code :
 //thêm các dòng sau trong tệp tin main.cpp
  sf::Music Music;

     if (!Music.OpenFromFile("footsteps.wav")) return EXIT_FAILURE;

      Music.SetLoop(true);

     // Play the music

    Music.Play();
...
Thêm các thư viện liên kết động vào cùng thư mục chương trình :
libsndfile-1.dll
sfml-audio.dll
sfml-audio-d.dll
sfml-system.dll
sfml-system-d.dll

Vậy là xong !

Bài đăng phổ biến