Initial GDevelop project import

This commit is contained in:
2026-07-28 10:47:32 -04:00
parent 8a5417b59e
commit 8bf6a02036
137 changed files with 29483 additions and 0 deletions
@@ -0,0 +1,2 @@
var gdjs;(function(r){class a{constructor(e,t,n){this._isContainerDirty=!0;this._debugDraw=null;this._debugDrawContainer=null;this._object=e,this._instanceContainer=t,this._pixiContainer=new PIXI.Container,this._debugDrawRenderedObjectsPoints={},this._pixiContainer.sortableChildren=!0,this._debugDraw=null;const i=n.getLayer("");i&&i.getRenderer().addRendererObject(this._pixiContainer,e.getZOrder())}reinitialize(e,t){this._object=e,this._isContainerDirty=!0,this._pixiContainer.removeChildren()}getRendererObject(){return this._pixiContainer}get3DRendererObject(){return null}_updatePIXIContainer(){const e=this._object.getScaleX(),t=this._object.getScaleY(),n=this._object.getOpacity();this._pixiContainer.pivot.x=this._object.getUnscaledCenterX(),this._pixiContainer.pivot.y=this._object.getUnscaledCenterY(),this._pixiContainer.position.x=this._object.getX()+this._pixiContainer.pivot.x*Math.abs(e),this._pixiContainer.position.y=this._object.getY()+this._pixiContainer.pivot.y*Math.abs(t),this._pixiContainer.rotation=r.toRad(this._object.angle),this._pixiContainer.scale.x=e*(this._object.isFlippedX()?-1:1),this._pixiContainer.scale.y=t*(this._object.isFlippedY()?-1:1),this._pixiContainer.visible=!this._object.hidden,this._pixiContainer.alpha=n/255,this._isContainerDirty=!1}ensureUpToDate(){this._isContainerDirty&&this._updatePIXIContainer()}update(){this._isContainerDirty=!0}updateX(){const e=this._object.getScaleX();this._pixiContainer.position.x=this._object.x+this._pixiContainer.pivot.x*Math.abs(e)}updateY(){const e=this._object.getScaleY();this._pixiContainer.position.y=this._object.y+this._pixiContainer.pivot.y*Math.abs(e)}updateAngle(){this._pixiContainer.rotation=r.toRad(this._object.angle)}updateOpacity(){const e=this._object.getOpacity();this._pixiContainer.alpha=e/255}updateVisibility(){this._pixiContainer.visible=!this._object.hidden}getPIXIContainer(){return this._pixiContainer}getPIXIRenderer(){return null}setLayerIndex(e,t){const n=e.getRenderer();let i=n.getRendererObject();e.isLightingLayer()&&(i=n.getLightingSprite()),!!i&&this._pixiContainer.children.indexOf(i)!==t&&(this._pixiContainer.removeChild(i),this._pixiContainer.addChildAt(i,t))}static getAnimationFrameTextureManager(e){return r.SpriteRuntimeObjectPixiRenderer.getAnimationFrameTextureManager(e)}}r.CustomRuntimeObject2DPixiRenderer=a,r.CustomRuntimeObject2DRenderer=r.CustomRuntimeObject2DPixiRenderer})(gdjs||(gdjs={}));
//# sourceMappingURL=CustomRuntimeObject2DPixiRenderer.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(b){class y{constructor(d){this._debugDraw=null;this._debugDrawContainer=null;this._instanceContainer=d,this._debugDrawRenderedObjectsPoints={},this._debugDraw=null}getRendererObject(){return this._debugDrawContainer}renderDebugDraw(d,w,_,R){const D=this._instanceContainer.getRenderer().getRendererObject();(!this._debugDraw||!this._debugDrawContainer)&&(this._debugDrawContainer=new PIXI.Container,this._debugDraw=new PIXI.Graphics,this._debugDrawContainer.addChild(this._debugDraw),D&&D.addChild(this._debugDrawContainer));const n=this._debugDraw;for(let r in this._debugDrawRenderedObjectsPoints)this._debugDrawRenderedObjectsPoints[r].wasRendered=!1;const u=(r,e,t,l,i)=>{n.line.color=t,n.fill.color=t,n.drawCircle(l,i,3),_&&(r[e]||(r[e]=new PIXI.Text(e,{fill:t,fontSize:12}),this._debugDrawContainer.addChild(r[e])),r[e].position.set(l,i))};n.clear(),n.beginFill(),n.alpha=.8,n.lineStyle(2,255,1);const c=[0,0];for(let r=0;r<d.length;r++){const e=d[r],t=this._instanceContainer.getLayer(e.getLayer());if((!e.isVisible()||!t.isVisible())&&!w||!e.getRendererObject())continue;const i=e.getAABB();n.fill.alpha=.2,n.line.color=7835368,n.fill.color=7835368;const a=[];a.push.apply(a,t.applyLayerTransformation(i.min[0],i.min[1],0,c)),a.push.apply(a,t.applyLayerTransformation(i.max[0],i.min[1],0,c)),a.push.apply(a,t.applyLayerTransformation(i.max[0],i.max[1],0,c)),a.push.apply(a,t.applyLayerTransformation(i.min[0],i.max[1],0,c)),n.drawPolygon(a)}for(let r=0;r<d.length;r++){const e=d[r],t=this._instanceContainer.getLayer(e.getLayer());if((!e.isVisible()||!t.isVisible())&&!w||!e.getRendererObject())continue;const i=e.id;this._debugDrawRenderedObjectsPoints[i]||(this._debugDrawRenderedObjectsPoints[i]={wasRendered:!0,points:{}});const a=this._debugDrawRenderedObjectsPoints[i];a.wasRendered=!0;const m=t.getCameraX(),C=t.getCameraY();let f=t.getCameraWidth()/2,h=t.getCameraHeight()/2;if(t.getCameraRotation()!==0){const o=f+h;f=o,h=o}for(const o of e.getHitBoxesAround(m-f,C-h,m+f,C+h)){const g=[];o.vertices.forEach(s=>{s=t.applyLayerTransformation(s[0],s[1],0,c),g.push(s[0]),g.push(s[1])}),n.fill.alpha=0,n.line.alpha=.5,n.line.color=16711680,n.drawPolygon(g)}n.fill.alpha=.3;const P=t.applyLayerTransformation(e.getCenterXInScene(),e.getCenterYInScene(),0,c);u(a.points,"Center",16776960,P[0],P[1]);const p=t.applyLayerTransformation(e.getX(),e.getY(),0,c);if(u(a.points,"Position",16711680,p[0],p[1]),e instanceof b.SpriteRuntimeObject){let o=e.getPointPosition("origin");(Math.abs(o[0]-p[0])>=1||Math.abs(o[1]-p[1])>=1)&&(o=t.applyLayerTransformation(o[0],o[1],0,c),u(a.points,"Origin",16711680,o[0],o[1]))}if(R&&e instanceof b.SpriteRuntimeObject){const o=e._animator.getCurrentFrame();if(!o)continue;for(const g in o.points.items){let s=e.getPointPosition(g);s=t.applyLayerTransformation(s[0],s[1],0,c),u(a.points,g,255,s[0],s[1])}}}for(const r in this._debugDrawRenderedObjectsPoints){const e=this._debugDrawRenderedObjectsPoints[r];if(e.wasRendered)continue;const t=e.points;for(const l in t)this._debugDrawContainer.removeChild(t[l])}n.endFill()}clearDebugDraw(){if(this._debugDraw&&this._debugDraw.clear(),this._debugDrawContainer){this._debugDrawContainer.destroy({children:!0});const d=this._instanceContainer.getRenderer().getRendererObject();d&&d.removeChild(this._debugDrawContainer)}this._debugDraw=null,this._debugDrawContainer=null,this._debugDrawRenderedObjectsPoints={}}}b.DebuggerPixiRenderer=y,b.DebuggerRenderer=b.DebuggerPixiRenderer})(gdjs||(gdjs={}));
//# sourceMappingURL=DebuggerPixiRenderer.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
var gdjs;(function(o){const a=new o.Logger("Bitmap text"),p="GDJS-DEFAULT-BITMAP-FONT",d=5,u=(n,t)=>{const i=n.pageTextures;return i&&Object.values(i).some(e=>e.baseTexture&&e.baseTexture.destroyed||e.baseTexture!==t.baseTexture)},m=(n,t)=>{const i=n.font;return n.font=t,PIXI.BitmapFont.available[t]=n,delete PIXI.BitmapFont.available[i],PIXI.BitmapFont.available[t]},F=["bitmapFont"];class c{constructor(t,i){this._pixiBitmapFontsInUse={};this._pixiBitmapFontsToUninstall=[];this._loadedFontsData=new o.ResourceCache;this._defaultSlugFontName=null;this._imageManager=i,this._resourceLoader=t}getResourceKinds(){return F}getDefaultBitmapFont(){if(this._defaultSlugFontName!==null)return PIXI.BitmapFont.available[this._defaultSlugFontName];const t="Arial",i=new PIXI.TextStyle({fontFamily:t,fontSize:20,padding:5,align:"left",fill:"#ffffff",wordWrap:!0,lineHeight:20}),e=m(PIXI.BitmapFont.from(t,i,{chars:[[" ","~"]]}),p);return this._defaultSlugFontName=e.font,e}_markBitmapFontAsUsed(t){this._pixiBitmapFontsInUse[t]=this._pixiBitmapFontsInUse[t]||{objectsUsingTheFont:0},this._pixiBitmapFontsInUse[t].objectsUsingTheFont++;for(let i=0;i<this._pixiBitmapFontsToUninstall.length;)this._pixiBitmapFontsToUninstall[i]===t?this._pixiBitmapFontsToUninstall.splice(i,1):i++}releaseBitmapFont(t){if(t!==p){if(!this._pixiBitmapFontsInUse[t]){a.warn("BitmapFont with name "+t+" was tried to be released but was never marked as used.");return}if(this._pixiBitmapFontsInUse[t].objectsUsingTheFont--,this._pixiBitmapFontsInUse[t].objectsUsingTheFont===0&&(delete this._pixiBitmapFontsInUse[t],this._pixiBitmapFontsToUninstall.includes(t)||this._pixiBitmapFontsToUninstall.push(t),this._pixiBitmapFontsToUninstall.length>d)){const i=this._pixiBitmapFontsToUninstall.shift();PIXI.BitmapFont.available[i]&&PIXI.BitmapFont.uninstall(i),a.log("Bitmap Text",'Uninstalled BitmapFont "'+i+'" from memory.')}}}obtainBitmapFont(t,i){const e=t+"@"+i;if(PIXI.BitmapFont.available[e]&&u(PIXI.BitmapFont.available[e],this._imageManager.getPIXITexture(i))&&PIXI.BitmapFont.uninstall(e),PIXI.BitmapFont.available[e])return this._markBitmapFontAsUsed(e),PIXI.BitmapFont.available[e];const r=this._loadedFontsData.getFromName(t);if(!r)return a.warn('Could not find Bitmap Font for resource named "'+t+'". The default font will be used.'),this.getDefaultBitmapFont();const l=this._imageManager.getPIXITexture(i);try{const s=m(PIXI.BitmapFont.install(r,l),e);return this._markBitmapFontAsUsed(e),s}catch(s){return a.error('Could not load the Bitmap Font for resource named "'+t+'". The default font will be used. Error is: '+s),this.getDefaultBitmapFont()}}async processResource(t){}async loadResource(t){const i=this._resourceLoader.getResource(t);if(!i){a.warn('Unable to find bitmap font for resource "'+t+'".');return}if(!this._loadedFontsData.get(i))try{const e=await fetch(this._resourceLoader.getFullUrl(i.file),{credentials:this._resourceLoader.checkIfCredentialsRequired(i.file)?"include":"same-origin"});if(!e.ok)throw new Error(`HTTP error while loading bitmap font. Status is ${e.status}.`);const l=(await e.text()).split(`
`).filter(s=>!s.trim().startsWith("#")).join(`
`);this._loadedFontsData.set(i,l)}catch(e){throw a.error("Can't fetch the bitmap font file "+i.file+", error: "+e),this._loadedFontsData.delete(i),e}}dispose(){for(const t in this._pixiBitmapFontsInUse)PIXI.BitmapFont.uninstall(t);for(const t of this._pixiBitmapFontsToUninstall)PIXI.BitmapFont.uninstall(t);this._pixiBitmapFontsInUse={},this._pixiBitmapFontsToUninstall.length=0,this._loadedFontsData.clear()}unloadResource(t){this._loadedFontsData.delete(t);for(let i=0;i<this._pixiBitmapFontsToUninstall.length;i++){const e=this._pixiBitmapFontsToUninstall[i];e.startsWith(t.name+"@")&&(PIXI.BitmapFont.available[e]&&PIXI.BitmapFont.uninstall(e),this._pixiBitmapFontsToUninstall.splice(i,1),i--)}}}o.PixiBitmapFontManager=c,o.BitmapFontManager=o.PixiBitmapFontManager})(gdjs||(gdjs={}));
//# sourceMappingURL=pixi-bitmapfont-manager.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(i){class f{initializeEffect(e,t,n){const r=i.PixiFiltersTools.getFilterCreator(e.effectType);return r?(t[e.name]=r.makeFilter(n,e),!0):(console.warn(`Effect: "${e.name}", on layer: "${n.getName()}", has an unknown effect type: "${e.effectType}". Was it registered properly? Is the effect type correct?`),!1)}updatePreRender(e,t){for(const n in e)e[n].updatePreRender(t)}addEffect(e,t,n){let r=!0;return r=this.initializeEffect(e,t,n)&&r,r=this.updateAllEffectParameters(t,e)&&r,t[e.name]&&(r=t[e.name].applyEffect(n)&&r),r}removeEffect(e,t,n){const r=e[n];return r?(r.removeEffect(t),delete e[n],!0):!1}clearEffects(e){return e&&(e.filters=[]),!0}setEffectDoubleParameter(e,t,n,r){const a=e[t];return a?(a.updateDoubleParameter(n,r),!0):!1}setEffectStringParameter(e,t,n,r){const a=e[t];return a?(a.updateStringParameter(n,r),!0):!1}setEffectBooleanParameter(e,t,n,r){const a=e[t];return a?(a.updateBooleanParameter(n,r),!0):!1}updateAllEffectParameters(e,t){let n=!0,r=!0,a=!0;for(let s in t.doubleParameters)n=this.setEffectDoubleParameter(e,t.name,s,t.doubleParameters[s])&&n;for(let s in t.stringParameters)r=this.setEffectStringParameter(e,t.name,s,t.stringParameters[s])&&r;for(let s in t.booleanParameters)a=this.setEffectBooleanParameter(e,t.name,s,t.booleanParameters[s])&&a;return n&&r&&a}hasEffect(e,t){return!!e[t]}enableEffect(e,t,n,r){const a=e[n];!a||a.setEnabled(t,r)}isEffectEnabled(e,t,n){const r=e[n];return r?r.isEnabled(t):!1}}i.EffectsManager=f})(gdjs||(gdjs={}));
//# sourceMappingURL=pixi-effects-manager.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(o){const f=new o.Logger("Filters");let m;(function(n){n.clampValue=function(r,e,t){return Math.max(e,Math.min(t,r))},n.clampKernelSize=function(r,e,t){const a=Math.round((t-e)/2+1),s=new Array(a);for(let l=0;l<a;l++)s[l]=e+2*l;return s.indexOf(r)!==-1?r:e};const i={};n.getFilterCreator=function(r){return i.hasOwnProperty(r)?i[r]:null},n.registerFilterCreator=function(r,e){i.hasOwnProperty(r)&&f.warn('Filter "'+r+'" was already registered in gdjs.PixiFiltersTools. Replacing it with the new one.'),i[r]=e};class b{makeFilter(e,t){const a=this.makePIXIFilter(e,t);return e.isLightingLayer&&e.isLightingLayer()&&(a.blendMode=PIXI.BLEND_MODES.ADD),new u(a,this)}}n.PixiFilterCreator=b;class u{constructor(e,t){this.pixiFilter=e,this.filterCreator=t}isEnabled(e){return this.pixiFilter.enabled}setEnabled(e,t){return this.pixiFilter.enabled=t}applyEffect(e){const t=e.getRendererObject();return t?(t.filters=(t.filters||[]).concat(this.pixiFilter),!0):!1}removeEffect(e){const t=e.getRendererObject();return t?(t.filters=(t.filters||[]).filter(a=>a!==this.pixiFilter),!0):!1}updatePreRender(e){this.filterCreator.updatePreRender(this.pixiFilter,e)}updateDoubleParameter(e,t){this.filterCreator.updateDoubleParameter(this.pixiFilter,e,t)}updateStringParameter(e,t){this.filterCreator.updateStringParameter(this.pixiFilter,e,t)}updateBooleanParameter(e,t){this.filterCreator.updateBooleanParameter(this.pixiFilter,e,t)}updateColorParameter(e,t){this.filterCreator.updateColorParameter(this.pixiFilter,e,t)}getDoubleParameter(e){return this.filterCreator.getDoubleParameter(this.pixiFilter,e)}getColorParameter(e){return this.filterCreator.getColorParameter(this.pixiFilter,e)}getNetworkSyncData(){return{ena:this.pixiFilter.enabled,fc:this.filterCreator.getNetworkSyncData(this.pixiFilter)}}updateFromNetworkSyncData(e){this.pixiFilter.enabled=e.ena,this.filterCreator.updateFromNetworkSyncData(this.pixiFilter,e.fc)}}n.PixiFilter=u;class F{isEnabled(e){return!1}setEnabled(e,t){return!1}applyEffect(e){return!1}removeEffect(e){return!1}updatePreRender(e){}updateDoubleParameter(e,t){}updateStringParameter(e,t){}updateBooleanParameter(e,t){}updateColorParameter(e,t){}getDoubleParameter(e){return 0}getColorParameter(e){return 0}getNetworkSyncData(){return{}}updateFromNetworkSyncData(e){}}n.EmptyFilter=F})(m=o.PixiFiltersTools||(o.PixiFiltersTools={}))})(gdjs||(gdjs={}));
//# sourceMappingURL=pixi-filters-tools.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
var gdjs;(function(d){class m{constructor(t,e){this._profilerText=null;this._showCursorAtNextRender=!1;this._threeRenderer=null;this._layerRenderingMetrics={rendered2DLayersCount:0,rendered3DLayersCount:0};this._backgroundColor=null;this._runtimeGameRenderer=e,this._runtimeScene=t,this._pixiContainer=new PIXI.Container,this._pixiContainer.sortableChildren=!0,this._threeRenderer=this._runtimeGameRenderer?this._runtimeGameRenderer.getThreeRenderer():null}onGameResolutionResized(){const t=this._runtimeGameRenderer?this._runtimeGameRenderer.getPIXIRenderer():null;if(!t)return;const e=this._runtimeScene.getGame();this._pixiContainer.scale.x=t.width/e.getGameResolutionWidth(),this._pixiContainer.scale.y=t.height/e.getGameResolutionHeight();for(const r of this._runtimeScene._orderedLayers)r.getRenderer().onGameResolutionResized()}onSceneUnloaded(){}render(){const t=this._runtimeGameRenderer;if(!t)return;const e=t.getPIXIRenderer();if(!e)return;const r=this._threeRenderer;if(!(r&&r.xr.isPresenting)){if(this._layerRenderingMetrics.rendered2DLayersCount=0,this._layerRenderingMetrics.rendered3DLayersCount=0,r){r.info.autoReset=!1,r.info.reset();let n=!0,s=!0;r.resetState();for(let l=0;l<this._runtimeScene._orderedLayers.length;++l){const o=this._runtimeScene._orderedLayers[l];if(!o.isVisible())continue;const i=o.getRenderer(),c=o.getRenderingType();if(this._runtimeScene.getGame().isInGameEdition()||c!==d.RuntimeLayerRenderingType.TWO_D&&i.has3DObjects()){const a=i.getThreeScene(),h=i.getThreeCamera(),R=i.getThreeEffectComposer();if(a&&h&&R){if(c===d.RuntimeLayerRenderingType.TWO_D_PLUS_THREE_D){const g=i.has2DObjects();g&&(s&&(r.resetState(),e.reset()),i.renderOnPixiRenderTexture(e),i.updateThreePlaneTextureFromPixiRenderTexture(r,e),this._layerRenderingMetrics.rendered2DLayersCount++,s=!1),i.show2DRenderingPlane(g)}s||(e.reset(),r.resetState()),n?(r.setClearColor(this._runtimeScene.getBackgroundColor()),r.resetState(),this._runtimeScene.getClearCanvas()&&r.clear(),this._backgroundColor||(this._backgroundColor=new THREE.Color),this._backgroundColor.set(this._runtimeScene.getBackgroundColor()),a.background||(a.background=this._backgroundColor),n=!1):a.background===this._backgroundColor&&(a.background=null),r.clearDepth(),i.hasPostProcessingPass()?R.render():r.render(a,h),this._layerRenderingMetrics.rendered3DLayersCount++,s=!0}}else{s&&(r.resetState(),e.reset()),n&&(e.background.color=this._runtimeScene.getBackgroundColor(),e.background.alpha=1,this._runtimeScene.getClearCanvas()&&e.clear(),n=!1),o.isLightingLayer()&&i.renderOnPixiRenderTexture(e);const a=o.isLightingLayer()&&i.getLightingSprite()||i.getRendererObject();e.render(a,{clear:!1}),this._layerRenderingMetrics.rendered2DLayersCount++,s=!1}}const u=this._runtimeScene.getDebuggerRenderer().getRendererObject();u&&(r.resetState(),e.reset(),e.render(u),s=!1),s||e.reset()}else{for(const n of this._runtimeScene._orderedLayers)n.isLightingLayer()&&n.getRenderer().renderOnPixiRenderTexture(e);e.background.color=this._runtimeScene.getBackgroundColor(),e.render(this._pixiContainer,{clear:this._runtimeScene.getClearCanvas()}),this._layerRenderingMetrics.rendered2DLayersCount++}if(this._showCursorAtNextRender){const n=t.getCanvas();n&&(n.style.cursor=""),this._showCursorAtNextRender=!1}}}renderForVR(){if(!this._runtimeGameRenderer)return;const e=this._threeRenderer;if(!e)throw new Error("Cannot render a scene with no 3D elements in VR!");let r=!0;for(let n=0;n<this._runtimeScene._orderedLayers.length;++n){const s=this._runtimeScene._orderedLayers[n];if(!s.isVisible())continue;const u=s.getRenderer();if(s.getRenderingType()===d.RuntimeLayerRenderingType.TWO_D||!u.has3DObjects())continue;const o=u.getThreeScene(),i=u.getThreeCamera();!o||!i||(r?(e.setClearColor(this._runtimeScene.getBackgroundColor()),this._runtimeScene.getClearCanvas()&&e.clear(),o.background=new THREE.Color(this._runtimeScene.getBackgroundColor()),r=!1):o.background=null,e.clearDepth(),e.render(o,i))}}_renderProfileText(){const t=this._runtimeScene.getProfiler();if(!t)return;this._profilerText||(this._profilerText=new PIXI.Text(" ",{align:"left",stroke:"#FFF",strokeThickness:1}),this._pixiContainer.addChild(this._profilerText));const e=t.getFramesAverageMeasures(),r=[];d.Profiler.getProfilerSectionTexts("All",e,r),this._profilerText.text=r.join(`
`)}hideCursor(){this._showCursorAtNextRender=!1;const t=this._runtimeGameRenderer?this._runtimeGameRenderer.getCanvas():null;t&&(t.style.cursor="none")}showCursor(){this._showCursorAtNextRender=!0}getPIXIContainer(){return this._pixiContainer}getRendererObject(){return this._pixiContainer}get3DRendererObject(){return null}getPIXIRenderer(){return this._runtimeGameRenderer?this._runtimeGameRenderer.getPIXIRenderer():null}setLayerIndex(t,e){const r=t.getRenderer();let n=r.getRendererObject();t.isLightingLayer()&&(n=r.getLightingSprite()),!!n&&this._pixiContainer.children.indexOf(n)!==e&&(this._pixiContainer.removeChild(n),this._pixiContainer.addChildAt(n,e))}}d.RuntimeScenePixiRenderer=m,d.RuntimeSceneRenderer=d.RuntimeScenePixiRenderer})(gdjs||(gdjs={}));
//# sourceMappingURL=runtimescene-pixi-renderer.js.map
@@ -0,0 +1,2 @@
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