var gdjs;(function(s){class o{constructor(t,e){this._object=t;const i=e.getGame().getBitmapFontManager().obtainBitmapFont(t._bitmapFontResourceName,t._textureAtlasResourceName);this._pixiObject=new PIXI.BitmapText(t._text,{fontName:i.font,fontSize:i.size}),e.getLayer("").getRenderer().addRendererObject(this._pixiObject,t.getZOrder()),this.updateAlignment(),this.updateTextContent(),this.updateAngle(),this.updateOpacity(),this.updateScale(),this.updateWrappingWidth(),this.updateTint()}getRendererObject(){return this._pixiObject}onDestroy(){const t=this._pixiObject.fontName;this._pixiObject.destroy(),this._object.getInstanceContainer().getGame().getBitmapFontManager().releaseBitmapFont(t)}getFontSize(){return this._pixiObject.fontSize}updateFont(){const t=this._object.getInstanceContainer().getGame().getBitmapFontManager().obtainBitmapFont(this._object._bitmapFontResourceName,this._object._textureAtlasResourceName),e=this._pixiObject.fontName;this._pixiObject.fontName=t.font,this._pixiObject.fontSize=t.size,this._object.getInstanceContainer().getGame().getBitmapFontManager().releaseBitmapFont(e),this.updatePosition()}updateTint(){this._pixiObject.tint=s.rgbToHexNumber(this._object._tint[0],this._object._tint[1],this._object._tint[2]),this._pixiObject.dirty=!0}getTint(){return this._object._tint[0]+";"+this._object._tint[1]+";"+this._object._tint[2]}updateScale(){this._pixiObject.scale.set(Math.max(this._object._scaleX,0),Math.max(this._object._scaleY,0)),this.updatePosition()}getScale(){return Math.max(this._pixiObject.scale.x,this._pixiObject.scale.y)}updateWrappingWidth(){this._object._wrapping?(this._pixiObject.maxWidth=this._object._wrappingWidth/this._object._scaleX,this._pixiObject.dirty=!0):(this._pixiObject.maxWidth=0,this._pixiObject.dirty=!0),this.updatePosition()}updateTextContent(){this._pixiObject.text=this._object._text,this.updatePosition()}updateAlignment(){this._pixiObject.align=this._object._textAlign,this.updatePosition()}updatePosition(){if(this._object.isWrapping()&&this.getWidth()!==0){const e=this._object._textAlign==="right"?1:this._object._textAlign==="center"?.5:0,i=this._object.getWrappingWidth(),n=this.getWidth(),a=(i-n)*(e-.5);this._pixiObject.position.x=this._object.x+i/2,this._pixiObject.anchor.x=.5-a/n}else this._pixiObject.position.x=this._object.x+this.getWidth()/2,this._pixiObject.anchor.x=.5;const t=this._object._verticalTextAlignment==="bottom"?1:this._object._verticalTextAlignment==="center"?.5:0;this._pixiObject.position.y=this._object.y+this.getHeight()*(.5-t),this._pixiObject.anchor.y=.5}updateAngle(){this._pixiObject.rotation=s.toRad(this._object.angle)}updateOpacity(){this._pixiObject.alpha=this._object._opacity/255}getWidth(){return this._pixiObject.textWidth*this.getScale()}getHeight(){return this._pixiObject.textHeight*this.getScale()}}s.BitmapTextRuntimeObjectPixiRenderer=o,s.BitmapTextRuntimeObjectRenderer=o})(gdjs||(gdjs={}));
//# sourceMappingURL=bitmaptextruntimeobject-pixi-renderer.js.map
