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 @@ -32,7 +32,7 @@ namespace nfo {
3232 ** This class provides methods to register components, manage entities,
3333 ** add and remove components from entities, and run systems.
3434 */
35- class Registry {
35+ class Registry : public std ::enable_shared_from_this<Registry> {
3636 public:
3737 /* *
3838 * Register a component type in the registry.
@@ -257,10 +257,9 @@ namespace nfo {
257257 */
258258 void run_systems (const emscripten::val &ctx)
259259 {
260- emscripten::val registry = ctx[" libs" ].call <emscripten::val>(" getComponentSystem" )[" registry" ];
261260 std::vector<emscripten::val> systems_copy = _systems;
262261 for (emscripten::val &system : systems_copy)
263- system (registry , ctx);
262+ system (shared_from_this () , ctx);
264263 }
265264
266265 /* *
You can’t perform that action at this time.
0 commit comments