diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2019-10-01 20:50:28 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2019-10-01 20:50:28 -0400 |
commit | af39f2e08b0503db723ae707a5c7278d8c85f812 (patch) | |
tree | ad6ab6e51e1a7e30d72a28e2bac51b210fd22f6c /src/script.cpp | |
parent | bebc6e955114a0907c43df9a9c00f22b1f743446 (diff) |
Audio component loading, getting ready to play
Diffstat (limited to 'src/script.cpp')
-rw-r--r-- | src/script.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script.cpp b/src/script.cpp index 6cda627..20011b4 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -75,6 +75,7 @@ void ScriptSystem::doFile(void) /******************** * SCRIPT PARSING * ********************/ +#include <components/Audio.hpp> #include <components/EventListener.hpp> #include <components/Position.hpp> #include <components/Player.hpp> @@ -127,6 +128,10 @@ void ScriptSystem::scriptExport(void) sol::constructors<Physics(void), Physics()>(), "standing", &Physics::standing); + lua.new_usertype<Audio>("Audio", + sol::constructors<Audio(std::string)>(), + "file", &Audio::fileName); + lua.new_usertype<World>("World", sol::constructors<World(sol::object), World(void)>(), "Generate", &World::generate, @@ -173,6 +178,11 @@ sol::table ScriptSystem::spawn(sol::object param) e.assign<Name>(Name().FromLua(tab["Name"])).get(); } + if (tab["Audio"] != nullptr) { + (*toRet)["Audio"] = + e.assign<Audio>(Audio().FromLua(tab["Audio"])).get(); + } + if (tab["Render"] != nullptr) { if (!e.has_component<Position>()) // Position must exist for render (*toRet)["Position"] = e.assign<Position>().get(); |