Added sounds
This commit is contained in:
1 parent
c6ba8bd008
commit
124208f2a4
26 files changed
+210
-36
No files matched your search
@@ -33,7 +33,7 @@ namespace ZL {
|
||||
ScriptEngine::ScriptEngine() = default;
|
||||
ScriptEngine::~ScriptEngine() = default;
|
||||
|
||||
void ScriptEngine::init(Location* loc, Inventory* inventory, const std::string& scriptPath) {
|
||||
void ScriptEngine::init(Location* loc, Inventory* inventory, AudioPlayerAsync* audioPlayer, const std::string& scriptPath) {
|
||||
impl = std::make_unique<Impl>();
|
||||
sol::state& lua = impl->lua;
|
||||
|
||||
@@ -773,6 +773,14 @@ namespace ZL {
|
||||
}
|
||||
});
|
||||
|
||||
api.set_function("play_sound",
|
||||
[audioPlayer](const std::string& soundPath) -> void {
|
||||
if (audioPlayer)
|
||||
{
|
||||
audioPlayer->playSoundAsync(soundPath);
|
||||
}
|
||||
});
|
||||
|
||||
lua.script_file(scriptPath);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user