This commit is contained in:
2026-01-04 15:54:28 +00:00
parent 41b58afc69
commit 6b98369bd7
22 changed files with 545 additions and 126 deletions

View File

@@ -1,5 +1,6 @@
#include "script_engine_service.hpp"
#include "../../script/lua_bindings.hpp"
#include "../../script/script_engine.hpp"
#include <stdexcept>
#include <utility>
@@ -8,8 +9,14 @@ namespace sdl3cpp::services::impl {
ScriptEngineService::ScriptEngineService(const std::filesystem::path& scriptPath,
std::shared_ptr<ILogger> logger,
std::shared_ptr<IMeshService> meshService,
std::shared_ptr<IAudioCommandService> audioCommandService,
std::shared_ptr<IPhysicsBridgeService> physicsBridgeService,
bool debugEnabled)
: logger_(std::move(logger)),
meshService_(std::move(meshService)),
audioCommandService_(std::move(audioCommandService)),
physicsBridgeService_(std::move(physicsBridgeService)),
scriptPath_(scriptPath),
debugEnabled_(debugEnabled) {
}
@@ -26,7 +33,12 @@ void ScriptEngineService::Initialize() {
}
logger_->TraceFunction(__func__);
engine_ = std::make_unique<script::ScriptEngine>(scriptPath_, debugEnabled_);
bindingContext_ = std::make_shared<script::LuaBindingContext>();
bindingContext_->meshService = meshService_;
bindingContext_->audioCommandService = audioCommandService_;
bindingContext_->physicsBridgeService = physicsBridgeService_;
engine_ = std::make_unique<script::ScriptEngine>(scriptPath_, bindingContext_.get(), debugEnabled_);
initialized_ = true;
logger_->Info("Script engine service initialized");