mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 10:13:42 +00:00
instance changes in constructor and .cpp file for SoundManager
This commit is contained in:
parent
007538f760
commit
e215fbd5b6
@ -23,8 +23,13 @@ class SoundManager
|
||||
public:
|
||||
|
||||
SoundManager() {
|
||||
if (this_instance == nullptr) {
|
||||
this_instance = this;
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("SoundManager instance already exists!");
|
||||
}
|
||||
}
|
||||
~SoundManager() {
|
||||
for (auto& it : this->sound_cache) {
|
||||
Mix_FreeChunk(it.second);
|
||||
|
||||
@ -185,6 +185,8 @@ void SoundManager::addBackgroundMusic(const std::map<BackgroundMusic, const char
|
||||
addSingleBackgroundMusic(track.first, track.second);
|
||||
}
|
||||
|
||||
SoundManager* SoundManager::this_instance = nullptr;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user