@@ -23,7 +23,8 @@ Phaser.Component.Color = function (gameObject)
2323
2424 this . _blendMode = 0 ;
2525
26- this . _tint = [ 0xffffff , 0xffffff , 0xffffff , 0xffffff ] ;
26+ this . _tint = { topLeft : 0xffffff , topRight : 0xffffff , bottomLeft : 0xffffff , bottomRight : 0xffffff } ;
27+ this . _glTint = { topLeft : 16777215 , topRight : 16777215 , bottomLeft : 16777215 , bottomRight : 16777215 } ;
2728 this . _hasTint = false ;
2829
2930 this . _r = 0 ;
@@ -58,9 +59,9 @@ Phaser.Component.Color.prototype = {
5859
5960 clearTint : function ( )
6061 {
61- this . _hasTint = false ;
62+ this . setTint ( 0xffffff ) ;
6263
63- this . setDirty ( ) ;
64+ this . _hasTint = false ;
6465 } ,
6566
6667 setTint : function ( topLeft , topRight , bottomLeft , bottomRight )
@@ -72,10 +73,10 @@ Phaser.Component.Color.prototype = {
7273 bottomRight = topLeft ;
7374 }
7475
75- this . _tint [ 0 ] = topLeft ;
76- this . _tint [ 1 ] = topRight ;
77- this . _tint [ 2 ] = bottomLeft ;
78- this . _tint [ 3 ] = bottomRight ;
76+ this . tintTopLeft = topLeft ;
77+ this . tintTopRight = topRight ;
78+ this . tintBottomLeft = bottomLeft ;
79+ this . tintBottomRight = bottomRight ;
7980
8081 this . _hasTint = true ;
8182
@@ -128,34 +129,98 @@ Phaser.Component.Color.prototype = {
128129
129130Object . defineProperties ( Phaser . Component . Color . prototype , {
130131
131- tint : {
132+ tintTopLeft : {
132133
133134 enumerable : true ,
134135
135136 get : function ( )
136137 {
137- return this . _tint ;
138+ return this . _tint . topLeft ;
138139 } ,
139140
140141 set : function ( value )
141142 {
142- if ( Array . isArray ( value ) )
143- {
144- this . _tint = value ;
145- }
146- else
147- {
148- this . _tint [ 0 ] = value ;
149- this . _tint [ 1 ] = value ;
150- this . _tint [ 2 ] = value ;
151- this . _tint [ 3 ] = value ;
152- }
143+ this . _tint . topLeft = value ;
144+ // this._glTint.topLeft = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16) + (this._worldAlpha * 255 << 24);
145+ this . _glTint . topLeft = ( value >> 16 ) + ( value & 0xff00 ) + ( ( value & 0xff ) << 16 ) ;
146+ this . setDirty ( ) ;
147+ }
148+
149+ } ,
153150
151+ tintTopRight : {
152+
153+ enumerable : true ,
154+
155+ get : function ( )
156+ {
157+ return this . _tint . topRight ;
158+ } ,
159+
160+ set : function ( value )
161+ {
162+ this . _tint . topRight = value ;
163+ // this._glTint.topRight = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16) + (this._worldAlpha * 255 << 24);
164+ this . _glTint . topRight = ( value >> 16 ) + ( value & 0xff00 ) + ( ( value & 0xff ) << 16 ) ;
154165 this . setDirty ( ) ;
155166 }
156167
157168 } ,
158169
170+ tintBottomLeft : {
171+
172+ enumerable : true ,
173+
174+ get : function ( )
175+ {
176+ return this . _tint . bottomLeft ;
177+ } ,
178+
179+ set : function ( value )
180+ {
181+ this . _tint . bottomLeft = value ;
182+ this . _glTint . bottomLeft = ( value >> 16 ) + ( value & 0xff00 ) + ( ( value & 0xff ) << 16 ) ;
183+ // this._glTint.bottomLeft = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16) + (this._worldAlpha * 255 << 24);
184+ this . setDirty ( ) ;
185+ }
186+
187+ } ,
188+
189+ tintBottomRight : {
190+
191+ enumerable : true ,
192+
193+ get : function ( )
194+ {
195+ return this . _tint . bottomRight ;
196+ } ,
197+
198+ set : function ( value )
199+ {
200+ this . _tint . bottomRight = value ;
201+ this . _glTint . bottomRight = ( value >> 16 ) + ( value & 0xff00 ) + ( ( value & 0xff ) << 16 ) ;
202+ // this._glTint.bottomRight = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16) + (this._worldAlpha * 255 << 24);
203+ this . setDirty ( ) ;
204+ }
205+
206+ } ,
207+
208+ tint : {
209+
210+ enumerable : true ,
211+
212+ get : function ( )
213+ {
214+ return this . _tint ;
215+ } ,
216+
217+ set : function ( value )
218+ {
219+ this . setTint ( value , value , value , value ) ;
220+ }
221+
222+ } ,
223+
159224 alpha : {
160225
161226 enumerable : true ,
0 commit comments