mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 15:12:18 +00:00
Added tint to Color component.
This commit is contained in:
parent
3020e3b8cf
commit
60b23a157e
1 changed files with 48 additions and 1 deletions
|
@ -23,7 +23,7 @@ Phaser.Component.Color = function (gameObject)
|
|||
|
||||
this._blendMode = 0;
|
||||
|
||||
this._tint = [];
|
||||
this._tint = [ 0xffffff, 0xffffff, 0xffffff, 0xffffff ];
|
||||
this._hasTint = false;
|
||||
|
||||
this._r = 0;
|
||||
|
@ -56,6 +56,25 @@ Phaser.Component.Color.prototype = {
|
|||
this.setDirty();
|
||||
},
|
||||
|
||||
clearTint: function ()
|
||||
{
|
||||
this._hasTint = false;
|
||||
|
||||
this.setDirty();
|
||||
},
|
||||
|
||||
setTint: function (topLeft, topRight, bottomLeft, bottomRight)
|
||||
{
|
||||
this._tint[0] = topLeft;
|
||||
this._tint[1] = topRight;
|
||||
this._tint[2] = bottomLeft;
|
||||
this._tint[3] = bottomRight;
|
||||
|
||||
this._hasTint = true;
|
||||
|
||||
this.setDirty();
|
||||
},
|
||||
|
||||
getBlendMode: function ()
|
||||
{
|
||||
return this._blendMode;
|
||||
|
@ -102,6 +121,34 @@ Phaser.Component.Color.prototype = {
|
|||
|
||||
Object.defineProperties(Phaser.Component.Color.prototype, {
|
||||
|
||||
tint: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return this._tint;
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
if (Array.isArray(value))
|
||||
{
|
||||
this._tint = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._tint[0] = value;
|
||||
this._tint[1] = value;
|
||||
this._tint[2] = value;
|
||||
this._tint[3] = value;
|
||||
}
|
||||
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
alpha: {
|
||||
|
||||
enumerable: true,
|
||||
|
|
Loading…
Reference in a new issue