angry-pixel 2.0.17 → 2.0.19
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 +140 -6
- 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
|
@@ -55,7 +55,7 @@ declare function injectable(name: DependencyName): (target: DependencyType) => v
|
|
|
55
55
|
* }
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
declare function inject(name: DependencyName): (target: any, propertyKey
|
|
58
|
+
declare function inject(name: DependencyName): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Represents a 2D vector and provides static methods for vector calculations.
|
|
@@ -245,8 +245,57 @@ declare class Vector2 {
|
|
|
245
245
|
* v2.x // 4
|
|
246
246
|
* v2.y // 2
|
|
247
247
|
* ```
|
|
248
|
+
* @example
|
|
249
|
+
* ```js
|
|
250
|
+
* const v1 = new Vector2(3.9, 2.2);
|
|
251
|
+
* Vector2.round(v1, v1);
|
|
252
|
+
* v1.x // 4
|
|
253
|
+
* v1.y // 2
|
|
254
|
+
* ```
|
|
248
255
|
*/
|
|
249
256
|
static round(out: Vector2, a: Vector2): Vector2;
|
|
257
|
+
/**
|
|
258
|
+
* Floors a vector
|
|
259
|
+
*
|
|
260
|
+
* @param a The vector to floor
|
|
261
|
+
* @returns The output vector
|
|
262
|
+
* @example
|
|
263
|
+
* ```js
|
|
264
|
+
* const v1 = new Vector2(3.9, 2.2);
|
|
265
|
+
* const v2 = Vector2.floor(new Vector2(), v1);
|
|
266
|
+
* v2.x // 3
|
|
267
|
+
* v2.y // 2
|
|
268
|
+
* ```
|
|
269
|
+
* @example
|
|
270
|
+
* ```js
|
|
271
|
+
* const v1 = new Vector2(3.9, 2.2);
|
|
272
|
+
* Vector2.floor(v1, v1);
|
|
273
|
+
* v1.x // 3
|
|
274
|
+
* v1.y // 2
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
static floor(out: Vector2, a: Vector2): Vector2;
|
|
278
|
+
/**
|
|
279
|
+
* Ceils a vector
|
|
280
|
+
*
|
|
281
|
+
* @param a The vector to ceil
|
|
282
|
+
* @returns The output vector
|
|
283
|
+
* @example
|
|
284
|
+
* ```js
|
|
285
|
+
* const v1 = new Vector2(3.9, 2.2);
|
|
286
|
+
* const v2 = Vector2.ceil(new Vector2(), v1);
|
|
287
|
+
* v2.x // 4
|
|
288
|
+
* v2.y // 3
|
|
289
|
+
* ```
|
|
290
|
+
* @example
|
|
291
|
+
* ```js
|
|
292
|
+
* const v1 = new Vector2(3.9, 2.2);
|
|
293
|
+
* Vector2.ceil(v1, v1);
|
|
294
|
+
* v1.x // 4
|
|
295
|
+
* v1.y // 3
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
static ceil(out: Vector2, a: Vector2): Vector2;
|
|
250
299
|
toString(): string;
|
|
251
300
|
}
|
|
252
301
|
|
|
@@ -372,6 +421,20 @@ declare const range: (start: number, end: number, steps?: number) => number[];
|
|
|
372
421
|
* @returns true if the number is between the min and the max, false instead
|
|
373
422
|
*/
|
|
374
423
|
declare const between: (value: number, min: number, max: number) => boolean;
|
|
424
|
+
/**
|
|
425
|
+
* Converts the given radians to degrees.
|
|
426
|
+
* @param radians
|
|
427
|
+
* @returns degrees
|
|
428
|
+
*/
|
|
429
|
+
declare const radiansToDegrees: (radians: number) => number;
|
|
430
|
+
/**
|
|
431
|
+
* Converts the given degrees to radians.
|
|
432
|
+
* @param degrees
|
|
433
|
+
* @returns radians
|
|
434
|
+
* @category Math
|
|
435
|
+
* @public
|
|
436
|
+
*/
|
|
437
|
+
declare const degreesToRadians: (degrees: number) => number;
|
|
375
438
|
|
|
376
439
|
/** @internal */
|
|
377
440
|
interface Shape {
|
|
@@ -1117,7 +1180,11 @@ interface GameConfig {
|
|
|
1117
1180
|
height: number;
|
|
1118
1181
|
/** Enables the debug mode */
|
|
1119
1182
|
debugEnabled?: boolean;
|
|
1120
|
-
/**
|
|
1183
|
+
/** Color of debug elements, default "#00FF00" (green) */
|
|
1184
|
+
debugColor?: string;
|
|
1185
|
+
/** Position of debug text, default "bottom-left" */
|
|
1186
|
+
debugTextPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
1187
|
+
/** Background color of canvas, default "#000000" (black) */
|
|
1121
1188
|
canvasColor?: string;
|
|
1122
1189
|
/** Framerate for physics execution. The allowed values are 60, 120, 180, 240.
|
|
1123
1190
|
* The higher the framerate, the more accurate the physics will be, but it will consume more processor resources.
|
|
@@ -1178,15 +1245,17 @@ declare class AssetManager {
|
|
|
1178
1245
|
/**
|
|
1179
1246
|
* Loads an image asset
|
|
1180
1247
|
* @param url The asset URL
|
|
1248
|
+
* @param name The asset name [optional]
|
|
1181
1249
|
* @returns The HTML Image element created
|
|
1182
1250
|
*/
|
|
1183
|
-
loadImage(url: string): HTMLImageElement;
|
|
1251
|
+
loadImage(url: string, name?: string): HTMLImageElement;
|
|
1184
1252
|
/**
|
|
1185
1253
|
* Loads an audio asset
|
|
1186
1254
|
* @param url The asset URL
|
|
1255
|
+
* @param name The asset name [optional]
|
|
1187
1256
|
* @returns The HTML Audio element created
|
|
1188
1257
|
*/
|
|
1189
|
-
loadAudio(url: string): HTMLAudioElement;
|
|
1258
|
+
loadAudio(url: string, name?: string): HTMLAudioElement;
|
|
1190
1259
|
/**
|
|
1191
1260
|
* Loads a font asset
|
|
1192
1261
|
* @param family The font family name
|
|
@@ -1197,21 +1266,34 @@ declare class AssetManager {
|
|
|
1197
1266
|
/**
|
|
1198
1267
|
* Loads an video asset
|
|
1199
1268
|
* @param url The asset URL
|
|
1269
|
+
* @param name The asset name [optional]
|
|
1200
1270
|
* @returns The HTML Video element created
|
|
1201
1271
|
*/
|
|
1202
|
-
loadVideo(url: string): HTMLVideoElement;
|
|
1272
|
+
loadVideo(url: string, name?: string): HTMLVideoElement;
|
|
1203
1273
|
/**
|
|
1204
1274
|
* Retrieves an image asset
|
|
1205
1275
|
* @param url The asset URL
|
|
1206
1276
|
* @returns The HTML Image element
|
|
1207
1277
|
*/
|
|
1208
1278
|
getImage(url: string): HTMLImageElement;
|
|
1279
|
+
/**
|
|
1280
|
+
* Retrieves an image asset
|
|
1281
|
+
* @param name The asset name
|
|
1282
|
+
* @returns The HTML Image element
|
|
1283
|
+
*/
|
|
1284
|
+
getImage(name: string): HTMLImageElement;
|
|
1209
1285
|
/**
|
|
1210
1286
|
* Retrieves an audio asset
|
|
1211
1287
|
* @param url The asset URL
|
|
1212
1288
|
* @returns The HTML Audio element
|
|
1213
1289
|
*/
|
|
1214
1290
|
getAudio(url: string): HTMLAudioElement;
|
|
1291
|
+
/**
|
|
1292
|
+
* Retrieves an audio asset
|
|
1293
|
+
* @param name The asset name
|
|
1294
|
+
* @returns The HTML Audio element
|
|
1295
|
+
*/
|
|
1296
|
+
getAudio(name: string): HTMLAudioElement;
|
|
1215
1297
|
/**
|
|
1216
1298
|
* Retrieves a font asset
|
|
1217
1299
|
* @param family The font family name
|
|
@@ -1224,6 +1306,12 @@ declare class AssetManager {
|
|
|
1224
1306
|
* @returns The HTML Video element
|
|
1225
1307
|
*/
|
|
1226
1308
|
getVideo(url: string): HTMLVideoElement;
|
|
1309
|
+
/**
|
|
1310
|
+
* Retrieves a video asset
|
|
1311
|
+
* @param name The asset name
|
|
1312
|
+
* @returns The HTML Video element
|
|
1313
|
+
*/
|
|
1314
|
+
getVideo(name: string): HTMLVideoElement;
|
|
1227
1315
|
private createAsset;
|
|
1228
1316
|
}
|
|
1229
1317
|
|
|
@@ -2485,6 +2573,11 @@ interface VideoRenderData extends RenderData {
|
|
|
2485
2573
|
* @category Components
|
|
2486
2574
|
*/
|
|
2487
2575
|
declare const defaultRenderLayer = "Default";
|
|
2576
|
+
/**
|
|
2577
|
+
* Debug render layer
|
|
2578
|
+
* @internal
|
|
2579
|
+
*/
|
|
2580
|
+
declare const debugRenderLayer = "Debug";
|
|
2488
2581
|
/**
|
|
2489
2582
|
* @public
|
|
2490
2583
|
* @category Components
|
|
@@ -2493,6 +2586,7 @@ interface CameraOptions {
|
|
|
2493
2586
|
layers: string[];
|
|
2494
2587
|
zoom: number;
|
|
2495
2588
|
depth: number;
|
|
2589
|
+
debug: boolean;
|
|
2496
2590
|
}
|
|
2497
2591
|
/**
|
|
2498
2592
|
* @public
|
|
@@ -2505,6 +2599,8 @@ declare class Camera {
|
|
|
2505
2599
|
zoom: number;
|
|
2506
2600
|
/** In case you have more than one camera, the depth value determines which camera is rendered first. The lesser value, the first to render */
|
|
2507
2601
|
depth: number;
|
|
2602
|
+
/** Set to TRUE to allow this camera to render debug data (default FALSE) */
|
|
2603
|
+
debug: boolean;
|
|
2508
2604
|
/** @internal */
|
|
2509
2605
|
_renderData: CameraData;
|
|
2510
2606
|
constructor(options?: Partial<CameraOptions>);
|
|
@@ -2730,6 +2826,14 @@ declare class SpriteRenderer {
|
|
|
2730
2826
|
constructor(options?: Partial<SpriteRendererOptions>);
|
|
2731
2827
|
}
|
|
2732
2828
|
|
|
2829
|
+
/**
|
|
2830
|
+
* @internal
|
|
2831
|
+
*/
|
|
2832
|
+
declare const defaultTextureAtlasOptions: {
|
|
2833
|
+
charRanges: number[];
|
|
2834
|
+
fontSize: number;
|
|
2835
|
+
spacing: number;
|
|
2836
|
+
};
|
|
2733
2837
|
/**
|
|
2734
2838
|
* @public
|
|
2735
2839
|
* @category Components
|
|
@@ -3481,6 +3585,36 @@ declare function gamePhysicsSystem(): (target: SystemType) => void;
|
|
|
3481
3585
|
*/
|
|
3482
3586
|
declare function gamePreRenderSystem(): (target: SystemType) => void;
|
|
3483
3587
|
|
|
3588
|
+
/**
|
|
3589
|
+
* Applies a decorator manually.
|
|
3590
|
+
* @param decorator The decorator function to be applied.
|
|
3591
|
+
* @param target The target to which the decorator is applied (class, prototype, or constructor argument).
|
|
3592
|
+
* @param propertyKey The property name or constructor argument index (optional).
|
|
3593
|
+
* @public
|
|
3594
|
+
* @category Decorators
|
|
3595
|
+
* @example
|
|
3596
|
+
* ```javascript
|
|
3597
|
+
* decorate(injectable("SomeDependency"), SomeDependency);
|
|
3598
|
+
* ```
|
|
3599
|
+
* @example
|
|
3600
|
+
* ```javascript
|
|
3601
|
+
* decorate(inject("AnotherDependency"), SomeClass, "anotherDependency");
|
|
3602
|
+
* ```
|
|
3603
|
+
* @example
|
|
3604
|
+
* ```javascript
|
|
3605
|
+
* decorate(inject("AnotherDependency"), SomeClass, 0);
|
|
3606
|
+
* ```
|
|
3607
|
+
* @example
|
|
3608
|
+
* ```javascript
|
|
3609
|
+
* decorate(gamePhysicsSystem(), SomeSystem);
|
|
3610
|
+
* ```
|
|
3611
|
+
* @example
|
|
3612
|
+
* ```javascript
|
|
3613
|
+
* decorate(gamePreRenderSystem(), SomeSystem);
|
|
3614
|
+
* ```
|
|
3615
|
+
*/
|
|
3616
|
+
declare function decorate(decorator: (...args: any[]) => any, target: any, propertyKey?: string | symbol | number): void;
|
|
3617
|
+
|
|
3484
3618
|
/**
|
|
3485
3619
|
* Symbols to be used as dependency identifiers
|
|
3486
3620
|
* @public
|
|
@@ -3498,4 +3632,4 @@ declare const Symbols: {
|
|
|
3498
3632
|
TimeManager: symbol;
|
|
3499
3633
|
};
|
|
3500
3634
|
|
|
3501
|
-
export { Animation, type AnimationSlice, Animator, type AnimatorOptions, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, Children, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, type DependencyName, type DependencyType, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, Parent, Polygon, PolygonCollider, type PolygonColliderOptions, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, Scene, SceneManager, type SceneType, type SearchCriteria, type SearchResult, ShadowRenderer, type ShadowRendererOptions, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, Symbols, type System, type SystemGroup, SystemManager, type SystemType, TextOrientation, TextRenderer, type TextRendererOptions, type TiledChunk, type TiledLayer, type TiledObject, type TiledObjectLayer, type TiledProperty, type TiledTilemap, TiledWrapper, type TiledWrapperOptions, TilemapCollider, type TilemapColliderOptions, TilemapOrientation, TilemapRenderer, type TilemapRendererOptions, type Tileset, TimeManager, type TouchInteraction, TouchScreen, Transform, type TransformOptions, Vector2, type VibrationInput, VideoRenderer, type VideoRendererOptions, between, clamp, defaultRenderLayer, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, randomFloat, randomInt, range };
|
|
3635
|
+
export { Animation, type AnimationSlice, Animator, type AnimatorOptions, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, Children, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, type DependencyName, type DependencyType, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, Parent, Polygon, PolygonCollider, type PolygonColliderOptions, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, Scene, SceneManager, type SceneType, type SearchCriteria, type SearchResult, ShadowRenderer, type ShadowRendererOptions, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, Symbols, type System, type SystemGroup, SystemManager, type SystemType, TextOrientation, TextRenderer, type TextRendererOptions, type TiledChunk, type TiledLayer, type TiledObject, type TiledObjectLayer, type TiledProperty, type TiledTilemap, TiledWrapper, type TiledWrapperOptions, TilemapCollider, type TilemapColliderOptions, TilemapOrientation, TilemapRenderer, type TilemapRendererOptions, type Tileset, TimeManager, type TouchInteraction, TouchScreen, Transform, type TransformOptions, Vector2, type VibrationInput, VideoRenderer, type VideoRendererOptions, between, clamp, debugRenderLayer, decorate, defaultRenderLayer, defaultTextureAtlasOptions, degreesToRadians, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, radiansToDegrees, randomFloat, randomInt, range };
|