You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A nice sideeffect that I did not think of prior is, that you can easily navigate to the Component in question (in this case Position) without jumping to the definition of the mapper first. I find myself using that quite often.
Do you see any downsides to this?
I'd be happy to create a PR :)
The text was updated successfully, but these errors were encountered:
If you can get the tests to work despite #60 then go ahead with your PR.
Though I would prefer it if the getComponent method returns a T instead of a T? and used the [] operator instead of getSafe. And return T? with a getOptionalComponent that uses OptionalMapper. Or is there a reason you are doing it your way?
The only downsides I can think of at the moment (but they are negligible because you can still use the manual/generated way depending on your personal preferences):
it could be a (very low key) performance issue in EntityComponentSystems when iterating over a lot of entities and each time getting all required mappers by accessing a map, especially in systems that don't do much else (but overall it should be very minuscule and ignorable because you usually do a lot more)
it's a bit more typing when accessing a component (with IDE and content assist) pos ctrl+space enter [entity]; vs getC ctrl+space enter <Position>(entity); but that's just lazy me and I've removed that part for me a different way.
I am so used to dartemis_builder I never create my mappers manually anyway. I don't know if you have looked at it, but with it a MovementSystem would look like this, and there would be no need to create or access mappers:
I made the manual creation of
Mapper
s in my project obsolete.It works nicely for me that way but it would be better suited in the library itself.
The
MapperSystem
holds aMap
with the mappers by type.This does not need to be a system and could be integrated in
World
.To access this conveniently, I have two extensions:
It can then be used like this:
A nice sideeffect that I did not think of prior is, that you can easily navigate to the
Component
in question (in this casePosition
) without jumping to the definition of the mapper first. I find myself using that quite often.Do you see any downsides to this?
I'd be happy to create a PR :)
The text was updated successfully, but these errors were encountered: