From 85eaaef6888fa7168a8914a71b0718252aaa17b8 Mon Sep 17 00:00:00 2001 From: photonstorm Date: Sat, 15 Feb 2014 03:12:24 +0000 Subject: [PATCH] Filters fixed to work with Pixi 1.5. --- examples/wip/text tilesprite.js | 46 +++++++++++++++++++++++++++++++++ src/core/Filter.js | 7 +++++ 2 files changed, 53 insertions(+) create mode 100644 examples/wip/text tilesprite.js diff --git a/examples/wip/text tilesprite.js b/examples/wip/text tilesprite.js new file mode 100644 index 00000000..c2d502ee --- /dev/null +++ b/examples/wip/text tilesprite.js @@ -0,0 +1,46 @@ + +// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update }); +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update }); + +function preload() { + + game.load.image('knightHawks', 'assets/fonts/KNIGHT3.png'); + game.load.script('filter', '../filters/Plasma.js'); + +} + +var font; +var i; +var background; +var filter; + +function create() { + + background = game.add.sprite(0, 0); + background.width = 800; + background.height = 600; + + filter = game.add.filter('Plasma', 800, 600); + + background.filters = [filter]; + + font = game.add.bitmapFont('knightHawks', 31, 25, Phaser.BitmapFont.TEXT_SET6, 10, 1, 1); + font.text = 'phaser was here'; + + i = game.add.image(0, 0, font); + + // sprite = game.add.tileSprite(0, 0, 800, 600, font); + +} + +function update() { + + filter.update(); + + // Uncomment for coolness :) + // filter.blueShift -= 0.001; + + + // font.text = "phaser x: " + game.input.x + " y: " + game.input.y; + +} diff --git a/src/core/Filter.js b/src/core/Filter.js index 6bedd4e5..229e4fe0 100644 --- a/src/core/Filter.js +++ b/src/core/Filter.js @@ -35,6 +35,13 @@ Phaser.Filter = function (game, uniforms, fragmentSrc) { */ this.passes = [this]; + /** + * @property shaders + * @type Array an array of shaders + * @private + */ + this.shaders = []; + /** * @property {boolean} dirty - Internal PIXI var. * @default