1
0
Fork 0

Added reference to first element in circular linked list for tile frames

This will both make it easy to reset an animation and help to display
the first tile (when animations are disabled or for display tiles for
the editor)
master
Mike Gerwitz 2012-03-15 23:42:28 -04:00
parent af533652a6
commit eb5fb38396
2 changed files with 4 additions and 2 deletions

View File

@ -188,7 +188,7 @@ ltjs.MapRender = Class( 'MapRender',
var tile = this._tiles[ tid ],
ctx = ( tile.masked ) ? this._ctxObj : this._ctx;
ctx.putImageData( this._tiles[ tid ].data, x, y );
ctx.putImageData( this._tiles[ tid ].first.data, x, y );
if ( tile.masked )
{

View File

@ -303,7 +303,9 @@ ltjs.TileMasker = Class( 'TileMasker',
// If there is a previous frame, set the 'next' entry to its 'next'
// entry to maintain the circular reference. Otherwise, set to self.
set[ id ].next = ( prev )
// This can also be stored as the 'first' reference to permit quickly
// resetting an animation.
set[ id ].next = set[ id ].first = ( prev )
? prev.next
: set[ id ];