OK but in my case i needed something like this drawText(PIXI.Text, x, y, maxwidth)
You needed? I thought you needed something that would help you turn the text 90 degrees
😛
But now seriously. MV text is a bitmap with some predefined functions. In particular this is what drawText is.
Code:
Bitmap.prototype.drawText = function(text, x, y, maxWidth, lineHeight, align) {
// Note: Firefox has a bug with textBaseline: Bug 737852
// So we use 'alphabetic' here.
if (text !== undefined) {
var tx = x;
var ty = y + lineHeight - (lineHeight - this.fontSize * 0.7) / 2;
var context = this._context;
var alpha = context.globalAlpha;
maxWidth = maxWidth || 0xffffffff;
if (align === 'center') {
tx += maxWidth / 2;
}
if (align === 'right') {
tx += maxWidth;
}
context.save();
context.font = this._makeFontNameText();
context.textAlign = align;
context.textBaseline = 'alphabetic';
context.globalAlpha = 1;
this._drawTextOutline(text, tx, ty, maxWidth);
context.globalAlpha = alpha;
this._drawTextBody(text, tx, ty, maxWidth);
context.restore();
this._setDirty();
}
};
However, PIXI.Text is not a prototype of bitmap. PIXI.Text, just like every other PIXI renderable object, is on its own and every sprite etc. is derived from PIXI, not the other way around (with the exceptions of MV text, which is done in a very weird way).
In practice it means that drawText is a feature exclusive to MV text and PIXI.Text doesn't have it.
If you want to see if you can rotate text by default, maybe you can try to log it in console (var foo = this.drawText (...)) and see if you can rotate it somewhat.