public/js-roguelike-skeleton/src/renderer.js
function Renderer(game, width, height, tileSize, canvasClassName) {
        this.layers = [];
        this.game = game;
        this.canvas = document.createElement('canvas');
        this.ctx = this.canvas.getContext('2d');
        this.canvas.className = canvasClassName || 'renderer';
        this.buffer = this.canvas.cloneNode();
        this.bufferCtx = this.buffer.getContext('2d');
        this.tileSize = tileSize || this.tileSize;
        this.resize(width, height);

    }
function Renderer(game, width, height, tileSize, canvasClassName) {
        this.layers = [];
        this.game = game;
        this.canvas = document.createElement('canvas');
        this.ctx = this.canvas.getContext('2d');
        this.canvas.className = canvasClassName || 'renderer';
        this.buffer = this.canvas.cloneNode();
        this.bufferCtx = this.buffer.getContext('2d');
        this.tileSize = tileSize || this.tileSize;
        this.resize(width, height);

    }
function Renderer ( game , width , height , tileSize , canvasClassName ) { this . layers = [ ] ; this . game = game ; this . canvas = document . createElement ( 'canvas' ) ; this . ctx = this . canvas . getContext ( '2d' ) ; this . canvas . className = canvasClassName || 'renderer' ; this . buffer = this . canvas . cloneNode ( ) ; this . bufferCtx = this . buffer . getContext ( '2d' ) ; this . tileSize = tileSize || this . tileSize ; this . resize ( width , height ) ; }
Renders the current game state using html5 canvas.
@class Renderer
@constructor
@param {Game} game - Game instance this obj is attached to.
@param {Number} width - Width of the map view in tiles.
@param {Number} height - Height of the map view in tiles.
@param {Number} tileSize - Width and height of tiles when drawn.
@param {String} [canvasClassName='renderer'] - Css class name for the canvas element.
Renders the current game state using html5 canvas .