amethyst / shred

Shared resource dispatcher
Apache License 2.0
237 stars 66 forks source link

Add `System::dispose` #119

Closed torkleyy closed 5 years ago

torkleyy commented 5 years ago

Requested by @Frizi.

System::dispose would be called by Dispatcher::dispose and can be used to clean up externally allocated resources.

Unresolved

LucioFranco commented 5 years ago

@torkleyy curious what is the difference between this and drop?

torkleyy commented 5 years ago

It has access to World, which is required for access to rendy::Factory in this case.

LucioFranco commented 5 years ago

@torkleyy that makes sense, I would imagine in that case a fn dispose(&mut self, world: &mut World) might make sense here.

torkleyy commented 5 years ago

Yeah, I think that makes sense.

torkleyy commented 5 years ago

Now, how do we make sure it gets called?

One option would be to set a flag when it gets called, and check it is set in Dispatcher::drop.