excalibur 0.32.0-alpha.1591 → 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/build/dist/Graphics/SpriteSheet.d.ts +14 -1
- package/build/dist/excalibur.development.js +100 -2
- package/build/dist/excalibur.js +100 -2
- package/build/dist/excalibur.min.development.js +41 -41
- package/build/dist/excalibur.min.js +41 -41
- package/build/esm/excalibur.development.js +100 -2
- package/build/esm/excalibur.js +100 -2
- package/build/esm/excalibur.min.development.js +384 -307
- package/build/esm/excalibur.min.js +384 -307
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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.
|
|
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
|
|
@@ -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.
|
|
33573
|
+
const EX_VERSION = "0.32.0-alpha.1592+3ba41a7";
|
|
33476
33574
|
polyfill();
|
|
33477
33575
|
exports2.ActionCompleteEvent = ActionCompleteEvent;
|
|
33478
33576
|
exports2.ActionContext = ActionContext;
|
package/build/dist/excalibur.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! excalibur - 0.32.0-alpha.
|
|
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
|
|
@@ -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.
|
|
33573
|
+
const EX_VERSION = "0.32.0-alpha.1592+3ba41a7";
|
|
33476
33574
|
polyfill();
|
|
33477
33575
|
exports2.ActionCompleteEvent = ActionCompleteEvent;
|
|
33478
33576
|
exports2.ActionContext = ActionContext;
|