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