1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 2 | /** * @author Mat Groves http://matgroves.com/ */ PIXI.Strip = function(texture, width, height) { PIXI.DisplayObjectContainer.call( this ); this.texture = texture; this.blendMode = PIXI.blendModes.NORMAL; try { this.uvs = new Float32Array([0, 1, 1, 1, 1, 0, 0,1]); this.verticies = new Float32Array([0, 0, 0,0, 0,0, 0, 0, 0]); this.colors = new Float32Array([1, 1, 1, 1]); this.indices = new Uint16Array([0, 1, 2, 3]); } catch(error) { this.uvs = [0, 1, 1, 1, 1, 0, 0,1]; this.verticies = [0, 0, 0,0, 0,0, 0, 0, 0]; this.colors = [1, 1, 1, 1]; this.indices = [0, 1, 2, 3]; } /* this.uvs = new Float32Array() this.verticies = new Float32Array() this.colors = new Float32Array() this.indices = new Uint16Array() */ this.width = width; this.height = height; // load the texture! Iif(texture.baseTexture.hasLoaded) { this.width = this.texture.frame.width; this.height = this.texture.frame.height; this.updateFrame = true; } else { this.onTextureUpdateBind = this.onTextureUpdate.bind(this); this.texture.addEventListener( 'update', this.onTextureUpdateBind ); } this.renderable = true; }; // constructor PIXI.Strip.prototype = Object.create( PIXI.DisplayObjectContainer.prototype ); PIXI.Strip.prototype.constructor = PIXI.Strip; PIXI.Strip.prototype.setTexture = function(texture) { //TODO SET THE TEXTURES //TODO VISIBILITY // stop current texture this.texture = texture; this.width = texture.frame.width; this.height = texture.frame.height; this.updateFrame = true; }; PIXI.Strip.prototype.onTextureUpdate = function() { this.updateFrame = true; }; // some helper functions.. |