HaxeFlixel/flixel — pull request #905 by jgranick (2014-02-28 04:17:15+00:00)
Title: Fix support for HTML5, smarter switching between render methods

These changes fix support for both openfl-html5-dom and openfl-bitfive in the FlxBunnyMark test.

I disabled some JS-specific code, related to rendering, in order to provide a "clean slate" to test against for rendering. I assume this code was designed for older version of openfl-html5, and (who knows?) some of these adjustments might cause problems. They are protected against defines, and can be enabled in the future as needed.

Most importantly, instead of using `flash` as the determinant for blit rendering, I have added FLX_RENDER_BLIT and FLX_RENDER_TILE defines, set through include.xml file to automatically change, depending on the target. For now, I think that blitting is the safest approach for HTML5, and is compatible with both backends. Perhaps in the future, a different HTML5 backend may perform best with tiles? If this becomes the case, setting the define differently should be able to switch the behavior. This also enables testing of blitting code on native platforms, and vice versa, in case that becomes useful in the future.

I had to disable loading audio from a ByteArray on HTML5 for the moment, I made it fail silently (or I believe so, FlxBunnyMark does not use sound, I don't think). If there is a way to do this in the future, this can be obviously be improved, but better to disable it than to fail compilation entirely.