mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
Text.setShadow has had the default color
value changed from rgba(0,0,0,0)
to rgba(0,0,0,1)
so it appears as a black shadow by default - before the alpha channel made it invisible.
This commit is contained in:
parent
03ebb8d11c
commit
def662f28f
2 changed files with 16 additions and 7 deletions
|
@ -223,6 +223,7 @@ removal of the automatic closure, results in a very lightweight
|
|||
* With this change in place Signals now consume less than 50KB / 50KB (shallow / retained memory) for 200 sprites, where-as before they used 300KB / 600KB (thanks @pnstickne #1359)
|
||||
* Time.elapsedMS holds the number of milliseconds since the last Game loop, regardless of raF or setTimout being used.
|
||||
* Incorrectly prepared tilemap images (with dimensions not evenly divisible by the tile dimensions) would render incorrectly when compared to the display seen in Tiled. The Phaser tilemap code has been adjusted to match the way Tiled deals with this, which should help if you're using tileset images that contain extra padding/margin pixels. Additional console warnings have been added. However the fact remains that you should carefully prepare your tilesets before using them. Crop off extra padding, make sure they are the right dimensions (thanks @SoulBeaver for the report and @pnstickne for the fix #1371)
|
||||
* Text.setShadow has had the default `color` value changed from `rgba(0,0,0,0)` to `rgba(0,0,0,1)` so it appears as a black shadow by default - before the alpha channel made it invisible.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* @param {number} x - X position of the new text object.
|
||||
* @param {number} y - Y position of the new text object.
|
||||
* @param {string} text - The actual text that will be written.
|
||||
* @param {object} style - The style object containing style attributes like font, font size ,
|
||||
* @param {object} style - The style object containing style attributes like font, font size, etc.
|
||||
*/
|
||||
Phaser.Text = function (game, x, y, text, style) {
|
||||
|
||||
|
@ -295,20 +295,28 @@ Phaser.Text.prototype.destroy = function (destroyChildren) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Sets a drop-shadow effect on the Text.
|
||||
* Sets a drop shadow effect on the Text. You can specify the horizontal and vertical distance of the drop shadow with the `x` and `y` parameters.
|
||||
* The color controls the shade of the shadow (default is black) and can be either an `rgba` or `hex` value.
|
||||
* The blur is the strength of the shadow. A value of zero means a hard shadow, a value of 10 means a very soft shadow.
|
||||
* To remove a shadow already in place you can call this method with no parameters set.
|
||||
*
|
||||
* @method Phaser.Text#setShadow
|
||||
* @param {number} [x=0] - The shadowOffsetX value in pixels. This is how far offset horizontally the shadow effect will be.
|
||||
* @param {number} [y=0] - The shadowOffsetY value in pixels. This is how far offset vertically the shadow effect will be.
|
||||
* @param {string} [color='rgba(0,0,0,0)'] - The color of the shadow, as given in CSS rgba format. Set the alpha component to 0 to disable the shadow.
|
||||
* @param {string} [color='rgba(0,0,0,1)'] - The color of the shadow, as given in CSS rgba or hex format. Set the alpha component to 0 to disable the shadow.
|
||||
* @param {number} [blur=0] - The shadowBlur value. Make the shadow softer by applying a Gaussian blur to it. A number from 0 (no blur) up to approx. 10 (depending on scene).
|
||||
*/
|
||||
Phaser.Text.prototype.setShadow = function (x, y, color, blur) {
|
||||
|
||||
this.style.shadowOffsetX = x || 0;
|
||||
this.style.shadowOffsetY = y || 0;
|
||||
this.style.shadowColor = color || 'rgba(0,0,0,0)';
|
||||
this.style.shadowBlur = blur || 0;
|
||||
if (typeof x === 'undefined') { x = 0; }
|
||||
if (typeof y === 'undefined') { y = 0; }
|
||||
if (typeof color === 'undefined') { color = 'rgba(0, 0, 0, 1)'; }
|
||||
if (typeof blur === 'undefined') { blur = 0; }
|
||||
|
||||
this.style.shadowOffsetX = x;
|
||||
this.style.shadowOffsetY = y;
|
||||
this.style.shadowColor = color;
|
||||
this.style.shadowBlur = blur;
|
||||
this.dirty = true;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue