-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Description
Draw.text creates a new Text graphic every time it is called. Can be fixed pretty simply with caching:
/**
* Draws text.
* @param text The text to render.
* @param x X position.
* @param y Y position.
* @param options Options (see Text constructor).
*/
public static function text(text:String, x:Number = 0, y:Number = 0, options:Object = null):void
{
if (!_textCache[text]) _textCache[text] = new Text(text, x, y, options);
_textCache[text].x = x;
_textCache[text].y = y;
_textCache[text].render(_target, FP.zero, _camera);
}
// Drawing information.
/** @private */ private static var _textCache:Object = { };Metadata
Metadata
Assignees
Labels
No labels