Custom Renderer

There have been multiple discussions recently on discord or GitHub about how to properly support React Native, GCanvas or any other non "traditional’ (for the lack of other words) HTML5 canvas implementation.

So as part of the coming 14.3 release we have added the possibility to specify a custom renderer.

How it works :

  1. any custom renderer should extend the default Renderer class. Both the built-in Canvas and WebGL renderer are themselves extending this base Renderer class (see the source code for more details).
  2. to use the custom renderer, simply specify your Custom Renderer Class as the renderer attribute value.

To give a (very minimalist) example:

// create a custom renderer extending the default canvas one with one `isCustom` property
class CustomRenderer extends me.CanvasRenderer {
    constructor(options) {
        super(options);
        this.isCustom = true;
    }
}
// call video init, specifying the custom renderer
me.video.init(800, 600, {parent : "screen", scale : "auto", renderer : CustomRenderer});

to be noted that in this example we just extend the CanvasRenderer (that itself extends the base Renderer class) for convenience and add a custom properly

this has not been heavily tested yet with a proper custom renderer, but if anyone is working on one, please share your progress or custom renderer here, and if you stumble on any issue come to see us on our discord server.