Fixing bug when no WebGL is available
The switch to Phaser 3.50 introduced a bug when WebGL is not available in a browser. The changes in this commit prevent calls to the WebGL pipeline if the pipeline is not available.
This commit is contained in:
parent
8ffba3157a
commit
8cf481ec49
@ -42,8 +42,10 @@ export class ActionableItem {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.isSelectable = true;
|
this.isSelectable = true;
|
||||||
this.sprite.setPipeline(OutlinePipeline.KEY);
|
if (this.sprite.pipeline) {
|
||||||
this.sprite.pipeline.set2f('uTextureSize', this.sprite.texture.getSourceImage().width, this.sprite.texture.getSourceImage().height);
|
this.sprite.setPipeline(OutlinePipeline.KEY);
|
||||||
|
this.sprite.pipeline.set2f('uTextureSize', this.sprite.texture.getSourceImage().width, this.sprite.texture.getSourceImage().height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,9 +73,10 @@ const config: GameConfig = {
|
|||||||
},
|
},
|
||||||
callbacks: {
|
callbacks: {
|
||||||
postBoot: game => {
|
postBoot: game => {
|
||||||
// FIXME: we should fore WebGL in the config.
|
const renderer = game.renderer;
|
||||||
const renderer = game.renderer as WebGLRenderer;
|
if (renderer instanceof WebGLRenderer) {
|
||||||
renderer.pipelines.add(OutlinePipeline.KEY, new OutlinePipeline(game));
|
renderer.pipelines.add(OutlinePipeline.KEY, new OutlinePipeline(game));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user