You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/application/application.js
+8-7
Original file line number
Diff line number
Diff line change
@@ -39,14 +39,15 @@ const AUTO = 2;
39
39
* @param {number} height - The height of the canvas viewport
40
40
* @param {object} [options] - The optional video/renderer parameters.<br> (see Renderer(s) documentation for further specific options)
41
41
* @param {string|HTMLElement} [options.parent=document.body] - the DOM parent element to hold the canvas in the HTML file
42
-
* @param {number} [options.renderer=video.AUTO] - renderer to use (me.video.CANVAS, me.video.WEBGL, me.video.AUTO)
42
+
* @param {number|Renderer} [options.renderer=video.AUTO] - renderer to use (me.video.CANVAS, me.video.WEBGL, me.video.AUTO), or a custom renderer class
43
43
* @param {number|string} [options.scale=1.0] - enable scaling of the canvas ('auto' for automatic scaling)
* @param {boolean} [options.preferWebGL1=false] - if true the renderer will only use WebGL 1
46
46
* @param {string} [options.powerPreference="default"] - a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context ("default", "high-performance", "low-power"). To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
47
47
* @param {boolean} [options.transparent=false] - whether to allow transparent pixels in the front buffer (screen).
48
48
* @param {boolean} [options.antiAlias=false] - whether to enable or not video scaling interpolation
49
49
* @param {boolean} [options.consoleHeader=true] - whether to display melonJS version and basic device information in the console
50
+
* @throws Will throw an exception if it fails to instantiate a renderer
50
51
*/
51
52
constructor(width,height,options){
52
53
@@ -183,7 +184,7 @@ const AUTO = 2;
183
184
this.settings.zoomX=width*this.settings.scale;
184
185
this.settings.zoomY=height*this.settings.scale;
185
186
186
-
try{
187
+
if(typeofthis.settings.renderer==="number"){
187
188
switch(this.settings.renderer){
188
189
caseAUTO:
189
190
caseWEBGL:
@@ -193,10 +194,10 @@ const AUTO = 2;
193
194
this.renderer=newCanvasRenderer(this.settings);
194
195
break;
195
196
}
196
-
}catch(e){
197
-
console(e.message);
198
-
// me.video.init() returns false if failing at creating/using a HTML5 canvas
Copy file name to clipboardexpand all lines: src/video/video.js
+9-3
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ export let renderer = null;
57
57
* @param {number} height - The height of the canvas viewport
58
58
* @param {object} [options] - The optional video/renderer parameters.<br> (see Renderer(s) documentation for further specific options)
59
59
* @param {string|HTMLElement} [options.parent=document.body] - the DOM parent element to hold the canvas in the HTML file
60
-
* @param {number} [options.renderer=video.AUTO] - renderer to use (me.video.CANVAS, me.video.WEBGL, me.video.AUTO)
60
+
* @param {number|Renderer} [options.renderer=video.AUTO] - renderer to use (me.video.CANVAS, me.video.WEBGL, me.video.AUTO), or a custom renderer class
61
61
* @param {number|string} [options.scale=1.0] - enable scaling of the canvas ('auto' for automatic scaling)
0 commit comments