excalibur 0.32.0-alpha.1590 → 0.32.0-alpha.1592

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -74,6 +74,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
74
74
 
75
75
  ### Fixed
76
76
 
77
+ - Fixed issue where setting the width/height of a ScreenElement was incorrectly scaled when supplied with a scale in the ctor
77
78
  - Fixed issue where onRemove would sometimes not be called
78
79
  - Fixed issue where pointer containment WAS NOT being uses on collision shape geometry, only their bounds
79
80
  - Fixed issue where overriding built in uniforms and graphics no longer worked as v0.30.x
@@ -1,4 +1,4 @@
1
- import type { ImageSource } from './ImageSource';
1
+ import { ImageSource } from './ImageSource';
2
2
  import type { SourceView } from './Sprite';
3
3
  import { Sprite } from './Sprite';
4
4
  import type { GraphicOptions } from './Graphic';
@@ -130,6 +130,19 @@ export declare class SpriteSheet {
130
130
  * @param options
131
131
  */
132
132
  getTiledSprite(x: number, y: number, options?: Partial<Omit<TiledSpriteOptions & GraphicOptions, 'image'>>): TiledSprite;
133
+ /**
134
+ * Returns a sprite that has a new backing image the exact size of the sprite that tha is a copy of the original sprite slice.
135
+ *
136
+ * Useful if you need to apply effects, manipulate, or mutate the image and you don't want to disturb the original sprite sheet.
137
+ *
138
+ */
139
+ getSpriteAsStandalone(x: number, y: number): Promise<Sprite>;
140
+ /**
141
+ * Returns a new image exact size and copy of the original sprite slice.
142
+ *
143
+ * Useful if you need to apply effects, manipulate, or mutate the image and you don't want to disturb the original sprite sheet.
144
+ */
145
+ getSpriteAsImage(x: number, y: number): Promise<HTMLImageElement>;
133
146
  /**
134
147
  * Create a sprite sheet from a sparse set of {@apilink SourceView} rectangles
135
148
  * @param options
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1590+1be15c8 - 2025-12-3
1
+ /*! excalibur - 0.32.0-alpha.1592+3ba41a7 - 2025-12-6
2
2
  https://github.com/excaliburjs/Excalibur
3
3
  Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
4
4
  Licensed BSD-2-Clause
@@ -11212,6 +11212,104 @@ Read more here: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL
11212
11212
  }
11213
11213
  throw Error(`Invalid sprite coordinates (${x}, ${y})`);
11214
11214
  }
11215
+ /**
11216
+ * Returns a sprite that has a new backing image the exact size of the sprite that tha is a copy of the original sprite slice.
11217
+ *
11218
+ * Useful if you need to apply effects, manipulate, or mutate the image and you don't want to disturb the original sprite sheet.
11219
+ *
11220
+ */
11221
+ async getSpriteAsStandalone(x, y) {
11222
+ if (x >= this.columns || x < 0) {
11223
+ throw Error(`No sprite exists in the SpriteSheet at (${x}, ${y}), x: ${x} should be between 0 and ${this.columns - 1} columns`);
11224
+ }
11225
+ if (y >= this.rows || y < 0) {
11226
+ throw Error(`No sprite exists in the SpriteSheet at (${x}, ${y}), y: ${y} should be between 0 and ${this.rows - 1} rows`);
11227
+ }
11228
+ const spriteIndex = x + y * this.columns;
11229
+ const sprite = this.sprites[spriteIndex];
11230
+ const cnv = document.createElement("canvas");
11231
+ const ctx = cnv.getContext("2d");
11232
+ cnv.width = sprite.width;
11233
+ cnv.height = sprite.height;
11234
+ if (!sprite) {
11235
+ throw Error(`Invalid sprite coordinates (${x}, ${y})`);
11236
+ }
11237
+ if (!ctx) {
11238
+ throw Error("Unable to create canvas context");
11239
+ }
11240
+ ctx.drawImage(
11241
+ sprite.image.image,
11242
+ sprite.sourceView.x,
11243
+ sprite.sourceView.y,
11244
+ sprite.sourceView.width,
11245
+ sprite.sourceView.height,
11246
+ 0,
11247
+ 0,
11248
+ sprite.sourceView.width,
11249
+ sprite.sourceView.height
11250
+ );
11251
+ const imgSrc = new ImageSource(cnv.toDataURL());
11252
+ await imgSrc.load();
11253
+ return new Sprite({
11254
+ image: imgSrc,
11255
+ sourceView: {
11256
+ x: 0,
11257
+ y: 0,
11258
+ width: sprite.width,
11259
+ height: sprite.height
11260
+ },
11261
+ destSize: {
11262
+ width: sprite.width,
11263
+ height: sprite.height
11264
+ }
11265
+ });
11266
+ }
11267
+ /**
11268
+ * Returns a new image exact size and copy of the original sprite slice.
11269
+ *
11270
+ * Useful if you need to apply effects, manipulate, or mutate the image and you don't want to disturb the original sprite sheet.
11271
+ */
11272
+ async getSpriteAsImage(x, y) {
11273
+ if (x >= this.columns || x < 0) {
11274
+ throw Error(`No sprite exists in the SpriteSheet at (${x}, ${y}), x: ${x} should be between 0 and ${this.columns - 1} columns`);
11275
+ }
11276
+ if (y >= this.rows || y < 0) {
11277
+ throw Error(`No sprite exists in the SpriteSheet at (${x}, ${y}), y: ${y} should be between 0 and ${this.rows - 1} rows`);
11278
+ }
11279
+ const spriteIndex = x + y * this.columns;
11280
+ const sprite = this.sprites[spriteIndex];
11281
+ const cnv = document.createElement("canvas");
11282
+ const ctx = cnv.getContext("2d");
11283
+ cnv.width = sprite.width;
11284
+ cnv.height = sprite.height;
11285
+ if (!sprite) {
11286
+ throw Error(`Invalid sprite coordinates (${x}, ${y})`);
11287
+ }
11288
+ if (!ctx) {
11289
+ throw Error("Unable to create canvas context");
11290
+ }
11291
+ ctx.drawImage(
11292
+ sprite.image.image,
11293
+ sprite.sourceView.x,
11294
+ sprite.sourceView.y,
11295
+ sprite.sourceView.width,
11296
+ sprite.sourceView.height,
11297
+ 0,
11298
+ 0,
11299
+ sprite.sourceView.width,
11300
+ sprite.sourceView.height
11301
+ );
11302
+ const imgSrc = new Image(sprite.width, sprite.height);
11303
+ imgSrc.src = cnv.toDataURL();
11304
+ return await new Promise((resolve, reject) => {
11305
+ imgSrc.onload = () => {
11306
+ resolve(imgSrc);
11307
+ };
11308
+ imgSrc.onerror = (e) => {
11309
+ reject(e);
11310
+ };
11311
+ });
11312
+ }
11215
11313
  /**
11216
11314
  * Create a sprite sheet from a sparse set of {@apilink SourceView} rectangles
11217
11315
  * @param options
@@ -24691,7 +24789,7 @@ If you want to do custom drawing, use Actor.graphics, or any onPreDraw or onPost
24691
24789
  this.pointer.useGraphicsBounds = true;
24692
24790
  this.pointer.useColliderShape = false;
24693
24791
  if (!(config == null ? void 0 : config.collider) && (config == null ? void 0 : config.width) > 0 && (config == null ? void 0 : config.height) > 0) {
24694
- this.collider.useBoxCollider(this.width, this.height, this.anchor);
24792
+ this.collider.useBoxCollider(config.width, config.height, this.anchor);
24695
24793
  }
24696
24794
  }
24697
24795
  _initialize(engine) {
@@ -33472,7 +33570,7 @@ Read more about this issue at https://excaliburjs.com/docs/performance`
33472
33570
  this._count += count;
33473
33571
  }
33474
33572
  }
33475
- const EX_VERSION = "0.32.0-alpha.1590+1be15c8";
33573
+ const EX_VERSION = "0.32.0-alpha.1592+3ba41a7";
33476
33574
  polyfill();
33477
33575
  exports2.ActionCompleteEvent = ActionCompleteEvent;
33478
33576
  exports2.ActionContext = ActionContext;
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1590+1be15c8 - 2025-12-3
1
+ /*! excalibur - 0.32.0-alpha.1592+3ba41a7 - 2025-12-6
2
2
  https://github.com/excaliburjs/Excalibur
3
3
  Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
4
4
  Licensed BSD-2-Clause
@@ -11212,6 +11212,104 @@ Read more here: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL
11212
11212
  }
11213
11213
  throw Error(`Invalid sprite coordinates (${x}, ${y})`);
11214
11214
  }
11215
+ /**
11216
+ * Returns a sprite that has a new backing image the exact size of the sprite that tha is a copy of the original sprite slice.
11217
+ *
11218
+ * Useful if you need to apply effects, manipulate, or mutate the image and you don't want to disturb the original sprite sheet.
11219
+ *
11220
+ */
11221
+ async getSpriteAsStandalone(x, y) {
11222
+ if (x >= this.columns || x < 0) {
11223
+ throw Error(`No sprite exists in the SpriteSheet at (${x}, ${y}), x: ${x} should be between 0 and ${this.columns - 1} columns`);
11224
+ }
11225
+ if (y >= this.rows || y < 0) {
11226
+ throw Error(`No sprite exists in the SpriteSheet at (${x}, ${y}), y: ${y} should be between 0 and ${this.rows - 1} rows`);
11227
+ }
11228
+ const spriteIndex = x + y * this.columns;
11229
+ const sprite = this.sprites[spriteIndex];
11230
+ const cnv = document.createElement("canvas");
11231
+ const ctx = cnv.getContext("2d");
11232
+ cnv.width = sprite.width;
11233
+ cnv.height = sprite.height;
11234
+ if (!sprite) {
11235
+ throw Error(`Invalid sprite coordinates (${x}, ${y})`);
11236
+ }
11237
+ if (!ctx) {
11238
+ throw Error("Unable to create canvas context");
11239
+ }
11240
+ ctx.drawImage(
11241
+ sprite.image.image,
11242
+ sprite.sourceView.x,
11243
+ sprite.sourceView.y,
11244
+ sprite.sourceView.width,
11245
+ sprite.sourceView.height,
11246
+ 0,
11247
+ 0,
11248
+ sprite.sourceView.width,
11249
+ sprite.sourceView.height
11250
+ );
11251
+ const imgSrc = new ImageSource(cnv.toDataURL());
11252
+ await imgSrc.load();
11253
+ return new Sprite({
11254
+ image: imgSrc,
11255
+ sourceView: {
11256
+ x: 0,
11257
+ y: 0,
11258
+ width: sprite.width,
11259
+ height: sprite.height
11260
+ },
11261
+ destSize: {
11262
+ width: sprite.width,
11263
+ height: sprite.height
11264
+ }
11265
+ });
11266
+ }
11267
+ /**
11268
+ * Returns a new image exact size and copy of the original sprite slice.
11269
+ *
11270
+ * Useful if you need to apply effects, manipulate, or mutate the image and you don't want to disturb the original sprite sheet.
11271
+ */
11272
+ async getSpriteAsImage(x, y) {
11273
+ if (x >= this.columns || x < 0) {
11274
+ throw Error(`No sprite exists in the SpriteSheet at (${x}, ${y}), x: ${x} should be between 0 and ${this.columns - 1} columns`);
11275
+ }
11276
+ if (y >= this.rows || y < 0) {
11277
+ throw Error(`No sprite exists in the SpriteSheet at (${x}, ${y}), y: ${y} should be between 0 and ${this.rows - 1} rows`);
11278
+ }
11279
+ const spriteIndex = x + y * this.columns;
11280
+ const sprite = this.sprites[spriteIndex];
11281
+ const cnv = document.createElement("canvas");
11282
+ const ctx = cnv.getContext("2d");
11283
+ cnv.width = sprite.width;
11284
+ cnv.height = sprite.height;
11285
+ if (!sprite) {
11286
+ throw Error(`Invalid sprite coordinates (${x}, ${y})`);
11287
+ }
11288
+ if (!ctx) {
11289
+ throw Error("Unable to create canvas context");
11290
+ }
11291
+ ctx.drawImage(
11292
+ sprite.image.image,
11293
+ sprite.sourceView.x,
11294
+ sprite.sourceView.y,
11295
+ sprite.sourceView.width,
11296
+ sprite.sourceView.height,
11297
+ 0,
11298
+ 0,
11299
+ sprite.sourceView.width,
11300
+ sprite.sourceView.height
11301
+ );
11302
+ const imgSrc = new Image(sprite.width, sprite.height);
11303
+ imgSrc.src = cnv.toDataURL();
11304
+ return await new Promise((resolve, reject) => {
11305
+ imgSrc.onload = () => {
11306
+ resolve(imgSrc);
11307
+ };
11308
+ imgSrc.onerror = (e) => {
11309
+ reject(e);
11310
+ };
11311
+ });
11312
+ }
11215
11313
  /**
11216
11314
  * Create a sprite sheet from a sparse set of {@apilink SourceView} rectangles
11217
11315
  * @param options
@@ -24691,7 +24789,7 @@ If you want to do custom drawing, use Actor.graphics, or any onPreDraw or onPost
24691
24789
  this.pointer.useGraphicsBounds = true;
24692
24790
  this.pointer.useColliderShape = false;
24693
24791
  if (!(config == null ? void 0 : config.collider) && (config == null ? void 0 : config.width) > 0 && (config == null ? void 0 : config.height) > 0) {
24694
- this.collider.useBoxCollider(this.width, this.height, this.anchor);
24792
+ this.collider.useBoxCollider(config.width, config.height, this.anchor);
24695
24793
  }
24696
24794
  }
24697
24795
  _initialize(engine) {
@@ -33472,7 +33570,7 @@ Read more about this issue at https://excaliburjs.com/docs/performance`
33472
33570
  this._count += count;
33473
33571
  }
33474
33572
  }
33475
- const EX_VERSION = "0.32.0-alpha.1590+1be15c8";
33573
+ const EX_VERSION = "0.32.0-alpha.1592+3ba41a7";
33476
33574
  polyfill();
33477
33575
  exports2.ActionCompleteEvent = ActionCompleteEvent;
33478
33576
  exports2.ActionContext = ActionContext;