3 lines
1.8 KiB
JavaScript
3 lines
1.8 KiB
JavaScript
var gdjs;(function(i){class s{constructor(t,e,r){this._object=t;const d=e.getGame().getImageManager().getPIXITexture(r);this._tiledSprite=new PIXI.TilingSprite(d,1024,1024),e.getLayer("").getRenderer().addRendererObject(this._tiledSprite,t.getZOrder()),this.updatePosition(),this.updateAngle(),this.updateXOffset(),this.updateYOffset()}getRendererObject(){return this._tiledSprite}updateOpacity(){this._tiledSprite.alpha=this._object.opacity/255}updatePosition(){this._tiledSprite.position.x=this._object.x+this._tiledSprite.width/2,this._tiledSprite.position.y=this._object.y+this._tiledSprite.height/2}setTexture(t,e){const r=e.getGame().getImageManager().getPIXITexture(t);this._tiledSprite.texture=r,this.updatePosition()}updateAngle(){this._tiledSprite.rotation=i.toRad(this._object.angle)}getWidth(){return this._tiledSprite.width}getHeight(){return this._tiledSprite.height}setWidth(t){this._tiledSprite.width=t,this._tiledSprite.pivot.x=t/2,this.updatePosition()}setHeight(t){this._tiledSprite.height=t,this._tiledSprite.pivot.y=t/2,this.updatePosition()}updateXOffset(){this._tiledSprite.tilePosition.x=-this._object._xOffset%this._tiledSprite.texture.width}updateYOffset(){this._tiledSprite.tilePosition.y=-this._object._yOffset%this._tiledSprite.texture.height}setColor(t){const e=t.split(";");e.length<3||(this._tiledSprite.tint="0x"+i.rgbToHex(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10)))}getColor(){const t=new PIXI.Color(this._tiledSprite.tint).toRgbArray();return Math.floor(t[0]*255)+";"+Math.floor(t[1]*255)+";"+Math.floor(t[2]*255)}getTextureWidth(){return this._tiledSprite.texture.width}getTextureHeight(){return this._tiledSprite.texture.height}destroy(){this._tiledSprite.destroy(!1)}}i.TiledSpriteRuntimeObjectRenderer=s})(gdjs||(gdjs={}));
|
|
//# sourceMappingURL=tiledspriteruntimeobject-pixi-renderer.js.map
|