Fixed issue in Camera.inCamera check where it wouldn't take into consideration the Sprites scrollFactor.

This commit is contained in:
Richard Davey
2013-06-03 02:38:08 +01:00
parent b951b02de8
commit 2de70d07a5
22 changed files with 2254 additions and 121 deletions
+3 -33
View File
@@ -1,5 +1,6 @@
/// <reference path="../Game.ts" />
/// <reference path="../utils/RectangleUtils.ts" />
/// <reference path="../utils/ColorUtils.ts" />
/// <reference path="IGameObject.ts" />
/**
@@ -90,7 +91,7 @@ module Phaser {
//a = imageData.data[3];
var imageData = this.context.getImageData(x, y, 1, 1);
return this.getColor(imageData.data[0], imageData.data[1], imageData.data[2]);
return ColorUtils.getColor(imageData.data[0], imageData.data[1], imageData.data[2]);
}
@@ -104,7 +105,7 @@ module Phaser {
var imageData = this.context.getImageData(x, y, 1, 1);
return this.getColor32(imageData.data[3], imageData.data[0], imageData.data[1], imageData.data[2]);
return ColorUtils.getColor32(imageData.data[3], imageData.data[0], imageData.data[1], imageData.data[2]);
}
@@ -288,37 +289,6 @@ module Phaser {
return this.bounds.height;
}
/**
* Given an alpha and 3 color values this will return an integer representation of it
*
* @param alpha {number} The Alpha value (between 0 and 255)
* @param red {number} The Red channel value (between 0 and 255)
* @param green {number} The Green channel value (between 0 and 255)
* @param blue {number} The Blue channel value (between 0 and 255)
*
* @return A native color value integer (format: 0xAARRGGBB)
*/
private getColor32(alpha: number, red: number, green: number, blue: number): number {
return alpha << 24 | red << 16 | green << 8 | blue;
}
/**
* Given 3 color values this will return an integer representation of it
*
* @param red {number} The Red channel value (between 0 and 255)
* @param green {number} The Green channel value (between 0 and 255)
* @param blue {number} The Blue channel value (between 0 and 255)
*
* @return A native color value integer (format: 0xRRGGBB)
*/
private getColor(red: number, green: number, blue: number): number {
return red << 16 | green << 8 | blue;
}
}
}