Skip to content

Commit 299a3d1

Browse files
committed
Fixed custom environment logic
1 parent 171191e commit 299a3d1

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/boot/CreateRenderer.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ var CreateRenderer = function (game)
2323
{
2424
var config = game.config;
2525

26-
// Game either requested Canvas,
27-
// or requested AUTO or WEBGL but the browser doesn't support it, so fall back to Canvas
26+
if ((config.customEnvironment || config.canvas) && config.renderType === CONST.AUTO)
27+
{
28+
throw new Error('Must set explicit renderType in custom environment');
29+
}
2830

29-
if ((config.customEnvironment || config.canvas) && config.renderType !== CONST.HEADLESS)
31+
// Not a custom environment, didn't provide their own canvas and not headless, so determine the renderer:
32+
if (!config.customEnvironment && !config.canvas && config.renderType !== CONST.HEADLESS)
3033
{
3134
if (config.renderType === CONST.CANVAS || (config.renderType !== CONST.CANVAS && !Features.webGL))
3235
{
@@ -47,11 +50,6 @@ var CreateRenderer = function (game)
4750
}
4851
}
4952

50-
if (config.customEnvironment && config.renderType === CONST.AUTO)
51-
{
52-
throw new Error('Must set renderType in custom environment');
53-
}
54-
5553
// Pixel Art mode?
5654
if (!config.antialias)
5755
{

0 commit comments

Comments
 (0)