mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-26 06:34:57 +00:00
- 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.
42 lines
969 B
C++
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
|