Skip to content

Commit ac27f12

Browse files
committed
Fixes for Pixi update WebGL UV calls.
1 parent 163a6c4 commit ac27f12

11 files changed

Lines changed: 45 additions & 7 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ Version 2.1.3 - "Ravinda" - in development
8080
### Updates
8181

8282
* Changed the Animation constructor parameter `delay` to `frameRate` as it's a more accurate term of what it should be. Internally nothing changed.
83+
* Circle.getBounds added.
84+
* Ellipse.getBounds added.
8385

8486
### Bug Fixes
8587

build/config.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<script src="$path/src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
7070
<script src="$path/src/pixi/renderers/canvas/CanvasRenderer.js"></script>
7171
<script src="$path/src/pixi/renderers/canvas/CanvasGraphics.js"></script>
72-
<script src="$path/src/pixi/primitives/Graphics.js"></script>
72+
7373
<script src="$path/src/pixi/extras/Strip.js"></script>
7474
<script src="$path/src/pixi/extras/Rope.js"></script>
7575
<script src="$path/src/pixi/extras/TilingSprite.js"></script>
@@ -87,6 +87,8 @@
8787
<script src="$path/src/geom/Ellipse.js"></script>
8888
<script src="$path/src/geom/Polygon.js"></script>
8989
90+
<script src="$path/src/pixi/primitives/Graphics.js"></script>
91+
9092
<script src="$path/src/core/Camera.js"></script>
9193
<script src="$path/src/core/State.js"></script>
9294
<script src="$path/src/core/StateManager.js"></script>

src/Phaser.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,8 @@ PIXI.InteractionManager = PIXI.InteractionManager || function () {};
8383

8484
// Equally we're going to supress the Pixi console log, with their agreement.
8585
PIXI.dontSayHello = true;
86+
87+
// PIXI.Polygon.prototype.type = PIXI.Graphics.POLY;
88+
// PIXI.Rectangle.prototype.type = PIXI.Graphics.RECT;
89+
// PIXI.Circle.prototype.type = PIXI.Graphics.CIRC;
90+
// PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP;

src/core/Game.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ Phaser.Game.prototype = {
615615
this.renderType = Phaser.CANVAS;
616616
}
617617

618-
this.renderer = new PIXI.CanvasRenderer(this.width, this.height, this.canvas, this.transparent);
618+
this.renderer = new PIXI.CanvasRenderer(this.width, this.height, { "view": this.canvas, "transparent": this.transparent, "resolution": 1, "clearBeforeRender": true });
619619
this.context = this.renderer.context;
620620
}
621621
else
@@ -627,7 +627,8 @@ Phaser.Game.prototype = {
627627
{
628628
// They requested WebGL and their browser supports it
629629
this.renderType = Phaser.WEBGL;
630-
this.renderer = new PIXI.WebGLRenderer(this.width, this.height, this.canvas, this.transparent, this.antialias, this.preserveDrawingBuffer);
630+
631+
this.renderer = new PIXI.WebGLRenderer(this.width, this.height, { "view": this.canvas, "transparent": this.transparent, "resolution": 1, "antialias": this.antialias, "preserveDrawingBuffer": this.preserveDrawingBuffer });
631632
this.context = null;
632633
}
633634

src/gameobjects/BitmapData.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,8 @@ Phaser.BitmapData.prototype = {
13051305
{
13061306
// Only needed if running in WebGL, otherwise this array will never get cleared down
13071307
// should use the rendersession
1308-
PIXI.updateWebGLTexture(this.baseTexture, this.game.renderer.gl);
1308+
// PIXI.updateWebGLTexture(this.baseTexture, this.game.renderer.gl);
1309+
// this.baseTexture._updateUvs();
13091310

13101311
this.dirty = false;
13111312
}

src/gameobjects/Image.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ Phaser.Image.prototype.setFrame = function(frame) {
360360
{
361361
if (this.game.renderType === Phaser.WEBGL)
362362
{
363-
PIXI.WebGLRenderer.updateTextureFrame(this.texture);
363+
this.texture._updateUvs();
364+
// PIXI.WebGLRenderer.updateTextureFrame(this.texture);
364365
}
365366
}
366367

src/gameobjects/Sprite.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ Phaser.Sprite.prototype.setFrame = function(frame) {
476476
{
477477
if (this.game.renderType === Phaser.WEBGL)
478478
{
479-
PIXI.WebGLRenderer.updateTextureFrame(this.texture);
479+
this.texture._updateUvs();
480+
// PIXI.WebGLRenderer.updateTextureFrame(this.texture);
480481
}
481482
}
482483

src/gameobjects/TileSprite.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,8 @@ Phaser.TileSprite.prototype.setFrame = function(frame) {
426426

427427
if (this.game.renderType === Phaser.WEBGL)
428428
{
429-
PIXI.WebGLRenderer.updateTextureFrame(this.texture);
429+
this.texture._updateUvs();
430+
// PIXI.WebGLRenderer.updateTextureFrame(this.texture);
430431
}
431432

432433
};

src/geom/Circle.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Phaser.Circle = function (x, y, diameter) {
5353

5454
Phaser.Circle.prototype = {
5555

56+
type: null,
57+
5658
/**
5759
* The circumference of the circle.
5860
* @method Phaser.Circle#circumference
@@ -62,6 +64,15 @@ Phaser.Circle.prototype = {
6264
return 2 * (Math.PI * this._radius);
6365
},
6466

67+
/**
68+
* Returns the framing rectangle of the circle as a Phaser.Rectangle object
69+
* @method Phaser.Circle#getBounds
70+
* @return {Phaser.Rectangle} The bounds of the Circle.
71+
*/
72+
getBounds: function () {
73+
return new Phaser.Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);
74+
},
75+
6576
/**
6677
* Sets the members of Circle to the specified values.
6778
* @method Phaser.Circle#setTo

src/geom/Ellipse.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ Phaser.Ellipse.prototype = {
6868

6969
},
7070

71+
/**
72+
* Returns the framing rectangle of the ellipse as a Phaser.Rectangle object.
73+
* @method Phaser.Ellipse#getBounds
74+
* @return {Phaser.Rectangle} The bounds of the Circle.
75+
*/
76+
getBounds: function () {
77+
78+
return new Phaser.Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);
79+
80+
},
81+
7182
/**
7283
* Copies the x, y, width and height properties from any given object to this Ellipse.
7384
* @method Phaser.Ellipse#copyFrom

0 commit comments

Comments
 (0)