var gdjs;(function(a){class o{constructor(t,e){this._spriteDirty=!0;this._textureDirty=!0;this._cachedWidth=0;this._cachedHeight=0;this._object=t;const i=e.getGame().getImageManager();this._sprite=new PIXI.Sprite(i.getInvalidPIXITexture());const r=e.getLayer("");r&&r.getRenderer().addRendererObject(this._sprite,t.getZOrder())}reinitialize(t,e){this._object=t,this._spriteDirty=!0,this._textureDirty=!0,this._sprite.tint=16777215;const i=e.getLayer("");i&&i.getRenderer().addRendererObject(this._sprite,t.getZOrder())}getRendererObject(){return this._sprite}_updatePIXISprite(){const t=this._object._animator.getCurrentFrame();if(t===null&&!this._object.getInstanceContainer().getGame().isInGameEdition()){this._sprite.visible=!1,this._sprite.alpha=0,this._cachedWidth=0,this._cachedHeight=0,this._spriteDirty=!1;return}let e=0,i=0,r=0,s=0;t?(e=t.center.x,i=t.center.y,r=t.origin.x,s=t.origin.y):(e=this._sprite.texture.frame.width/2,i=this._sprite.texture.frame.height/2,r=0,s=0);const n=this._object._scaleX*this._object._preScale,h=this._object._scaleY*this._object._preScale;this._sprite.anchor.x=e/this._sprite.texture.frame.width,this._sprite.anchor.y=i/this._sprite.texture.frame.height,this._sprite.position.x=this._object.x+(e-r)*Math.abs(n),this._sprite.position.y=this._object.y+(i-s)*Math.abs(h),this._sprite.rotation=a.toRad(this._object.angle),this._sprite.visible=!this._object.hidden,this._sprite.blendMode=this._object._blendMode,this._sprite.alpha=this._object.opacity/255,this._sprite.scale.x=n,this._sprite.scale.y=h,this._cachedWidth=Math.abs(this._sprite.width),this._cachedHeight=Math.abs(this._sprite.height),this._spriteDirty=!1}ensureUpToDate(){this._spriteDirty&&this._updatePIXISprite()}updateFrame(t){this._spriteDirty=!0,this._sprite.texture=t.texture}update(){this._spriteDirty=!0}updateX(){const t=this._object._animator.getCurrentFrame(),e=t?t.center.x-t.origin.x:this.getUnscaledWidth()/2;this._sprite.position.x=this._object.x+e*Math.abs(this._object._scaleX*this._object._preScale)}updateY(){const t=this._object._animator.getCurrentFrame(),e=t?t.center.y-t.origin.y:this.getUnscaledHeight()/2;this._sprite.position.y=this._object.y+e*Math.abs(this._object._scaleY*this._object._preScale)}updateAngle(){this._sprite.rotation=a.toRad(this._object.angle)}updateOpacity(){this._sprite.alpha=this._object.opacity/255}updateVisibility(){this._sprite.visible=!this._object.hidden}setColor(t){this._sprite.tint=a.rgbOrHexStringToNumber(t)}getColor(){const t=new PIXI.Color(this._sprite.tint).toRgbArray();return Math.round(t[0]*255)+";"+Math.round(t[1]*255)+";"+Math.round(t[2]*255)}getWidth(){return this._spriteDirty&&this._updatePIXISprite(),this._cachedWidth}getHeight(){return this._spriteDirty&&this._updatePIXISprite(),this._cachedHeight}getUnscaledWidth(){return this._sprite.texture.frame.width}getUnscaledHeight(){return this._sprite.texture.frame.height}static getAnimationFrameTextureManager(t){return t._pixiAnimationFrameTextureManager||(t._pixiAnimationFrameTextureManager=new _(t)),t._pixiAnimationFrameTextureManager}}a.SpriteRuntimeObjectPixiRenderer=o;class _{constructor(t){this._imageManager=t}getAnimationFrameTexture(t){return this._imageManager.getPIXITexture(t)}getAnimationFrameWidth(t){return t.width}getAnimationFrameHeight(t){return t.height}}a.SpriteRuntimeObjectRenderer=o})(gdjs||(gdjs={}));
//# sourceMappingURL=spriteruntimeobject-pixi-renderer.js.map
