feat: parent component
Currently add and remove have double meaning
- add instantiates the object and adds it to this (where this is the parent object or the root if omitted).
- remove detaches and destroys the object.
This means that once an object is created, it can't be attached to another parent. Calling add again fails because the object already has a parent. Removing before adding doesn't work because it gets destroyed.
To fix this, a parent component will provide a setter for the parent property.
Not adding a parent component will work like before. Specifying a parent component will override the parent and will provide a property to set the parent. Setting the parent to an object will move it in the hierarchy, it becomes the last child of the given parent. Setting the parent to null makes it the last child of the root.
Add and remove will obtain the function of add to the world and removing it from the world.
Detaching an object completely from the tree would still be impossible. It is debatable whether that is needed since you can exclude a subtree from update and draw being called.