var gdjs;(function(r){const s=GlobalPIXIModule.PIXI;class a{constructor(t,e){this._spriteDirty=!0;this._textureDirty=!0;this._cachedWidth=0;this._cachedHeight=0;this._object=t,this._sprite=new s.Sprite(e.getGame().getImageManager().getInvalidPIXITexture());const i=e.getLayer("");i&&i.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(){this._object._animationFrame!==null?(this._sprite.anchor.x=this._object._animationFrame.center.x/this._sprite.texture.frame.width,this._sprite.anchor.y=this._object._animationFrame.center.y/this._sprite.texture.frame.height,this._sprite.position.x=this._object.x+(this._object._animationFrame.center.x-this._object._animationFrame.origin.x)*Math.abs(this._object._scaleX),this._sprite.position.y=this._object.y+(this._object._animationFrame.center.y-this._object._animationFrame.origin.y)*Math.abs(this._object._scaleY),this._sprite.rotation=r.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=this._object._scaleX,this._sprite.scale.y=this._object._scaleY,this._cachedWidth=Math.abs(this._sprite.width),this._cachedHeight=Math.abs(this._sprite.height)):(this._sprite.visible=!1,this._sprite.alpha=0,this._cachedWidth=0,this._cachedHeight=0),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._animationFrame;this._sprite.position.x=this._object.x+(t.center.x-t.origin.x)*Math.abs(this._object._scaleX)}updateY(){const t=this._object._animationFrame;this._sprite.position.y=this._object.y+(t.center.y-t.origin.y)*Math.abs(this._object._scaleY)}updateAngle(){this._sprite.rotation=r.toRad(this._object.angle)}updateOpacity(){this._sprite.alpha=this._object.opacity/255}updateVisibility(){this._sprite.visible=!this._object.hidden}setColor(t){const e=t.split(";");e.length<3||(this._sprite.tint=r.rgbToHexNumber(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10)))}getColor(){const t=s.utils.hex2rgb(this._sprite.tint);return Math.floor(t[0]*255)+";"+Math.floor(t[1]*255)+";"+Math.floor(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 getAnimationFrame(t,e){return t.getPIXITexture(e)}static getAnimationFrameWidth(t){return t.width}static getAnimationFrameHeight(t){return t.height}}r.SpriteRuntimeObjectPixiRenderer=a,r.SpriteRuntimeObjectRenderer=a})(gdjs||(gdjs={}));
//# sourceMappingURL=spriteruntimeobject-pixi-renderer.js.map
