Skip to content

Commit 42d6456

Browse files
committed
Encode dropshadow color
1 parent 959645d commit 42d6456

1 file changed

Lines changed: 64 additions & 30 deletions

File tree

src/gameobjects/bitmaptext/static/BitmapText.js

Lines changed: 64 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ var BitmapText = new Class({
232232

233233
/**
234234
* The horizontal offset of the drop shadow.
235-
*
235+
*
236236
* You can set this directly, or use `Phaser.GameObjects.BitmapText#setDropShadow`.
237237
*
238238
* @name Phaser.GameObjects.BitmapText#dropShadowX
@@ -243,7 +243,7 @@ var BitmapText = new Class({
243243

244244
/**
245245
* The vertical offset of the drop shadow.
246-
*
246+
*
247247
* You can set this directly, or use `Phaser.GameObjects.BitmapText#setDropShadow`.
248248
*
249249
* @name Phaser.GameObjects.BitmapText#dropShadowY
@@ -254,18 +254,27 @@ var BitmapText = new Class({
254254

255255
/**
256256
* The color of the drop shadow.
257-
*
258-
* Set this via `Phaser.GameObjects.BitmapText#setDropShadow`.
259257
*
260-
* @name Phaser.GameObjects.BitmapText#dropShadowColor
258+
* @name Phaser.GameObjects.BitmapText#_dropShadowColor
261259
* @type {number}
260+
* @private
262261
* @since 3.50.0
263262
*/
264-
this.dropShadowColor = 0x000000;
263+
this._dropShadowColor = 0x000000;
264+
265+
/**
266+
* The GL encoded color of the drop shadow.
267+
*
268+
* @name Phaser.GameObjects.BitmapText#_dropShadowColorGL
269+
* @type {number}
270+
* @private
271+
* @since 3.50.0
272+
*/
273+
this._dropShadowColorGL = 0x000000;
265274

266275
/**
267276
* The alpha value of the drop shadow.
268-
*
277+
*
269278
* You can set this directly, or use `Phaser.GameObjects.BitmapText#setDropShadow`.
270279
*
271280
* @name Phaser.GameObjects.BitmapText#dropShadowAlpha
@@ -416,14 +425,14 @@ var BitmapText = new Class({
416425

417426
/**
418427
* Sets a drop shadow effect on this Bitmap Text.
419-
*
428+
*
420429
* This is a WebGL only feature and only works with Static Bitmap Text, not Dynamic.
421-
*
430+
*
422431
* You can set the vertical and horizontal offset of the shadow, as well as the color and alpha.
423-
*
432+
*
424433
* Once a shadow has been enabled you can modify the `dropShadowX` and `dropShadowY` properties of this
425434
* Bitmap Text directly to adjust the position of the shadow in real-time.
426-
*
435+
*
427436
* If you wish to clear the shadow, call this method with no parameters specified.
428437
*
429438
* @method Phaser.GameObjects.BitmapText#setDropShadow
@@ -446,37 +455,37 @@ var BitmapText = new Class({
446455

447456
this.dropShadowX = x;
448457
this.dropShadowY = y;
449-
this.dropShadowColor = GetColor(color);
450458
this.dropShadowAlpha = alpha;
459+
this.dropShadowColor = color;
451460

452461
return this;
453462
},
454463

455464
/**
456465
* Sets a tint on a range of characters in this Bitmap Text, starting from the `start` parameter index
457466
* and running for `length` quantity of characters.
458-
*
467+
*
459468
* The `start` parameter can be negative. In this case, it starts at the end of the text and counts
460469
* backwards `start` places.
461-
*
470+
*
462471
* You can also pass in -1 as the `length` and it will tint all characters from `start`
463472
* up until the end of the string.
464473
465474
* Remember that spaces and punctuation count as characters.
466-
*
475+
*
467476
* This is a WebGL only feature and only works with Static Bitmap Text, not Dynamic.
468-
*
477+
*
469478
* The tint works by taking the pixel color values from the Bitmap Text texture, and then
470479
* multiplying it by the color value of the tint. You can provide either one color value,
471480
* in which case the whole character will be tinted in that color. Or you can provide a color
472481
* per corner. The colors are blended together across the extent of the character range.
473-
*
482+
*
474483
* To swap this from being an additive tint to a fill based tint, set the `tintFill` parameter to `true`.
475-
*
484+
*
476485
* To modify the tint color once set, call this method again with new color values.
477-
*
486+
*
478487
* Using `setWordTint` can override tints set by this function, and vice versa.
479-
*
488+
*
480489
* To remove a tint call this method with just the `start`, and optionally, the `length` parameters defined.
481490
*
482491
* @method Phaser.GameObjects.BitmapText#setCharacterTint
@@ -567,29 +576,29 @@ var BitmapText = new Class({
567576

568577
/**
569578
* Sets a tint on a matching word within this Bitmap Text.
570-
*
579+
*
571580
* The `word` parameter can be either a string or a number.
572-
*
581+
*
573582
* If a string, it will run a string comparison against the text contents, and if matching,
574583
* it will tint the whole word.
575-
*
584+
*
576585
* If a number, if till that word, based on its offset within the text contents.
577-
*
586+
*
578587
* The `count` parameter controls how many words are replaced. Pass in -1 to replace them all.
579-
*
588+
*
580589
* This parameter is ignored if you pass a number as the `word` to be searched for.
581-
*
590+
*
582591
* This is a WebGL only feature and only works with Static Bitmap Text, not Dynamic.
583-
*
592+
*
584593
* The tint works by taking the pixel color values from the Bitmap Text texture, and then
585594
* multiplying it by the color value of the tint. You can provide either one color value,
586595
* in which case the whole character will be tinted in that color. Or you can provide a color
587596
* per corner. The colors are blended together across the extent of the character range.
588-
*
597+
*
589598
* To swap this from being an additive tint to a fill based tint, set the `tintFill` parameter to `true`.
590-
*
599+
*
591600
* To modify the tint color once set, call this method again with new color values.
592-
*
601+
*
593602
* Using `setCharacterTint` can override tints set by this function, and vice versa.
594603
*
595604
* @method Phaser.GameObjects.BitmapText#setWordTint
@@ -989,6 +998,31 @@ var BitmapText = new Class({
989998

990999
},
9911000

1001+
/**
1002+
* The color of the drop shadow.
1003+
*
1004+
* You can also set this via `Phaser.GameObjects.BitmapText#setDropShadow`.
1005+
*
1006+
* @name Phaser.GameObjects.BitmapText#dropShadowColor
1007+
* @type {number}
1008+
* @since 3.50.0
1009+
*/
1010+
dropShadowColor: {
1011+
1012+
get: function ()
1013+
{
1014+
return this._dropShadowColor;
1015+
},
1016+
1017+
set: function (value)
1018+
{
1019+
this._dropShadowColor = value;
1020+
1021+
this._dropShadowColorGL = GetColor(value);
1022+
}
1023+
1024+
},
1025+
9921026
/**
9931027
* Build a JSON representation of this Bitmap Text.
9941028
*

0 commit comments

Comments
 (0)