diff --git a/src/pixi/renderers/CanvasRenderer.js b/src/pixi/renderers/CanvasRenderer.js index 3158d42..a028fb5 100644 --- a/src/pixi/renderers/CanvasRenderer.js +++ b/src/pixi/renderers/CanvasRenderer.js @@ -8,8 +8,9 @@ * @class CanvasRenderer * @param width {Number} the width of the canvas view * @param height {Number} the height of the canvas view + * @param view {Canvas} the canvas to use as a view, optional */ -PIXI.CanvasRenderer = function(width, height) +PIXI.CanvasRenderer = function(width, height, view) { /** * The width of the canvas view @@ -33,7 +34,7 @@ * @property view * @type Canvas */ - this.view = document.createElement( 'canvas' ); + this.view = view ? view : document.createElement( 'canvas' ); // hack to enable some hardware acceleration! //this.view.style["transform"] = "translatez(0)"; diff --git a/src/pixi/renderers/CanvasRenderer.js b/src/pixi/renderers/CanvasRenderer.js index 3158d42..a028fb5 100644 --- a/src/pixi/renderers/CanvasRenderer.js +++ b/src/pixi/renderers/CanvasRenderer.js @@ -8,8 +8,9 @@ * @class CanvasRenderer * @param width {Number} the width of the canvas view * @param height {Number} the height of the canvas view + * @param view {Canvas} the canvas to use as a view, optional */ -PIXI.CanvasRenderer = function(width, height) +PIXI.CanvasRenderer = function(width, height, view) { /** * The width of the canvas view @@ -33,7 +34,7 @@ * @property view * @type Canvas */ - this.view = document.createElement( 'canvas' ); + this.view = view ? view : document.createElement( 'canvas' ); // hack to enable some hardware acceleration! //this.view.style["transform"] = "translatez(0)"; diff --git a/src/pixi/renderers/WebGLRenderer.js b/src/pixi/renderers/WebGLRenderer.js index 3fb2740..d2177f3 100644 --- a/src/pixi/renderers/WebGLRenderer.js +++ b/src/pixi/renderers/WebGLRenderer.js @@ -13,13 +13,14 @@ * @default 0 * @param height {Number} the height of the canvas view * @default 0 + * @param view {Canvas} the canvas to use as a view, optional */ -PIXI.WebGLRenderer = function(width, height) +PIXI.WebGLRenderer = function(width, height, view) { this.width = width ? width : 800; this.height = height ? height : 600; - this.view = document.createElement( 'canvas' ); + this.view = view ? view : document.createElement( 'canvas' ); this.view.width = this.width; this.view.height = this.height; this.view.background = "#FF0000"; diff --git a/src/pixi/renderers/CanvasRenderer.js b/src/pixi/renderers/CanvasRenderer.js index 3158d42..a028fb5 100644 --- a/src/pixi/renderers/CanvasRenderer.js +++ b/src/pixi/renderers/CanvasRenderer.js @@ -8,8 +8,9 @@ * @class CanvasRenderer * @param width {Number} the width of the canvas view * @param height {Number} the height of the canvas view + * @param view {Canvas} the canvas to use as a view, optional */ -PIXI.CanvasRenderer = function(width, height) +PIXI.CanvasRenderer = function(width, height, view) { /** * The width of the canvas view @@ -33,7 +34,7 @@ * @property view * @type Canvas */ - this.view = document.createElement( 'canvas' ); + this.view = view ? view : document.createElement( 'canvas' ); // hack to enable some hardware acceleration! //this.view.style["transform"] = "translatez(0)"; diff --git a/src/pixi/renderers/WebGLRenderer.js b/src/pixi/renderers/WebGLRenderer.js index 3fb2740..d2177f3 100644 --- a/src/pixi/renderers/WebGLRenderer.js +++ b/src/pixi/renderers/WebGLRenderer.js @@ -13,13 +13,14 @@ * @default 0 * @param height {Number} the height of the canvas view * @default 0 + * @param view {Canvas} the canvas to use as a view, optional */ -PIXI.WebGLRenderer = function(width, height) +PIXI.WebGLRenderer = function(width, height, view) { this.width = width ? width : 800; this.height = height ? height : 600; - this.view = document.createElement( 'canvas' ); + this.view = view ? view : document.createElement( 'canvas' ); this.view.width = this.width; this.view.height = this.height; this.view.background = "#FF0000"; diff --git a/src/pixi/utils/Detector.js b/src/pixi/utils/Detector.js index 7d9d140..599324c 100644 --- a/src/pixi/utils/Detector.js +++ b/src/pixi/utils/Detector.js @@ -9,8 +9,9 @@ * @static * @param width {Number} the width of the renderers view * @param height {Number} the height of the renderers view + * @param view {Canvas} the canvas to use as a view, optional */ -PIXI.autoDetectRenderer = function(width, height) +PIXI.autoDetectRenderer = function(width, height, view) { if(!width)width = 800; if(!height)height = 600; @@ -21,10 +22,10 @@ //console.log(webgl); if( webgl ) { - return new PIXI.WebGLRenderer(width, height) + return new PIXI.WebGLRenderer(width, height, view) } - return new PIXI.CanvasRenderer(width, height); + return new PIXI.CanvasRenderer(width, height, view); }