Irrlicht, Bullet, SFML and Lua - File system
Posted: Sun Mar 16, 2014 11:55 am
I am creating a game - the graphical rendering engine is Irrlicht, the Physics engine is Bullet, I'm going to use SFML for audio, and Lua for scripting.
While I'm having problem with integrating Bullet Physics into Irrlicht (loading Quake 3 maps, that is.... rather than applying physics to simple cubes and circles), I have decided to integrate audio.
Previously, I wrote a crude code that is supposed to handle audio.
I don't think it's going to work correctly.
Besides, I'm going to use archives to store game files - so I'll need to get them first.
So, I got my eyes on this little thing....
Which made me wonder - can I load sound buffers (and music) from the Irrlicht file system? (and the loaded map-20kdm2.pk3?)
While I'm having problem with integrating Bullet Physics into Irrlicht (loading Quake 3 maps, that is.... rather than applying physics to simple cubes and circles), I have decided to integrate audio.
Previously, I wrote a crude code that is supposed to handle audio.
Code: Select all
std::map<string,sf::Music*> Game_Music;
std::map<string,sf::SoundBuffer> Game_SoundBuffer;
std::map<string,sf::Sound*> Game_Sound;
void PlaySong(string song_to_play, float volume, float pitch)
{
Game_Music[song_to_play]->setRelativeToListener(true);
Game_Music[song_to_play]->setVolume(volume);
Game_Music[song_to_play]->setPitch(pitch);
Game_Music["Current Music"] = Game_Music[song_to_play];
Game_Music["Current Music"]->play();
};
void PlaySFX_absolute(string sound_to_play, float volume, float pitch)
{
sf::Sound* to_play = Game_Sound[sound_to_play];
to_play->setRelativeToListener(true);
to_play->setVolume(volume);
to_play->setPitch(pitch);
to_play->play();
};
void PlaySFX_3D(string sound_to_play, float volume, float pitch, float attenuation, float x, float y, float z)
{
sf::Sound* to_play = Game_Sound[sound_to_play];
to_play->setRelativeToListener(false);
to_play->setVolume(volume);
to_play->setPitch(pitch);
to_play->setAttenuation(attenuation);
to_play->setPosition(x, y, z);
to_play->play();
};
Besides, I'm going to use archives to store game files - so I'll need to get them first.
So, I got my eyes on this little thing....
Code: Select all
irrDevice->getFileSystem()->addFileArchive("../maps/map-20kdm2.pk3");