should i allow components to run code upon creation? refactor this case into a texture retrieval system or refactor my component storage to be an array, keep the entity id only visible to the component itself and save the :once :result id explicitly in the component?

sigh

the more i edit my suggestions, the less they make sense to me... ah imma stop for today. i already refactored my components to be functions receiveing their entityid, but that is nonsense of course xD... so this is where im at: i need to look up the texture tuple inside the hotloop, so i call get-in it :once entity-id :result to get that, so i can save it in the component instead of looking it up all the time... but.. here is the catch, maube it is more effic to look it up all the time instead of lugging it (well, probably a reference... (worry is creeping over her face, what if it's not a ref?... of course it is is not a reference you $%&! look, you are calling tuple/brackets to copy it because at one point it was trying to evaluate once-upon-a-texture as a function because you are quoting the whole let out to have your dumb editor syntax assist you...)) around

(component+ :lenna :sprite
  '(let [entity-id :lenna
         it (dyn :instructiontable)
         once-upon-a-texture (get-in it [:once entity-id :result])]
      @{:entity entity-id :texture (tuple/brackets ;once-upon-a-texture) :tint (array/new-filled 4 0xff) :position @{:x 0 :y 0} :timingoffset (hash (get-in it [:time :app]))}))

You must log in to comment.