Skip to content

Commit 141337b

Browse files
committed
Heavily optimised PixiShader.
1 parent 86584a6 commit 141337b

11 files changed

Lines changed: 216 additions & 295 deletions

File tree

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ Version 1.1.3 - in build
4646
* New: Added a new in-built texture. Sprites now use __default if no texture was provided (a 32x32 transparent PNG) or __missing if one was given but not found (a 32x32 black box with a green cross through it)
4747
* New: Added Phaser.Filter. A new way to use the new WebGL shaders/filters that the new version of Pixi supports.
4848
* New: The object returned by Math.sinCosGenerator now contains a length property.
49-
* New: Phaser.BitmapData object. Can be used as a texture for a Sprite or Tiling Sprite. See the new examples and docs for details.
49+
* New: Phaser.BitmapData object. A Canvas you can freely draw to with lots of functions. Can be used as a texture for Sprites. See the new examples and docs for details.
5050
* New: RenderTexture.render now takes a Phaser.Group. Also added renderXY for when you don't want to make a new Point object.
51-
* New: Implementing PluginManager.remove, added PluginManager.removeAll (thanks crazysam)
52-
* New: Added scrollFactorX/scrollFactorY to TilemapLayers (thanks jcd-as)
51+
* New: PluginManager.remove, added PluginManager.removeAll (thanks crazysam)
52+
* New: scrollFactorX/scrollFactorY have been added to TilemapLayers (thanks jcd-as)
5353
* New: Phaser.Game parent can now be an HTMLElement or a string (thanks beeglebug)
54-
* New: Updated to use the latest version of Pixi.js - which means you can now use all the sexy new WebGL filters they added :)
54+
* New: Now using the latest version of Pixi.js. Which means you can use all the sexy new WebGL filters :)
5555
* New: Sprite.animations.getAnimation will return an animation instance which was added by name.
5656
* New: Added Mouse.button which is set to the button that was pressed: Phaser.Mouse.LEFT_BUTTON, MIDDLE_BUTTON or RIGHT_BUTTON (thanks wKLV)
5757
* New: Added Mouse.pointerLock signal which you can listen to whenever the browser enters or leaves pointer lock mode.
@@ -64,6 +64,8 @@ Version 1.1.3 - in build
6464
* New: Device.littleEndian boolean added. Only safe to use if the browser supports TypedArrays (which IE9 doesn't, but nearly all others do)
6565
* New: You can now call game.sound.play() and simply pass it a key. The sound will play if the audio system is unlocked and optionally destroy itself on complete.
6666
* New: Mouse.capture is a boolean. If set to true then DOM mouse events will have event.preventDefault() applied, if false they will propogate fully.
67+
* New: Added Sound.externalNode which allows you to connect a Sound to an external node input rather than the SoundManager gain node.
68+
* New: Added SoundManager.connectToMaster boolean. Used in conjunction with Sound.externalNode you can easily configure audio nodes to connect together for special effects.
6769

6870
* Fixed: Lots of fixes to the TypeScript definitions file (many thanks gltovar)
6971
* Fixed: Tilemap commands use specified layer when one given (thanks Izzimach)
@@ -77,6 +79,8 @@ Version 1.1.3 - in build
7779
* Fixed: Fixes to Math and Loader (thanks theJare)
7880
* Fixed: Tween - isRunning not reset when non-looped tween completes (thanks crazysam + kevinthompson)
7981
* Fixed: Math.normalizeAngle and Math.wrapAngle (thanks theJare)
82+
* Fixed: Device.isTouch modified to test maxTouchPointers instead of MSPointer.
83+
* Fixed: InputHandler.checkPointerOver now checks the visible status of the Sprite Group before processing.
8084

8185
* Updated: ArcadePhysics.updateMotion applies the dt to the velocity calculations as well as position now (thanks jcs)
8286
* Updated: RequestAnimationFrame now retains the callbackID which is passed to cancelRequestAnimationFrame.

build/config.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,7 @@
2828
<script src="$path/src/pixi/extras/Rope.js"></script>
2929
<script src="$path/src/pixi/extras/TilingSprite.js"></script>
3030
31-
<script src="$path/src/pixi/filters/AbstractFilter.js"></script>
32-
<script src="$path/src/pixi/filters/BlurFilter.js"></script>
33-
<script src="$path/src/pixi/filters/BlurXFilter.js"></script>
34-
<script src="$path/src/pixi/filters/BlurYFilter.js"></script>
35-
<script src="$path/src/pixi/filters/ColorMatrixFilter.js"></script>
36-
<script src="$path/src/pixi/filters/CrossHatchFilter.js"></script>
37-
<script src="$path/src/pixi/filters/DisplacementFilter.js"></script>
38-
<script src="$path/src/pixi/filters/DotScreenFilter.js"></script>
3931
<script src="$path/src/pixi/filters/FilterBlock.js"></script>
40-
<script src="$path/src/pixi/filters/GrayFilter.js"></script>
41-
<script src="$path/src/pixi/filters/InvertFilter.js"></script>
42-
<script src="$path/src/pixi/filters/PixelateFilter.js"></script>
43-
<script src="$path/src/pixi/filters/RGBSplitFilter.js"></script>
44-
<script src="$path/src/pixi/filters/SepiaFilter.js"></script>
45-
<script src="$path/src/pixi/filters/SmartBlurFilter.js"></script>
46-
<script src="$path/src/pixi/filters/TwistFilter.js"></script>
47-
4832
<script src="$path/src/pixi/primitives/Graphics.js"></script>
4933
5034
<script src="$path/src/pixi/renderers/canvas/CanvasGraphics.js"></script>

filters/Tunnel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Phaser.Filter.Tunnel = function (game) {
88

99
this.uniforms.alpha = { type: '1f', value: 1 }
1010
this.uniforms.origin = { type: '1f', value: 2.0 }
11-
this.uniforms.iChannel0 = { type: 'sampler2D', value: null, wrap: 'repeat' }
11+
this.uniforms.iChannel0 = { type: 'sampler2D', value: null, repeat: true }
1212

1313
this.fragmentSrc = [
1414

src/core/Group.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,15 +1190,25 @@ Phaser.Group.prototype = {
11901190
*
11911191
* @method Phaser.Group#remove
11921192
* @param {Any} child - The child to remove.
1193+
* @return {boolean} true if the child was removed from this Group, otherwise false.
11931194
*/
11941195
remove: function (child) {
11951196

1197+
if (child.group !== this)
1198+
{
1199+
return false;
1200+
}
1201+
11961202
if (child.events)
11971203
{
11981204
child.events.onRemovedFromGroup.dispatch(child, this);
11991205
}
12001206

1201-
this._container.removeChild(child);
1207+
// Check it's actually in the container
1208+
if (child.parent === this._container)
1209+
{
1210+
this._container.removeChild(child);
1211+
}
12021212

12031213
if (this.cursor == child)
12041214
{
@@ -1214,6 +1224,8 @@ Phaser.Group.prototype = {
12141224

12151225
child.group = null;
12161226

1227+
return true;
1228+
12171229
},
12181230

12191231
/**

src/gameobjects/GameObjectFactory.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,14 @@ Phaser.GameObjectFactory.prototype = {
104104
*
105105
* @method Phaser.GameObjectFactory#audio
106106
* @param {string} key - The Game.cache key of the sound that this object will use.
107-
* @param {number} volume - The volume at which the sound will be played.
108-
* @param {boolean} loop - Whether or not the sound will loop.
107+
* @param {number} [volume=1] - The volume at which the sound will be played.
108+
* @param {boolean} [loop=false] - Whether or not the sound will loop.
109+
* @param {boolean} [connect=true] - Controls if the created Sound object will connect to the master gainNode of the SoundManager when running under WebAudio.
109110
* @return {Phaser.Sound} The newly created text object.
110111
*/
111-
audio: function (key, volume, loop) {
112+
audio: function (key, volume, loop, connect) {
112113

113-
return this.game.sound.add(key, volume, loop);
114+
return this.game.sound.add(key, volume, loop, connect);
114115

115116
},
116117

src/input/InputHandler.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -510,25 +510,25 @@ Phaser.InputHandler.prototype = {
510510
*/
511511
checkPointerOver: function (pointer) {
512512

513-
if (this.enabled && this.sprite.visible)
513+
if (this.enabled === false || this.sprite.visible === false || (this.sprite.group && this.sprite.group.visible === false))
514514
{
515-
this.sprite.getLocalUnmodifiedPosition(this._tempPoint, pointer.x, pointer.y);
515+
return false;
516+
}
517+
518+
this.sprite.getLocalUnmodifiedPosition(this._tempPoint, pointer.x, pointer.y);
516519

517-
if (this._tempPoint.x >= 0 && this._tempPoint.x <= this.sprite.currentFrame.width && this._tempPoint.y >= 0 && this._tempPoint.y <= this.sprite.currentFrame.height)
520+
if (this._tempPoint.x >= 0 && this._tempPoint.x <= this.sprite.currentFrame.width && this._tempPoint.y >= 0 && this._tempPoint.y <= this.sprite.currentFrame.height)
521+
{
522+
if (this.pixelPerfect)
518523
{
519-
if (this.pixelPerfect)
520-
{
521-
return this.checkPixel(this._tempPoint.x, this._tempPoint.y);
522-
}
523-
else
524-
{
525-
return true;
526-
}
524+
return this.checkPixel(this._tempPoint.x, this._tempPoint.y);
525+
}
526+
else
527+
{
528+
return true;
527529
}
528530
}
529531

530-
return false;
531-
532532
},
533533

534534
/**

0 commit comments

Comments
 (0)