diff --git a/README.md b/README.md index a033a6b1..58e9d07e 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,11 @@ Version 1.0.7 (in progress in the dev branch) * Added Text.destroy() and BitmapText.destroy(), also updated Group.remove to make it more bullet-proof when an element doesn't have any events. * Added Phaser.Utils.shuffle to shuffle an array. * Added Graphics.destroy, x, y and updated angle functions. +* Additional checks added to AnimationManager.frame/frameName on the given values. +* Added AnimationManager.refreshFrame - will reset the texture being used for a Sprite (useful after a crop rect clear) +* You can now null a Sprite.crop and it will clear down the crop rect area correctly. +* The default Game.antialias value is now 'true', so graphics will be smoothed automatically in canvas. Disable it via the Game constructor or Canvas utils. + diff --git a/build/phaser.js b/build/phaser.js index 62c5629e..0253f68b 100644 --- a/build/phaser.js +++ b/build/phaser.js @@ -9,7 +9,7 @@ * * Phaser - http://www.phaser.io * -* v1.0.7 - Built at: Thu, 17 Oct 2013 22:56:02 +0100 +* v1.0.7 - Built at: Fri, 18 Oct 2013 01:36:29 +0100 * * By Richard Davey http://www.photonstorm.com @photonstorm * @@ -10948,8 +10948,9 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant renderer = renderer || Phaser.AUTO; parent = parent || ''; state = state || null; + if (typeof transparent == 'undefined') { transparent = false; } - if (typeof antialias == 'undefined') { antialias = false; } + if (typeof antialias == 'undefined') { antialias = true; } /** * @property {number} id - Phaser Game ID (for when Pixi supports multiple instances). @@ -16644,7 +16645,19 @@ Object.defineProperty(Phaser.Sprite.prototype, "crop", { this._cropRect = value; this.setTexture(PIXI.TextureCache[this._cropUUID]); } + else + { + this._cropRect = null; + if (this.animations.isLoaded) + { + this.animations.refreshFrame(); + } + else + { + this.setTexture(PIXI.TextureCache[this.key]); + } + } } }); @@ -17705,6 +17718,7 @@ Phaser.Canvas = { * @return {HTMLCanvasElement} The newly created <canvas> tag. */ create: function (width, height) { + width = width || 256; height = height || 256; @@ -24248,6 +24262,12 @@ Phaser.AnimationManager = function (sprite) { */ this.updateIfVisible = true; + /** + * @property {boolean} isLoaded - Set to true once animation data has been loaded. + * @default + */ + this.isLoaded = false; + /** * @property {Phaser.FrameData} _frameData - A temp. var for holding the currently playing Animations FrameData. * @private @@ -24283,6 +24303,7 @@ Phaser.AnimationManager.prototype = { this._frameData = frameData; this.frame = 0; + this.isLoaded = true; }, @@ -24464,6 +24485,18 @@ Phaser.AnimationManager.prototype = { }, + /** + * Refreshes the current frame data back to the parent Sprite and also resets the texture data. + * + * @method Phaser.AnimationManager#refreshFrame + */ + refreshFrame: function () { + + this.sprite.currentFrame = this.currentFrame; + this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + + }, + /** * Destroys all references this AnimationManager contains. Sets the _anims to a new object and nulls the current animation. * @@ -24552,7 +24585,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frame", { set: function (value) { - if (this._frameData && this._frameData.getFrame(value) !== null) + if (typeof value === 'number' && this._frameData && this._frameData.getFrame(value) !== null) { this.currentFrame = this._frameData.getFrame(value); this._frameIndex = value; @@ -24581,7 +24614,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frameName", { set: function (value) { - if (this._frameData && this._frameData.getFrameByName(value) !== null) + if (typeof value === 'string' && this._frameData && this._frameData.getFrameByName(value) !== null) { this.currentFrame = this._frameData.getFrameByName(value); this._frameIndex = this.currentFrame.index; @@ -31491,8 +31524,12 @@ Phaser.Physics.Arcade.Body.prototype = { this.screenX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; this.screenY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; - this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; - this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; + + // this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; + // this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; + this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; + this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; + this.preRotation = this.sprite.angle; this.x = this.preX; @@ -31616,10 +31653,10 @@ Phaser.Physics.Arcade.Body.prototype = { this.angularVelocity = 0; this.angularAcceleration = 0; - // this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; - // this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; - this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; - this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; + this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; + this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; + // this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; + // this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; this.preRotation = this.sprite.angle; this.x = this.preX; diff --git a/examples/html/css/stylesheet.css b/examples/html/css/stylesheet.css index 962af412..d34dec2d 100644 --- a/examples/html/css/stylesheet.css +++ b/examples/html/css/stylesheet.css @@ -100,7 +100,7 @@ ul.group-items > li a:visited span.mark{background: url('../img/group-item-hover .border-bottom{border-bottom: 1px solid #d1d1d1;} .prize-bg{background: url('../img/prize-bg.png') no-repeat; background-size: cover; background-position: center center; height: 326px; width: 100%;} -.gradient{background: url('../img/gradient-bg') repeat-y;} +.gradient{background: url('../img/gradient-bg.jpg') repeat-y; width: 100%;} .prize-button{text-transform: uppercase; color: #000; text-shadow: 1px 0 #fff; float:right; background: url('../img/prize-button.png') no-repeat; width: 300px; height: 70px; padding-top:135px; font-size: 16px; padding-left: 75px; margin-top: 25px; margin-right: 145px;} .footer{background: #e0e4f1 url('../img/footer-bg.jpg') no-repeat; background-size: cover; width:100%; height: 425px; bottom:0; color:#fff; text-shadow: 1px 1px 0 #000; line-height: 1.25em; font-size: 15px;} diff --git a/examples/html/js/application.js b/examples/html/js/application.js index acf906b8..b28814c0 100644 --- a/examples/html/js/application.js +++ b/examples/html/js/application.js @@ -20,6 +20,6 @@ $(document).ready(function(){ }else if((liAmount/4)>1){ $(this).addClass('laser2'); } - console.log(liAmount/4); + // console.log(liAmount/4); }); }); \ No newline at end of file diff --git a/examples/index.php b/examples/index.php index b9324e28..08c5a01d 100644 --- a/examples/index.php +++ b/examples/index.php @@ -29,7 +29,7 @@ foreach ($files as $key => $value) { $value2 = substr($value, 0, -4); - echo "$value2"; + echo "
  • $value2
  • \n"; } } @@ -45,35 +45,126 @@ } } ?> - - - - Phaser Examples - - - - -