angry-pixel 2.3.3 → 2.3.4
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/lib/index.cjs.js +1 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +79 -38
- package/lib/index.esm.js +1 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -3490,7 +3490,6 @@ interface TilemapRenderData extends RenderData {
|
|
|
3490
3490
|
tiles: number[];
|
|
3491
3491
|
tilemap: Tilemap;
|
|
3492
3492
|
tileset: Tileset$1;
|
|
3493
|
-
tileAnimations?: Map<number, number>;
|
|
3494
3493
|
smooth?: boolean;
|
|
3495
3494
|
flipHorizontal?: boolean;
|
|
3496
3495
|
flipVertical?: boolean;
|
|
@@ -3503,12 +3502,30 @@ interface TilemapRenderData extends RenderData {
|
|
|
3503
3502
|
}
|
|
3504
3503
|
type Tileset$1 = {
|
|
3505
3504
|
image: HTMLImageElement;
|
|
3506
|
-
width: number;
|
|
3507
3505
|
tileWidth: number;
|
|
3508
3506
|
tileHeight: number;
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3507
|
+
/** Space in pixels between the tiles and the four edges of the image */
|
|
3508
|
+
margin?: number;
|
|
3509
|
+
/** Space in pixels between adjacent tiles */
|
|
3510
|
+
spacing?: number;
|
|
3511
|
+
/** Maps each animated tile id to the tile id currently displayed. @internal */
|
|
3512
|
+
_animationState?: Map<number, number>;
|
|
3513
|
+
/** Tileset values in texture coordinates. Computed once by the renderer. @internal */
|
|
3514
|
+
_texData?: TilesetTexData;
|
|
3515
|
+
};
|
|
3516
|
+
/**
|
|
3517
|
+
* Tileset values expressed in texture coordinates (0 to 1), plus the number of columns of the tileset.
|
|
3518
|
+
* @internal
|
|
3519
|
+
*/
|
|
3520
|
+
type TilesetTexData = {
|
|
3521
|
+
/** The width of the tileset (in tiles) */
|
|
3522
|
+
columns: number;
|
|
3523
|
+
/** The margin of the image */
|
|
3524
|
+
margin: Vector2;
|
|
3525
|
+
/** The distance between the origin of two adjacent tiles */
|
|
3526
|
+
step: Vector2;
|
|
3527
|
+
/** The size of a tile */
|
|
3528
|
+
tileSize: Vector2;
|
|
3512
3529
|
};
|
|
3513
3530
|
type Tilemap = {
|
|
3514
3531
|
width: number;
|
|
@@ -4111,7 +4128,7 @@ declare const defaultTextureAtlasOptions: {
|
|
|
4111
4128
|
* opacity: 0.5,
|
|
4112
4129
|
* },
|
|
4113
4130
|
* textureAtlas: {
|
|
4114
|
-
* charRanges: [32,
|
|
4131
|
+
* charRanges: [32, 132, 161, 255, 0x3040, 0x309f],
|
|
4115
4132
|
* fontSize: 64,
|
|
4116
4133
|
* spacing: 4,
|
|
4117
4134
|
* },
|
|
@@ -4166,9 +4183,15 @@ interface TextRendererOptions {
|
|
|
4166
4183
|
text: string;
|
|
4167
4184
|
/** The texture atlas configuration */
|
|
4168
4185
|
textureAtlas: {
|
|
4169
|
-
/**
|
|
4170
|
-
*
|
|
4171
|
-
*
|
|
4186
|
+
/** Ranges of characters covered by the component, defined as pairs of
|
|
4187
|
+
* Unicode code points (each pair is an inclusive from–to range).
|
|
4188
|
+
* The default value is [32, 132, 161, 255], which covers Basic Latin
|
|
4189
|
+
* (letters, digits and punctuation) and the Latin-1 Supplement
|
|
4190
|
+
* (accented letters and symbols used by Western European languages).
|
|
4191
|
+
* Additional pairs can be appended to render other alphabets, e.g.
|
|
4192
|
+
* [0x3040, 0x309F] for Japanese Hiragana or [0x0400, 0x04FF] for Cyrillic.
|
|
4193
|
+
* See the official Unicode Character Code Charts to find the range of
|
|
4194
|
+
* each alphabet: {@link https://www.unicode.org/charts/} */
|
|
4172
4195
|
charRanges?: number[];
|
|
4173
4196
|
/** The size of the font in pixels for bitmap fonts. */
|
|
4174
4197
|
fontSize?: number;
|
|
@@ -4219,7 +4242,7 @@ interface TextRendererOptions {
|
|
|
4219
4242
|
* opacity: 0.5,
|
|
4220
4243
|
* },
|
|
4221
4244
|
* textureAtlas: {
|
|
4222
|
-
* charRanges: [32,
|
|
4245
|
+
* charRanges: [32, 132, 161, 255, 0x3040, 0x309f],
|
|
4223
4246
|
* fontSize: 64,
|
|
4224
4247
|
* spacing: 4,
|
|
4225
4248
|
* },
|
|
@@ -4276,9 +4299,15 @@ declare class TextRenderer {
|
|
|
4276
4299
|
text: string;
|
|
4277
4300
|
/** The texture atlas configuration */
|
|
4278
4301
|
textureAtlas: {
|
|
4279
|
-
/**
|
|
4280
|
-
*
|
|
4281
|
-
*
|
|
4302
|
+
/** Ranges of characters covered by the component, defined as pairs of
|
|
4303
|
+
* Unicode code points (each pair is an inclusive from–to range).
|
|
4304
|
+
* The default value is [32, 132, 161, 255], which covers Basic Latin
|
|
4305
|
+
* (letters, digits and punctuation) and the Latin-1 Supplement
|
|
4306
|
+
* (accented letters and symbols used by Western European languages).
|
|
4307
|
+
* Additional pairs can be appended to render other alphabets, e.g.
|
|
4308
|
+
* [0x3040, 0x309F] for Japanese Hiragana or [0x0400, 0x04FF] for Cyrillic.
|
|
4309
|
+
* See the official Unicode Character Code Charts to find the range of
|
|
4310
|
+
* each alphabet: {@link https://www.unicode.org/charts/} */
|
|
4282
4311
|
charRanges?: number[];
|
|
4283
4312
|
/** The size of the font in pixels for bitmap fonts. */
|
|
4284
4313
|
fontSize?: number;
|
|
@@ -4304,11 +4333,10 @@ declare class TextRenderer {
|
|
|
4304
4333
|
* layer: "Default",
|
|
4305
4334
|
* tileset: {
|
|
4306
4335
|
* image: this.assetManager.getImage("tileset.png"),
|
|
4307
|
-
* width: 10,
|
|
4308
4336
|
* tileWidth: 32,
|
|
4309
4337
|
* tileHeight: 32,
|
|
4310
|
-
* margin:
|
|
4311
|
-
* spacing:
|
|
4338
|
+
* margin: 0,
|
|
4339
|
+
* spacing: 0
|
|
4312
4340
|
* },
|
|
4313
4341
|
* data: [1, 2, 3, 4],
|
|
4314
4342
|
* chunks: [],
|
|
@@ -4338,7 +4366,6 @@ interface TilemapRendererOptions {
|
|
|
4338
4366
|
maskColorMix: number;
|
|
4339
4367
|
opacity: number;
|
|
4340
4368
|
smooth: boolean;
|
|
4341
|
-
animations: Map<number, TileAnimation>;
|
|
4342
4369
|
}
|
|
4343
4370
|
/**
|
|
4344
4371
|
* The TilemapRenderer component renders 2D tile-based maps to the screen.\
|
|
@@ -4354,11 +4381,10 @@ interface TilemapRendererOptions {
|
|
|
4354
4381
|
* layer: "Default",
|
|
4355
4382
|
* tileset: {
|
|
4356
4383
|
* image: this.assetManager.getImage("tileset.png"),
|
|
4357
|
-
* width: 10,
|
|
4358
4384
|
* tileWidth: 32,
|
|
4359
4385
|
* tileHeight: 32,
|
|
4360
|
-
* margin:
|
|
4361
|
-
* spacing:
|
|
4386
|
+
* margin: 0,
|
|
4387
|
+
* spacing: 0
|
|
4362
4388
|
* },
|
|
4363
4389
|
* data: [1, 2, 3, 4],
|
|
4364
4390
|
* chunks: [],
|
|
@@ -4401,14 +4427,10 @@ declare class TilemapRenderer {
|
|
|
4401
4427
|
maskColorMix: number;
|
|
4402
4428
|
/** TRUE for smooth pixels (not recommended for pixel art) */
|
|
4403
4429
|
smooth: boolean;
|
|
4404
|
-
/** Animated tiles, keyed by the tile id to animate. */
|
|
4405
|
-
animations: Map<number, TileAnimation>;
|
|
4406
4430
|
/** @internal */
|
|
4407
4431
|
_processed: boolean;
|
|
4408
4432
|
/** @internal */
|
|
4409
4433
|
_renderData: TilemapRenderData[];
|
|
4410
|
-
/** Maps each animated tile id to the tile id currently displayed. @internal */
|
|
4411
|
-
_tileAnimationState: Map<number, number>;
|
|
4412
4434
|
/** @internal */
|
|
4413
4435
|
static componentName: string;
|
|
4414
4436
|
constructor(options?: Partial<TilemapRendererOptions>);
|
|
@@ -4431,18 +4453,23 @@ interface TileAnimationOptions {
|
|
|
4431
4453
|
}
|
|
4432
4454
|
/**
|
|
4433
4455
|
* TileAnimation cycles a tile through a sequence of tile ids from the tileset.\
|
|
4434
|
-
* It is assigned to a {@link
|
|
4456
|
+
* It is assigned to a {@link Tileset} keyed by the tile id that should animate,\
|
|
4457
|
+
* so every tilemap using that tileset plays the animation in sync.
|
|
4435
4458
|
* @public
|
|
4436
4459
|
* @category Components Configuration
|
|
4437
4460
|
* @example
|
|
4438
4461
|
* ```js
|
|
4439
4462
|
* const tilemapRenderer = new TilemapRenderer({
|
|
4440
|
-
* tileset: {
|
|
4463
|
+
* tileset: {
|
|
4464
|
+
* image: "tileset.png",
|
|
4465
|
+
* tileWidth: 32,
|
|
4466
|
+
* tileHeight: 32,
|
|
4467
|
+
* animations: new Map([
|
|
4468
|
+
* [3, new TileAnimation({ tiles: [3, 4, 5], fps: 6 })]
|
|
4469
|
+
* ])
|
|
4470
|
+
* },
|
|
4441
4471
|
* data: [1, 2, 3, 4],
|
|
4442
|
-
* width: 2
|
|
4443
|
-
* animations: new Map([
|
|
4444
|
-
* [3, new TileAnimation({ tiles: [3, 4, 5], fps: 6 })]
|
|
4445
|
-
* ])
|
|
4472
|
+
* width: 2
|
|
4446
4473
|
* });
|
|
4447
4474
|
* ```
|
|
4448
4475
|
*/
|
|
@@ -4459,22 +4486,36 @@ declare class TileAnimation {
|
|
|
4459
4486
|
}
|
|
4460
4487
|
/**
|
|
4461
4488
|
* The Tileset configuration defines the properties of a tileset used by the TilemapRenderer.\
|
|
4462
|
-
* It specifies the source image containing the tiles, the
|
|
4463
|
-
* and optional margin and spacing
|
|
4464
|
-
*
|
|
4489
|
+
* It specifies the source image containing the tiles, the size of the individual tiles,\
|
|
4490
|
+
* and the optional margin and spacing of the image. The number of columns of the tileset\
|
|
4491
|
+
* is obtained from the image. The tileset cannot be updated at runtime.
|
|
4465
4492
|
* @public
|
|
4466
4493
|
* @category Components Configuration
|
|
4494
|
+
* @example
|
|
4495
|
+
* ```js
|
|
4496
|
+
* // a tileset of 16x16 tiles extruded by 1 pixel
|
|
4497
|
+
* const tileset = {
|
|
4498
|
+
* image: this.assetManager.getImage("tileset.png"),
|
|
4499
|
+
* tileWidth: 16,
|
|
4500
|
+
* tileHeight: 16,
|
|
4501
|
+
* margin: 1,
|
|
4502
|
+
* spacing: 2
|
|
4503
|
+
* };
|
|
4504
|
+
* ```
|
|
4467
4505
|
*/
|
|
4468
4506
|
type Tileset = {
|
|
4469
4507
|
/** The tileset image element */
|
|
4470
4508
|
image: HTMLImageElement | string;
|
|
4471
|
-
width: number;
|
|
4472
4509
|
tileWidth: number;
|
|
4473
4510
|
tileHeight: number;
|
|
4474
|
-
/**
|
|
4475
|
-
margin?:
|
|
4476
|
-
/**
|
|
4477
|
-
spacing?:
|
|
4511
|
+
/** Space in pixels between the tiles and the four edges of the image */
|
|
4512
|
+
margin?: number;
|
|
4513
|
+
/** Space in pixels between adjacent tiles */
|
|
4514
|
+
spacing?: number;
|
|
4515
|
+
/** Animated tiles, keyed by the tile id to animate */
|
|
4516
|
+
animations?: Map<number, TileAnimation>;
|
|
4517
|
+
/** Maps each animated tile id to the tile id currently displayed. @internal */
|
|
4518
|
+
_animationState?: Map<number, number>;
|
|
4478
4519
|
};
|
|
4479
4520
|
/**
|
|
4480
4521
|
* Chunk of tile data
|