File size: 695 Bytes
670a607
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import Methods from './canvasdata.js';

const CanvasPool = Phaser.Display.Canvas.CanvasPool;

class CanvasDataPlugin extends Phaser.Plugins.BasePlugin {

    constructor(pluginManager) {
        super(pluginManager);
    }

    start() {
        var eventEmitter = this.game.events;
        eventEmitter.on('destroy', this.destroy, this);

        this._tmpCanvas = CanvasPool.create2D(this);
    }

    destroy() {
        CanvasPool.remove(this._tmpCanvas);
        this._tmpCanvas = undefined;
        super.destroy();
    }

    get textureManager() {
        return this.game.textures;
    }
}

Object.assign(
    CanvasDataPlugin.prototype,
    Methods
);

export default CanvasDataPlugin;