35 lines
562 B
C++
35 lines
562 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <types/ptr/ref_counted.h>
|
|
|
|
struct Mix_Music;
|
|
|
|
namespace extra2d {
|
|
|
|
class Music : public RefCounted {
|
|
public:
|
|
Music();
|
|
~Music() override;
|
|
|
|
bool loadFromFile(const std::string &path);
|
|
void unload();
|
|
|
|
bool play(int loops = -1);
|
|
void stop();
|
|
void pause();
|
|
void resume();
|
|
|
|
bool isLoaded() const { return music_ != nullptr; }
|
|
bool isPlaying() const;
|
|
|
|
static bool initAudio();
|
|
static void shutdownAudio();
|
|
static bool isAudioReady();
|
|
|
|
private:
|
|
Mix_Music *music_ = nullptr;
|
|
};
|
|
|
|
} // namespace extra2d
|