#include "game/scenes/scene_utils.hpp"

#include <string>

#include "core/audio/audio.hpp"

namespace Scenes {

    namespace {
        auto basename(const char* path) -> std::string {
            std::string s = path;
            auto pos = s.find_last_of("/\\");
            return pos == std::string::npos ? s : s.substr(pos + 1);
        }
    }  // namespace

    void playMusic(const char* filename, int loop) {
        if (filename == nullptr) {
            return;
        }
        Audio::get()->playMusic(basename(filename), loop);
    }

}  // namespace Scenes
