craftyjs/Crafty — pull request #765 by starwed (2014-03-26 01:09:56+00:00)
Title: Decouple Crafty.pixelart from individual renderers

Currently `Crafty.pixelart()` explicitly alters the canvas and DOM renderers. This PR has it fire an event instead.

The canvas and DOM contexts now listen for the event, and make the appropriate changes. This will make it simpler to add new contexts (like webgl) or to introduce multiple renderers of the same type.

This patch also tracks the current pixelart setting, and ensures that, when a canvas context is inited, that it matches that value. It doesn't do something similar for the DOM element because the stage is created as soon as you init Crafty.

The WebGL renderer is what prompted me to whip up this patch, of course. :)