Skip to content

Commit 33c52ea

Browse files
committed
BitmapData alpha option added.
Pointer return type added. pixi manifest updated to remove need for geom classes.
1 parent c7e2562 commit 33c52ea

6 files changed

Lines changed: 51 additions & 15 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ Version 2.1.0 - "Cairhien" - -in development-
7070
### Updates
7171

7272
* TypeScript definition updates to help fix for the `noimplicitany` option (thanks @Waog #1088)
73+
* All of the Pixi geom classes have been removed from the build file as they aren't needed (the Phaser.Geom classes overwrite them), saving some space in the process.
7374

7475
### New Features
7576

7677
* Device will now detect for Kindle and PS Vita (thanks @lucbloom)
78+
* Device will now detect for Cordova (thanks @videlais #1102)
7779
* Arcade Physics Body.skipQuadTree is a new boolean that if set to `true` when you collide the Sprite against a Group it will tell Phaser to skip using a QuadTree for that collision. This is handy if this Body is especially large.
7880
* Arcade Physics World.skipQuadTree will disable the use of all QuadTrees in collision methods, which can help performance in tightly packed scenes.
7981

@@ -86,7 +88,7 @@ Version 2.1.0 - "Cairhien" - -in development-
8688
* Fix for scale issues in CocoonJS using webgl renderer and screencanvas (thanks @txusinho #1064)
8789
* Resolves issue with pixel perfect click / over detection on Sprites that used trimmed image atlases for animations or frames > 0.
8890
* Group.swap() updates the Z index values properly (thanks @Blank101 #1090)
89-
* Device now recognises ChromeOS as a desktop (thanks @alvinsight #1091)
91+
* Device now recognises ChromeOS as a desktop (thanks @alvinsight @hilts-vaughan #1091)
9092

9193
The full Change Log is at https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md
9294

build/config.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,21 @@
2424
echo " <script src=\"$path/src/physics/p2/p2.js\"></script>";
2525
}
2626

27+
// Testing a build without these - pretty sure we're safe to ignore them (as we over-write them)
28+
// <script src="$path/src/pixi/core/Point.js"></script>
29+
// <script src="$path/src/pixi/core/Rectangle.js"></script>
30+
// <script src="$path/src/pixi/core/Polygon.js"></script>
31+
// <script src="$path/src/pixi/core/Circle.js"></script>
32+
// <script src="$path/src/pixi/core/Ellipse.js"></script>
33+
// "src/pixi/core/Point.js",
34+
// "src/pixi/core/Rectangle.js",
35+
// "src/pixi/core/Polygon.js",
36+
// "src/pixi/core/Circle.js",
37+
// "src/pixi/core/Ellipse.js",
38+
2739
echo <<<EOL
2840
2941
<script src="$path/src/pixi/Pixi.js"></script>
30-
<script src="$path/src/pixi/core/Point.js"></script>
31-
<script src="$path/src/pixi/core/Rectangle.js"></script>
32-
<script src="$path/src/pixi/core/Polygon.js"></script>
33-
<script src="$path/src/pixi/core/Circle.js"></script>
34-
<script src="$path/src/pixi/core/Ellipse.js"></script>
3542
<script src="$path/src/pixi/core/Matrix.js"></script>
3643
<script src="$path/src/pixi/display/DisplayObject.js"></script>
3744
<script src="$path/src/pixi/display/DisplayObjectContainer.js"></script>
@@ -220,7 +227,7 @@
220227
EOL;
221228
}
222229

223-
if ($custom)
230+
if (isset($custom))
224231
{
225232
for ($i = 0; $i < count($custom); $i++)
226233
{

src/gameobjects/BitmapData.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,14 +772,30 @@ Phaser.BitmapData.prototype = {
772772
* @param {Phaser.Rectangle} area - The Rectangle region to copy from the source image.
773773
* @param {number} x - The destination x coordinate to copy the image to.
774774
* @param {number} y - The destination y coordinate to copy the image to.
775+
* @param {number} [alpha] - An optional alpha value. If given the BitmapData.context.globalAlpha will be set to this before drawing and reset after.
775776
*/
776-
copyPixels: function (source, area, x, y) {
777+
copyPixels: function (source, area, x, y, alpha) {
777778

778779
if (typeof source === 'string')
779780
{
780781
source = this.game.cache.getImage(source);
781782
}
782783

784+
if (typeof alpha === 'undefined')
785+
{
786+
alpha = null;
787+
}
788+
else if (alpha <= 0)
789+
{
790+
// No point doing anything if alpha is zero
791+
return;
792+
}
793+
else if (alpha > 1)
794+
{
795+
// Sanity cap
796+
alpha = 1;
797+
}
798+
783799
var src = source;
784800
var sx = 0;
785801
var sy = 0;
@@ -799,8 +815,19 @@ Phaser.BitmapData.prototype = {
799815
}
800816
}
801817

818+
if (alpha)
819+
{
820+
var prevAlpha = this.context.globalAlpha;
821+
this.context.globalAlpha = alpha;
822+
}
823+
802824
this.context.drawImage(src, sx + area.x, sy + area.y, area.width, area.height, x, y, area.width, area.height);
803825

826+
if (alpha)
827+
{
828+
this.context.globalAlpha = prevAlpha;
829+
}
830+
804831
this.dirty = true;
805832

806833
},

src/input/Input.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ Phaser.Input.prototype = {
352352
this.touch = new Phaser.Touch(this.game);
353353
this.mspointer = new Phaser.MSPointer(this.game);
354354
this.gamepad = new Phaser.Gamepad(this.game);
355+
355356
// this.gestures = new Phaser.Gestures(this.game);
356357

357358
this.onDown = new Phaser.Signal();
@@ -392,7 +393,10 @@ Phaser.Input.prototype = {
392393
this.keyboard.stop();
393394
this.touch.stop();
394395
this.mspointer.stop();
396+
397+
395398
this.gamepad.stop();
399+
396400
// this.gestures.stop();
397401

398402
this.moveCallbacks = [];

src/input/Pointer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,6 @@ Phaser.Pointer.prototype = {
432432
{
433433
this.targetObject = null;
434434
}
435-
436-
return this;
437435
}
438436
else if (this.game.input.interactiveItems.total > 0)
439437
{
@@ -450,6 +448,7 @@ Phaser.Pointer.prototype = {
450448
* @method Phaser.Pointer#processInteractiveObjects
451449
* @protected
452450
* @param {boolean} [fromClick=false] - Was this called from the click event?
451+
* @return {boolean} True if this method processes an object (i.e. a Sprite becomes the Pointers currentTarget), otherwise false.
453452
*/
454453
processInteractiveObjects: function (fromClick) {
455454

@@ -545,6 +544,8 @@ Phaser.Pointer.prototype = {
545544
}
546545
}
547546

547+
return (this.targetObject !== null);
548+
548549
},
549550

550551
/**

tasks/manifests/pixi.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
[
22
"src/pixi/Intro.js",
33
"src/pixi/Pixi.js",
4-
"src/pixi/core/Point.js",
5-
"src/pixi/core/Rectangle.js",
6-
"src/pixi/core/Polygon.js",
7-
"src/pixi/core/Circle.js",
8-
"src/pixi/core/Ellipse.js",
94
"src/pixi/core/Matrix.js",
105

116
"src/pixi/display/DisplayObject.js",

0 commit comments

Comments
 (0)