44 lines
858 B
C++
44 lines
858 B
C++
#ifndef MEDIA_MANAGER_H
|
|
#define MEDIA_MANAGER_H
|
|
|
|
#include <cartridge/cartridge.h>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
extern "C" {
|
|
struct lua_State;
|
|
}
|
|
|
|
namespace wherigo {
|
|
|
|
class MediaManager {
|
|
public:
|
|
static MediaManager& getInstance();
|
|
|
|
void init(lua_State *L, cartridge::Cartridge *cartridge);
|
|
|
|
// Get media data by ZMedia object name (e.g., "Title Plate 1")
|
|
std::vector<uint8_t> getMediaByName(const std::string &name);
|
|
|
|
// Get media data by index
|
|
std::vector<uint8_t> getMediaByIndex(int index);
|
|
|
|
private:
|
|
MediaManager() = default;
|
|
|
|
void buildMediaIndex(lua_State *L);
|
|
|
|
lua_State *m_luaState = nullptr;
|
|
cartridge::Cartridge *m_cartridge = nullptr;
|
|
|
|
// Map from media name to cartridge object index
|
|
std::map<std::string, int> m_nameToIndex;
|
|
};
|
|
|
|
} // namespace wherigo
|
|
|
|
#endif // MEDIA_MANAGER_H
|
|
|