Quillraven / Fleks

Fast, lightweight, multi-platform entity component system in Kotlin
MIT License
174 stars 19 forks source link

Component lifecycle methods #104

Closed geist-2501 closed 1 year ago

geist-2501 commented 1 year ago

This PR adds component lifecycle methods onAddComponent() and onRemoveComponent, which replaces the component hooks. As such, this PR also removes component hooks.

Discussion of this change can be found in issue #103.

The TL;DR of #103 is that lifecycle methods have are just a better developer experience over component hooks, with next to no performance hit.

Tests and code documentation have also been updated.

The removal of component hooks has resulted in slightly uglier tests, and I've pointed these out.

Quillraven commented 1 year ago

Thank you for your contribution! I have one minor remark about the test with the callback as system constructor argument. Should be possible to restructure the tests without using that.

Please have a look and then we are ready to merge 😁

geist-2501 commented 1 year ago

Replaced it with a much nicer getter in the test itself 👍

Quillraven commented 1 year ago

Cool, great stuff! I will make the SNAPSHOT release on maven tomorrow. And with that I will close the 2.4 features as well. I will do some testing on the weekend and if nothing crazy pops up, then we are good to go for the next stable release!

Thank you again for the support 🙏