bgnerdclub / birb

6 stars 0 forks source link

Transforms #19

Open jw2476 opened 6 months ago

jw2476 commented 6 months ago

Adds 2D transforms, due to their parent-child relationships, I decided to make transforms entities, meaning parents can be stored as entity IDs (also something I added in this branch). Entity IDs are unique IDs assigned to each entity, they're also unique across archetypes, so even a Transform and a Player entity won't share an ID. IDs can be stored in two formats, a typed entity ID which keeps track of the archetype as well as storing the ID, meaning you can require a specific type of entity, as done in the Transform type. There's also an untyped entity ID which just stores the ID with no type information, so you have to specify the type when getting the entity. This also renames and adds some base app methods

get_entity -> get_entities get_entity_mut -> get_entities_mut register_entity - now returns a TypedEntityID get_entity - new function that takes a TypedEntityID and spits out a reference to that entity get_entity_mut - new function that takes a TypedEntityID and spits out a mutable reference to that entity get_entity_untyped - new function that takes a UntypedEntityID and spits out a reference to that entity get_entity_untyped_mut - new function that takes a UntypedEntityID and spits out a mutable reference to that entity

I'm yet to benchmark the system of transforms as entities, and there are a couple things I'd like to do before merging, but I've made a lot of changes and I think a review would be good before moving forwards