angry-pixel 2.0.20 → 2.0.21
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 +96 -22
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This type represents a dependency class
|
|
3
3
|
* @public
|
|
4
|
-
* @category
|
|
4
|
+
* @category Dependency Injection
|
|
5
5
|
*/
|
|
6
6
|
type DependencyType = {
|
|
7
7
|
new (...args: any[]): any;
|
|
@@ -9,9 +9,14 @@ type DependencyType = {
|
|
|
9
9
|
/**
|
|
10
10
|
* This type represents a dependency name
|
|
11
11
|
* @public
|
|
12
|
-
* @category
|
|
12
|
+
* @category Dependency Injection
|
|
13
13
|
*/
|
|
14
14
|
type DependencyName = string | symbol;
|
|
15
|
+
/**
|
|
16
|
+
* This type represents a property key of a decorator target
|
|
17
|
+
* @public
|
|
18
|
+
* @category Dependency Injection
|
|
19
|
+
*/
|
|
15
20
|
type PropertyKey = string | symbol;
|
|
16
21
|
declare class Container {
|
|
17
22
|
private instances;
|
|
@@ -613,13 +618,13 @@ interface Collider {
|
|
|
613
618
|
/**
|
|
614
619
|
* This type an unique identifier of an Entity
|
|
615
620
|
* @public
|
|
616
|
-
* @category
|
|
621
|
+
* @category Entity-Component-System
|
|
617
622
|
*/
|
|
618
623
|
type Entity = number;
|
|
619
624
|
/**
|
|
620
625
|
* This type represents an instance of a component
|
|
621
626
|
* @public
|
|
622
|
-
* @category
|
|
627
|
+
* @category Entity-Component-System
|
|
623
628
|
*/
|
|
624
629
|
type Component = {
|
|
625
630
|
[key: string]: any;
|
|
@@ -627,7 +632,7 @@ type Component = {
|
|
|
627
632
|
/**
|
|
628
633
|
* This type represents a component class
|
|
629
634
|
* @public
|
|
630
|
-
* @category
|
|
635
|
+
* @category Entity-Component-System
|
|
631
636
|
*/
|
|
632
637
|
type ComponentType<T extends Component = Component> = {
|
|
633
638
|
new (...args: any[]): T;
|
|
@@ -635,7 +640,7 @@ type ComponentType<T extends Component = Component> = {
|
|
|
635
640
|
/**
|
|
636
641
|
* This type represents a search result object
|
|
637
642
|
* @public
|
|
638
|
-
* @category
|
|
643
|
+
* @category Entity-Component-System
|
|
639
644
|
*/
|
|
640
645
|
type SearchResult<T extends Component> = {
|
|
641
646
|
entity: Entity;
|
|
@@ -644,7 +649,7 @@ type SearchResult<T extends Component> = {
|
|
|
644
649
|
/**
|
|
645
650
|
* This type represents a search criteria object
|
|
646
651
|
* @public
|
|
647
|
-
* @category
|
|
652
|
+
* @category Entity-Component-System
|
|
648
653
|
*/
|
|
649
654
|
type SearchCriteria = {
|
|
650
655
|
[key: string]: any;
|
|
@@ -653,7 +658,7 @@ type SearchCriteria = {
|
|
|
653
658
|
* The EntityManager manages the entities and components.\
|
|
654
659
|
* It provides the necessary methods for reading and writing entities and components.
|
|
655
660
|
* @public
|
|
656
|
-
* @category
|
|
661
|
+
* @category Entity-Component-System
|
|
657
662
|
*/
|
|
658
663
|
declare class EntityManager {
|
|
659
664
|
private lastEntityId;
|
|
@@ -989,7 +994,7 @@ declare class EntityManager {
|
|
|
989
994
|
/**
|
|
990
995
|
* This interface is used for the creation of system classes. You will have to inject the dependencies you need manully.
|
|
991
996
|
* @public
|
|
992
|
-
* @category
|
|
997
|
+
* @category Entity-Component-System
|
|
993
998
|
* @example
|
|
994
999
|
* ```typescript
|
|
995
1000
|
* class PlayerSystem implements System {
|
|
@@ -1033,7 +1038,7 @@ interface System {
|
|
|
1033
1038
|
/**
|
|
1034
1039
|
* This type represents a system class
|
|
1035
1040
|
* @public
|
|
1036
|
-
* @category
|
|
1041
|
+
* @category Entity-Component-System
|
|
1037
1042
|
*/
|
|
1038
1043
|
type SystemType<T extends System = System> = {
|
|
1039
1044
|
new (...args: any[]): T;
|
|
@@ -1044,7 +1049,7 @@ type SystemGroup = string | number | symbol;
|
|
|
1044
1049
|
* The SystemManager manages the systems.\
|
|
1045
1050
|
* It provides the necessary methods for reading and writing systems.
|
|
1046
1051
|
* @public
|
|
1047
|
-
* @category
|
|
1052
|
+
* @category Entity-Component-System
|
|
1048
1053
|
*/
|
|
1049
1054
|
declare class SystemManager {
|
|
1050
1055
|
private systems;
|
|
@@ -1239,12 +1244,19 @@ interface GameConfig {
|
|
|
1239
1244
|
width: number;
|
|
1240
1245
|
/** Game height */
|
|
1241
1246
|
height: number;
|
|
1242
|
-
/**
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1247
|
+
/** Debug options */
|
|
1248
|
+
debug?: {
|
|
1249
|
+
/** Show colliders */
|
|
1250
|
+
colliders: boolean;
|
|
1251
|
+
/** Show mouse position */
|
|
1252
|
+
mousePosition: boolean;
|
|
1253
|
+
/** Color of the colliders, default "#00FF00" (green) */
|
|
1254
|
+
collidersColor?: string;
|
|
1255
|
+
/** Color of the text, default "#00FF00" (green) */
|
|
1256
|
+
textColor?: string;
|
|
1257
|
+
/** Position of debug text, default "bottom-left" */
|
|
1258
|
+
textPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
1259
|
+
};
|
|
1248
1260
|
/** Background color of canvas, default "#000000" (black) */
|
|
1249
1261
|
canvasColor?: string;
|
|
1250
1262
|
/** Framerate for physics execution. The allowed values are 60, 120, 180, 240.
|
|
@@ -1376,6 +1388,11 @@ declare class AssetManager {
|
|
|
1376
1388
|
private createAsset;
|
|
1377
1389
|
}
|
|
1378
1390
|
|
|
1391
|
+
/**
|
|
1392
|
+
* Options for setting an interval.
|
|
1393
|
+
* @public
|
|
1394
|
+
* @category Managers
|
|
1395
|
+
*/
|
|
1379
1396
|
type IntervalOptions = {
|
|
1380
1397
|
callback: () => void;
|
|
1381
1398
|
delay: number;
|
|
@@ -1729,7 +1746,7 @@ interface AudioPlayerOptions {
|
|
|
1729
1746
|
* @category Components
|
|
1730
1747
|
*/
|
|
1731
1748
|
declare class AudioPlayer {
|
|
1732
|
-
/** The action to perform with the audio source. */
|
|
1749
|
+
/** The action to perform with the audio source. This action will be erased at the end of the frame */
|
|
1733
1750
|
action: AudioPlayerAction;
|
|
1734
1751
|
/** The audio source to play. */
|
|
1735
1752
|
audioSource: HTMLAudioElement;
|
|
@@ -1737,12 +1754,18 @@ declare class AudioPlayer {
|
|
|
1737
1754
|
fixedToTimeScale: boolean;
|
|
1738
1755
|
/** TRUE If the audio source should loop. */
|
|
1739
1756
|
loop: boolean;
|
|
1740
|
-
/** READONLY,
|
|
1741
|
-
|
|
1757
|
+
/** READONLY, The current state of the audio source. */
|
|
1758
|
+
state: AudioPlayerState;
|
|
1742
1759
|
/** The volume of the audio source. */
|
|
1743
1760
|
volume: number;
|
|
1761
|
+
/** READONLY, TRUE If the audio source is playing. */
|
|
1762
|
+
get playing(): boolean;
|
|
1763
|
+
/** READONLY, TRUE If the audio source is paused. */
|
|
1764
|
+
get paused(): boolean;
|
|
1765
|
+
/** READONLY, TRUE If the audio source is stopped. */
|
|
1766
|
+
get stopped(): boolean;
|
|
1744
1767
|
/** @internal */
|
|
1745
|
-
|
|
1768
|
+
_currentAudioSource: HTMLAudioElement;
|
|
1746
1769
|
_playPromisePendind: boolean;
|
|
1747
1770
|
constructor(options?: Partial<AudioPlayerOptions>);
|
|
1748
1771
|
/**
|
|
@@ -1763,6 +1786,11 @@ declare class AudioPlayer {
|
|
|
1763
1786
|
* @category Components
|
|
1764
1787
|
*/
|
|
1765
1788
|
type AudioPlayerAction = "stop" | "play" | "pause";
|
|
1789
|
+
/**
|
|
1790
|
+
* @public
|
|
1791
|
+
* @category Components
|
|
1792
|
+
*/
|
|
1793
|
+
type AudioPlayerState = "stopped" | "playing" | "paused";
|
|
1766
1794
|
|
|
1767
1795
|
/**
|
|
1768
1796
|
* @public
|
|
@@ -3676,6 +3704,52 @@ declare function gamePreRenderSystem(): (target: SystemType) => void;
|
|
|
3676
3704
|
*/
|
|
3677
3705
|
declare function decorate(decorator: (...args: any[]) => any, target: any, propertyKey?: string | symbol | number): void;
|
|
3678
3706
|
|
|
3707
|
+
/**
|
|
3708
|
+
* Options for playSfx function.
|
|
3709
|
+
* @public
|
|
3710
|
+
* @category Audio
|
|
3711
|
+
*/
|
|
3712
|
+
interface PlaySfxOptions {
|
|
3713
|
+
audioSource: HTMLAudioElement;
|
|
3714
|
+
volume?: number;
|
|
3715
|
+
loop?: boolean;
|
|
3716
|
+
}
|
|
3717
|
+
/**
|
|
3718
|
+
* This funciton is ideal to play one-shot sound effects. It will play the sound effect from the beginning, even if it's already playing.\
|
|
3719
|
+
* You can also use this function to play audio tracks, but it is recommended to use the AudioPlayer component for this. The AudioPlayer component can handle the browser's autoplay policy and other audio-related functions.
|
|
3720
|
+
* @param playSfxOptions - The options for playing the sound effect.
|
|
3721
|
+
* @public
|
|
3722
|
+
* @category Audio
|
|
3723
|
+
* @example
|
|
3724
|
+
* ```javascript
|
|
3725
|
+
* const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
|
|
3726
|
+
* playSfx({ audioSource });
|
|
3727
|
+
* ```
|
|
3728
|
+
* @example
|
|
3729
|
+
* ```javascript
|
|
3730
|
+
* const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
|
|
3731
|
+
* playSfx({ audioSource, volume: 0.5 });
|
|
3732
|
+
* ```
|
|
3733
|
+
* @example
|
|
3734
|
+
* ```javascript
|
|
3735
|
+
* const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
|
|
3736
|
+
* playSfx({ audioSource, loop: true });
|
|
3737
|
+
* ```
|
|
3738
|
+
*/
|
|
3739
|
+
declare const playSfx: ({ audioSource, volume, loop }: PlaySfxOptions) => void;
|
|
3740
|
+
/**
|
|
3741
|
+
* Stop a sound effect.
|
|
3742
|
+
* @param audioSource - The audio source to stop.
|
|
3743
|
+
* @public
|
|
3744
|
+
* @category Audio
|
|
3745
|
+
* @example
|
|
3746
|
+
* ```javascript
|
|
3747
|
+
* const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
|
|
3748
|
+
* stopSfx(audioSource);
|
|
3749
|
+
* ```
|
|
3750
|
+
*/
|
|
3751
|
+
declare const stopSfx: (audioSource: HTMLAudioElement) => void;
|
|
3752
|
+
|
|
3679
3753
|
/**
|
|
3680
3754
|
* Symbols to be used as dependency identifiers
|
|
3681
3755
|
* @public
|
|
@@ -3693,4 +3767,4 @@ declare const Symbols: {
|
|
|
3693
3767
|
TimeManager: symbol;
|
|
3694
3768
|
};
|
|
3695
3769
|
|
|
3696
|
-
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, rgbToHex };
|
|
3770
|
+
export { Animation, type AnimationSlice, Animator, type AnimatorOptions, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, type AudioPlayerState, 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, type PlaySfxOptions, Polygon, PolygonCollider, type PolygonColliderOptions, type PropertyKey, 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, playSfx, radiansToDegrees, randomFloat, randomInt, range, rgbToHex, stopSfx };
|