ScaleMode fix, BitmapData change and Device updates.

This commit is contained in:
photonstorm
2013-11-18 20:27:40 +00:00
parent a5f2d65d23
commit b63bd14172
10 changed files with 1867 additions and 239 deletions
+2 -22
View File
@@ -55,31 +55,11 @@ Phaser.BitmapData = function (game, width, height) {
*/
this.imageData = this.context.getImageData(0, 0, width, height);
this.pixels = new Int32Array(this.imageData.data.buffer);
/**
* @property {Uint8ClampedArray} data8 - A uint8 clamped view on the buffer.
* @property {UInt8Clamped} pixels - A reference to the context imageData buffer.
*/
// this.data8 = new Uint8ClampedArray(this.imageData.buffer);
this.pixels = this.imageData.data.buffer;
/**
* @property {Uint32Array} data32 - A Uint32 view on the buffer.
*/
// this.data32 = new Uint32Array(this.imageData.buffer);
// Little or big-endian?
// this.data32[1] = 0x0a0b0c0d;
/**
* @property {boolean} isLittleEndian - .
*/
this.isLittleEndian = true;
// if (this.data32[4] === 0x0a && this.data32[5] === 0x0b && this.data32[6] === 0x0c && this.data32[7] === 0x0d)
// {
// this.isLittleEndian = false;
// }
/**
* @property {PIXI.BaseTexture} baseTexture - The PIXI.BaseTexture.
* @default
+1 -1
View File
@@ -358,7 +358,7 @@ Phaser.Sprite.prototype.constructor = Phaser.Sprite;
*/
Phaser.Sprite.prototype.preUpdate = function() {
if (!this.exists || !this.group.exists)
if (!this.exists || (this.group && !this.group.exists))
{
this.renderOrderID = -1;
return;
+11
View File
@@ -265,6 +265,12 @@ Phaser.Device = function () {
*/
this.pixelRatio = 0;
/**
* @property {boolean} littleEndian - Is the device big or little endian? (only detected if the browser supports TypedArrays)
* @default
*/
this.littleEndian = false;
// Run the checks
this._checkAudio();
this._checkBrowser();
@@ -444,6 +450,11 @@ Phaser.Device.prototype = {
this.iPhone4 = (this.pixelRatio == 2 && this.iPhone);
this.iPad = navigator.userAgent.toLowerCase().indexOf('ipad') != -1;
if (typeof Int8Array !== 'undefined')
{
this.littleEndian = new Int8Array(new Int16Array([1]).buffer)[0] > 0;
}
},
/**
+5 -7
View File
@@ -310,17 +310,15 @@ Phaser.StageScaleMode.prototype = {
* The optional orientationImage is displayed when the game is in the incorrect orientation.
* @method Phaser.StageScaleMode#forceOrientation
* @param {boolean} forceLandscape - true if the game should run in landscape mode only.
* @param {boolean} forcePortrait - true if the game should run in portrait mode only.
* @param {string} [forcePortrait=''] - The string of an image in the Phaser.Cache to display when this game is in the incorrect orientation.
* @param {boolean} [forcePortrait=false] - true if the game should run in portrait mode only.
* @param {string} [orientationImage=''] - The string of an image in the Phaser.Cache to display when this game is in the incorrect orientation.
*/
forceOrientation: function (forceLandscape, forcePortrait, orientationImage) {
this.forceLandscape = forceLandscape;
if (typeof forcePortrait === 'undefined') { forcePortrait = false; }
if (typeof forcePortrait === 'undefined')
{
this.forcePortrait = false;
}
this.forceLandscape = forceLandscape;
this.forcePortrait = forcePortrait;
if (typeof orientationImage !== 'undefined')
{