add optional draw layers

If a property 'layers' is present and is an array, a set of 'draw-layer'
events will be emitted in addition to the usual draw event. This allows
entities to keep track of a z-index and draw in an appropriate plane,
without interfering with the current behaviour.