Fixed bug where setText not working correctly

Docs updated
This commit is contained in:
Mat Groves 2014-01-05 18:16:04 +00:00
parent 8cd32d392c
commit 75c7880c93
119 changed files with 2398 additions and 906 deletions

View file

@ -1438,7 +1438,6 @@ PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
for(var i=0,j=this.children.length; i<j; i++)
{
var child = this.children[i];
if(child.interactive)this.stage.dirty = true;
child.removeStageReference();
}
@ -2212,6 +2211,7 @@ PIXI.Text.prototype.setText = function(text)
{
this.text = text.toString() || ' ';
this.dirty = true;
};
/**
@ -2301,7 +2301,18 @@ PIXI.Text.prototype.updateTexture = function()
this._width = this.canvas.width;
this._height = this.canvas.height;
PIXI.texturesToUpdate.push(this.texture.baseTexture);
this.requiresUpdate = true;
};
PIXI.Text.prototype._renderWebGL = function(renderSession)
{
if(this.requiresUpdate)
{
this.requiresUpdate = false;
PIXI.updateWebGLTexture(this.texture.baseTexture, renderSession.gl);
}
PIXI.Sprite.prototype._renderWebGL.call(this, renderSession);
};
/**
@ -5283,6 +5294,36 @@ PIXI.createWebGLTexture = function(texture, gl)
}
};
PIXI.updateWebGLTexture = function(texture, gl)
{
if( texture._glTextures[gl.id] )
{
gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.source);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, texture.scaleMode === PIXI.BaseTexture.SCALE_MODE.LINEAR ? gl.LINEAR : gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === PIXI.BaseTexture.SCALE_MODE.LINEAR ? gl.LINEAR : gl.NEAREST);
// reguler...
if(!texture._powerOf2)
{
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
}
else
{
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);
}
gl.bindTexture(gl.TEXTURE_2D, null);
}
};
/**
* Handles a lost webgl context
*