data-oriented-pyglet icon indicating copy to clipboard operation
data-oriented-pyglet copied to clipboard

Make systems more convenient to call

Open Permafacture opened this issue 8 years ago • 0 comments

Step 1) make a function that returns a function that takes care of the boiler plate. Ie (from examples/polygons.py):

  render_verts =('render_verts','poly_verts','position','rotator')
  broadcast = ('position__to__poly_verts',)
  sections = get_sections(render_verts + broadcast)
  indices = sections.pop(broadcast[0])
  update_render_verts(*(sections[name] for name in render_verts),indices=indices)

should become

  convinient_update_render_verts('render_verts','poly_verts','position','rotator', 
      indicies = 'position__to__poly_verts')

step 2) make it a decorator

    @system
    def update_render_verts(render_verts, poly_verts, ...)

Permafacture avatar Oct 02 '16 00:10 Permafacture