File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ namespace nfo {
2727 emscripten::register_type<ZipperInput>(" Component[]" );
2828 emscripten::register_type<ZipperOutput>(" any[]" );
2929
30- emscripten::class_<Registry>(" Registry" )
31- .constructor ( )
30+ emscripten::class_<nfo:: Registry>(" Registry" )
31+ .smart_ptr_constructor ( " Registry " , &std::make_shared<Registry> )
3232 .function (" registerComponent" , &Registry::register_component)
3333 .function (
3434 " getComponentsConst" ,
Original file line number Diff line number Diff line change 2626#include " Utils.hpp"
2727
2828namespace nfo {
29- class Registry {
29+ class Registry : public std ::enable_shared_from_this<Registry> {
3030 public:
3131 SparseArray<emscripten::val> ®ister_component (const Component &c)
3232 {
@@ -162,10 +162,9 @@ namespace nfo {
162162
163163 void run_systems (const emscripten::val &ctx)
164164 {
165- emscripten::val registry = ctx[" libs" ].call <emscripten::val>(" getComponentSystem" )[" registry" ];
166165 std::vector<emscripten::val> systems_copy = _systems;
167166 for (emscripten::val &system : systems_copy)
168- system (registry , ctx);
167+ system (shared_from_this () , ctx);
169168 }
170169
171170 void log (const Entity &entity) const
You can’t perform that action at this time.
0 commit comments