From 5e97f10c863129ba12f4c0af69fc28c1eb5284c0 Mon Sep 17 00:00:00 2001 From: Pete Baron Date: Thu, 5 May 2016 17:00:22 +1200 Subject: [PATCH] Remove un-needed mixin components leaving only FixedToCamera (not sure about this one). Move this.fixedToCamera after the Core.init call which creates the underlying core components required. Add temporary instant return from shiftCanvas in case that was being called and contributing to the slow-down (probably not). --- src/tilemap/TilemapLayerGL.js | 41 +++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/tilemap/TilemapLayerGL.js b/src/tilemap/TilemapLayerGL.js index 59a629b7c..0b9519fa1 100644 --- a/src/tilemap/TilemapLayerGL.js +++ b/src/tilemap/TilemapLayerGL.js @@ -219,35 +219,36 @@ Phaser.TilemapLayerGL = function (game, tilemap, index, width, height) { this.renderSettings.copyCanvas = Phaser.TilemapLayerGL.ensureSharedCopyCanvas(); } - //this.fixedToCamera = true; - var baseTexture = new PIXI.BaseTexture(this.map.tilesets[0].image); PIXI.Tilemap.call(this, new PIXI.Texture(baseTexture), this.map.width, this.map.height, this.map.tileWidth, this.map.tileHeight, this.layer); Phaser.Component.Core.init.call(this, game, 0, 0, null, null); + + // must be called after the Core.init + this.fixedToCamera = true; }; Phaser.TilemapLayerGL.prototype = Object.create(PIXI.Tilemap.prototype); Phaser.TilemapLayerGL.prototype.constructor = Phaser.TilemapLayerGL; Phaser.Component.Core.install.call(Phaser.TilemapLayerGL.prototype, [ - 'Angle', - 'Animation', - 'AutoCull', - 'Bounds', - 'BringToTop', - 'Destroy', - 'FixedToCamera', - 'Health', - 'InCamera', - 'InputEnabled', - 'InWorld', - 'LifeSpan', - 'LoadTexture', - 'Overlap', - 'PhysicsBody', - 'Reset', - 'Smoothed' + //'Angle', + //'Animation', + //'AutoCull', + //'Bounds', + //'BringToTop', + //'Destroy', + 'FixedToCamera' + //'Health', + //'InCamera', + //'InputEnabled', + //'InWorld', + //'LifeSpan', + //'LoadTexture', + //'Overlap', + //'PhysicsBody', + //'Reset', + //'Smoothed' ]); Phaser.TilemapLayerGL.prototype.preUpdateCore = Phaser.Component.Core.preUpdate; @@ -716,6 +717,8 @@ Phaser.TilemapLayerGL.prototype.setScale = function (xScale, yScale) { */ Phaser.TilemapLayerGL.prototype.shiftCanvas = function (context, x, y) { + return; + var canvas = context.canvas; var copyW = canvas.width - Math.abs(x); var copyH = canvas.height - Math.abs(y);