refactor: JA_* a namespace Ja:: (estil aee_arcade)
This commit is contained in:
@@ -33,7 +33,7 @@ namespace Resource {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
auto Cache::getMusic(const std::string& name) -> JA_Music_t* {
|
||||
auto Cache::getMusic(const std::string& name) -> Ja::Music* {
|
||||
auto it = std::ranges::find_if(musics_, [&](const auto& m) { return m.name == name; });
|
||||
if (it != musics_.end()) {
|
||||
return it->music.get();
|
||||
@@ -42,7 +42,7 @@ namespace Resource {
|
||||
throw std::runtime_error("Music not found: " + name);
|
||||
}
|
||||
|
||||
auto Cache::getSound(const std::string& name) -> JA_Sound_t* {
|
||||
auto Cache::getSound(const std::string& name) -> Ja::Sound* {
|
||||
auto it = std::ranges::find_if(sounds_, [&](const auto& s) { return s.name == name; });
|
||||
if (it != sounds_.end()) {
|
||||
return it->sound.get();
|
||||
@@ -192,12 +192,12 @@ namespace Resource {
|
||||
std::cerr << "Resource::Cache: no s'ha pogut llegir " << path << '\n';
|
||||
return;
|
||||
}
|
||||
JA_Music_t* music = JA_LoadMusic(bytes.data(), static_cast<Uint32>(bytes.size()), path.c_str());
|
||||
Ja::Music* music = Ja::loadMusic(bytes.data(), static_cast<Uint32>(bytes.size()), path.c_str());
|
||||
if (music == nullptr) {
|
||||
std::cerr << "Resource::Cache: JA_LoadMusic ha fallat per " << path << '\n';
|
||||
std::cerr << "Resource::Cache: Ja::loadMusic ha fallat per " << path << '\n';
|
||||
return;
|
||||
}
|
||||
musics_.push_back(MusicResource{.name = name, .music = std::unique_ptr<JA_Music_t, MusicDeleter>(music)});
|
||||
musics_.push_back(MusicResource{.name = name, .music = std::unique_ptr<Ja::Music, MusicDeleter>(music)});
|
||||
++loaded_count_;
|
||||
std::cout << " [music ] " << name << '\n';
|
||||
}
|
||||
@@ -213,12 +213,12 @@ namespace Resource {
|
||||
std::cerr << "Resource::Cache: no s'ha pogut llegir " << path << '\n';
|
||||
return;
|
||||
}
|
||||
JA_Sound_t* sound = JA_LoadSound(bytes.data(), static_cast<uint32_t>(bytes.size()));
|
||||
Ja::Sound* sound = Ja::loadSound(bytes.data(), static_cast<uint32_t>(bytes.size()));
|
||||
if (sound == nullptr) {
|
||||
std::cerr << "Resource::Cache: JA_LoadSound ha fallat per " << path << '\n';
|
||||
std::cerr << "Resource::Cache: Ja::loadSound ha fallat per " << path << '\n';
|
||||
return;
|
||||
}
|
||||
sounds_.push_back(SoundResource{.name = name, .sound = std::unique_ptr<JA_Sound_t, SoundDeleter>(sound)});
|
||||
sounds_.push_back(SoundResource{.name = name, .sound = std::unique_ptr<Ja::Sound, SoundDeleter>(sound)});
|
||||
++loaded_count_;
|
||||
std::cout << " [sound ] " << name << '\n';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user