blob: f323cc7985f1aa2260082464db3eae8087831715 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#pragma once
#include <unordered_map>
#include <string>
#include <SDL2/SDL.h>
#include <SDL2/SDL_mixer.h>
class AudioManager
{
std::unordered_map<std::string, Mix_Chunk*> sounds;
std::unordered_map<std::string, Mix_Music*> scores;
bool initialized = true;
public:
void playSound(std::string soundfile, float volume, bool looping = false);
void playMusic(std::string soundfile, float volume, bool looping = true, int fade_time = 0);
void stopMusic(int fade_time = 0);
AudioManager();
~AudioManager();
};
|