2013-08-28 06:02:55 +00:00
|
|
|
/**
|
|
|
|
* @author Mat Groves http://matgroves.com/
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A tiling sprite is a fast way of rendering a tiling image
|
|
|
|
*
|
|
|
|
* @class TilingSprite
|
|
|
|
* @extends DisplayObjectContainer
|
|
|
|
* @constructor
|
|
|
|
* @param texture {Texture} the texture of the tiling sprite
|
2013-11-06 04:51:23 +00:00
|
|
|
* @param width {Number} the width of the tiling sprite
|
|
|
|
* @param height {Number} the height of the tiling sprite
|
2013-08-28 06:02:55 +00:00
|
|
|
*/
|
|
|
|
PIXI.TilingSprite = function(texture, width, height)
|
|
|
|
{
|
|
|
|
PIXI.DisplayObjectContainer.call( this );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The texture that the sprite is using
|
|
|
|
*
|
|
|
|
* @property texture
|
|
|
|
* @type Texture
|
|
|
|
*/
|
|
|
|
this.texture = texture;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The width of the tiling sprite
|
|
|
|
*
|
|
|
|
* @property width
|
|
|
|
* @type Number
|
|
|
|
*/
|
|
|
|
this.width = width;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The height of the tiling sprite
|
|
|
|
*
|
|
|
|
* @property height
|
|
|
|
* @type Number
|
|
|
|
*/
|
|
|
|
this.height = height;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The scaling of the image that is being tiled
|
|
|
|
*
|
|
|
|
* @property tileScale
|
|
|
|
* @type Point
|
2013-11-06 04:51:23 +00:00
|
|
|
*/
|
2013-08-28 06:02:55 +00:00
|
|
|
this.tileScale = new PIXI.Point(1,1);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The offset position of the image that is being tiled
|
|
|
|
*
|
|
|
|
* @property tilePosition
|
|
|
|
* @type Point
|
2013-11-06 04:51:23 +00:00
|
|
|
*/
|
2013-08-28 06:02:55 +00:00
|
|
|
this.tilePosition = new PIXI.Point(0,0);
|
|
|
|
|
|
|
|
this.renderable = true;
|
2013-11-06 04:51:23 +00:00
|
|
|
|
2013-08-28 06:02:55 +00:00
|
|
|
this.blendMode = PIXI.blendModes.NORMAL
|
|
|
|
}
|
|
|
|
|
|
|
|
// constructor
|
|
|
|
PIXI.TilingSprite.prototype = Object.create( PIXI.DisplayObjectContainer.prototype );
|
|
|
|
PIXI.TilingSprite.prototype.constructor = PIXI.TilingSprite;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the texture of the tiling sprite
|
|
|
|
*
|
|
|
|
* @method setTexture
|
|
|
|
* @param texture {Texture} The PIXI texture that is displayed by the sprite
|
|
|
|
*/
|
|
|
|
PIXI.TilingSprite.prototype.setTexture = function(texture)
|
|
|
|
{
|
|
|
|
//TODO SET THE TEXTURES
|
|
|
|
//TODO VISIBILITY
|
2013-11-06 04:51:23 +00:00
|
|
|
|
|
|
|
// stop current texture
|
2013-08-28 06:02:55 +00:00
|
|
|
this.texture = texture;
|
|
|
|
this.updateFrame = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When the texture is updated, this event will fire to update the frame
|
|
|
|
*
|
|
|
|
* @method onTextureUpdate
|
|
|
|
* @param event
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
PIXI.TilingSprite.prototype.onTextureUpdate = function(event)
|
|
|
|
{
|
|
|
|
this.updateFrame = true;
|
|
|
|
}
|
|
|
|
|