Files
SDL3CPlusPlus/src/script/audio_manager.hpp
johndoe6345789 e9b944680c feat: Enhance ScriptEngine with Shader and Scene Management
- Added ShaderManager to handle shader paths loading from Lua.
- Integrated SceneManager for managing scene objects within ScriptEngine.
- Updated ScriptEngine to utilize ShaderManager and SceneManager.
- Refactored audio command handling to use AudioManager.
- Improved error handling and Lua integration for shader and scene loading.
- Cleaned up code structure and dependencies in script_engine.hpp.
2026-01-04 00:05:05 +00:00

42 lines
969 B
C++

#pragma once
#include <lua.hpp>
#include <filesystem>
#include <string>
#include <vector>
namespace sdl3cpp::app {
class AudioPlayer;
}
namespace sdl3cpp::script {
class AudioManager {
public:
enum class AudioCommandType {
Background,
Effect
};
struct AudioCommand {
AudioCommandType type;
std::string path;
bool loop;
};
explicit AudioManager(const std::filesystem::path& scriptDirectory);
void SetAudioPlayer(app::AudioPlayer* audioPlayer);
bool QueueAudioCommand(AudioCommandType type, std::string path, bool loop, std::string& error);
private:
std::filesystem::path scriptDirectory_;
app::AudioPlayer* audioPlayer_ = nullptr;
std::vector<AudioCommand> pendingAudioCommands_;
void ExecuteAudioCommand(app::AudioPlayer* player, const AudioCommand& command);
std::filesystem::path ResolveScriptPath(const std::string& requested) const;
};
} // namespace sdl3cpp::script