forked from eXponenta/gstatsjs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PhaserHooks.js
36 lines (36 loc) · 1.2 KB
/
PhaserHooks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// @ts-ignore (it's a peer dependency)
import { Renderer } from 'pixi.js';
import BaseHooks from './BaseHooks';
export default class PhaserHooks extends BaseHooks {
constructor(game) {
super();
if (!game) {
console.error("[Phaser Hooks]Phaser Game can't passed or NULL");
return;
}
var _w = window;
if (_w.Phaser) {
var version = _w.Phaser.VERSION;
if (version.startsWith("3")) {
if (game.renderer.gl && game.renderer.gl instanceof WebGLRenderingContext) {
this.attach(game.renderer.gl);
}
else {
console.error("[Phaser 3 Hooks]Canvas renderer is not allowed");
}
}
else {
if (game.renderer instanceof Renderer) {
this.attach(game.renderer.gl);
}
else {
console.error("[Phaser 2 Hooks]Canvas renderer is not allowed");
}
}
}
else {
console.error("[Phaser Hooks] THIS HOOK ONLY FOR PHASER 2CE or PHASER 3!!!!");
}
}
}
//# sourceMappingURL=PhaserHooks.js.map