Пример #1
0
void SoundManager::addSound(const char* fileName, SOUND_TYPE type, bool isLoop)
{
    if (_dicSounds.at(fileName)) return;
    
    SoundData* data = new SoundData;
    data->setSoundKey(fileName);
    data->setSoundType(type);
    data->setIsLoop(isLoop);
    
    _dicSounds.insert(fileName, data);
    
    if (type == BGM)
    {
        SimpleAudioEngine::getInstance()->preloadBackgroundMusic(fileName);
    }
    else if (type == EFFECT)
    {
        SimpleAudioEngine::getInstance()->preloadEffect(fileName);
    }
    
    
}