angry-pixel 1.1.7 → 1.1.9

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.
@@ -1,26 +1,35 @@
1
1
  import { EngineComponent } from "../core/Component";
2
2
  import { InitOptions } from "../core/GameActor";
3
3
  export interface AudioPlayerOptions extends InitOptions {
4
- audio?: HTMLAudioElement;
4
+ audioSource?: HTMLAudioElement;
5
5
  volume?: number;
6
6
  loop?: boolean;
7
+ playOnStart?: boolean;
7
8
  }
8
9
  export declare class AudioPlayer extends EngineComponent {
9
10
  readonly allowMultiple: boolean;
10
- volume: number;
11
- loop: boolean;
12
- audio: HTMLAudioElement;
13
- private clones;
11
+ private audioContext;
12
+ private tracks;
13
+ private _audioSource;
14
+ private _volume;
15
+ private _loop;
16
+ private playOnStart;
14
17
  private _playing;
15
18
  private _paused;
16
- protected init(options?: AudioPlayerOptions): void;
17
- playAudio(audio: HTMLAudioElement, volume?: number | null): void;
18
- private cloneAudio;
19
+ protected init({ audioSource, loop, volume, playOnStart }?: AudioPlayerOptions): void;
20
+ protected start(): void;
21
+ set audioSource(audioSource: HTMLAudioElement);
22
+ get audioSource(): HTMLAudioElement;
23
+ set volume(volume: number);
24
+ get volume(): number;
25
+ set loop(loop: boolean);
26
+ get loop(): boolean;
27
+ playClip(audioSource: HTMLAudioElement, volume?: number): void;
19
28
  play(): void;
20
29
  stop(): void;
21
30
  pause(): void;
22
31
  private audioEventHandler;
23
- private userinputEventHandler;
32
+ private userInputEventHandler;
24
33
  protected onActiveChange(): void;
25
34
  protected onDestroy(): void;
26
35
  }
@@ -30,6 +30,7 @@ export declare class Button extends Component {
30
30
  private scaled;
31
31
  onClick: () => void;
32
32
  onPressed: () => void;
33
+ onHover: () => void;
33
34
  get offset(): Vector2;
34
35
  set offset(offset: Vector2);
35
36
  protected init({ type, height, radius, touchEnabled, width, offset }: ButtonOptions): void;
@@ -18,9 +18,8 @@ export declare class BallCollider extends Collider {
18
18
  private realPosition;
19
19
  private innerPosition;
20
20
  protected init(config: BallColliderOptions): void;
21
- protected update(): void;
22
- private updateRealSize;
21
+ protected updateRealSize(): void;
23
22
  protected updatePosition(): void;
24
23
  private translate;
25
- private updateCollider;
24
+ protected updateColliders(): void;
26
25
  }
@@ -26,9 +26,8 @@ export declare class BoxCollider extends Collider {
26
26
  private applyRotation;
27
27
  private innerPosition;
28
28
  protected init(config: BoxColliderOptions): void;
29
- protected update(): void;
30
- private updateRealSize;
29
+ protected updateRealSize(): void;
31
30
  protected updatePosition(): void;
32
31
  private translate;
33
- private updateCollider;
32
+ protected updateColliders(): void;
34
33
  }
@@ -16,6 +16,11 @@ export declare abstract class Collider extends ColliderComponent {
16
16
  readonly colliders: ICollider[];
17
17
  layer: string;
18
18
  physics: boolean;
19
+ private activateColliders;
20
+ protected abstract updateRealSize(): void;
21
+ protected abstract updatePosition(): void;
22
+ protected abstract updateColliders(): void;
23
+ protected update(): void;
19
24
  collidesWithLayer(layer: string): boolean;
20
25
  getCollisionWithLayer(layer: string): CollisionData | null;
21
26
  getCollisionsWithLayer(layer: string): CollisionData[];
@@ -22,9 +22,8 @@ export declare class EdgeCollider extends Collider {
22
22
  private finalRotation;
23
23
  private innerPosition;
24
24
  protected init(config: EdgeColliderOptions): void;
25
- protected update(): void;
26
- private updateSize;
25
+ protected updateRealSize(): void;
27
26
  protected updatePosition(): void;
28
27
  private translate;
29
- private updateColliders;
28
+ protected updateColliders(): void;
30
29
  }
@@ -24,11 +24,10 @@ export declare class PolygonCollider extends Collider {
24
24
  private finalRotation;
25
25
  private innerPosition;
26
26
  protected init(config: PolygonColliderOptions): void;
27
- protected update(): void;
28
- private updateSize;
27
+ protected updateRealSize(): void;
29
28
  protected updatePosition(): void;
30
29
  private translate;
31
- private updateCollider;
30
+ protected updateColliders(): void;
32
31
  }
33
32
  export declare class PolygonColliderRenderer extends RenderComponent {
34
33
  private renderManager;
@@ -23,5 +23,7 @@ export declare class TilemapCollider extends Collider {
23
23
  private addLineCollider;
24
24
  private needsCollider;
25
25
  private getNeighbors;
26
- protected update(): void;
26
+ protected updateRealSize(): void;
27
+ protected updatePosition(): void;
28
+ protected updateColliders(): void;
27
29
  }
@@ -8,9 +8,10 @@ export declare class AssetManagerFacade {
8
8
  static getAssetsLoaded(): boolean;
9
9
  /**
10
10
  * @param url The url of the image
11
+ * @param preloadTexture [optional] preload the texture for this image
11
12
  * @returns The created image element
12
13
  */
13
- static loadImage(url: string): HTMLImageElement;
14
+ static loadImage(url: string, preloadTexture?: boolean): HTMLImageElement;
14
15
  /**
15
16
  * @param url The url of the audio file
16
17
  * @returns The created audio element
@@ -1,3 +1,4 @@
1
+ import { IRenderManager } from "angry-pixel-2d-renderer";
1
2
  export declare enum AssetType {
2
3
  Image = "Image",
3
4
  Audio = "Audio",
@@ -5,12 +6,19 @@ export declare enum AssetType {
5
6
  }
6
7
  export interface IAssetManager {
7
8
  getAssetsLoaded(): boolean;
8
- loadImage(url: string): HTMLImageElement;
9
+ loadImage(url: string, preloadTexture?: boolean): HTMLImageElement;
10
+ loadAudio(url: string): HTMLAudioElement;
11
+ loadFont(family: string, url: string): FontFace;
12
+ getImage(url: string): HTMLImageElement;
13
+ getAudio(url: string): HTMLAudioElement;
14
+ getFont(family: string): FontFace;
9
15
  }
10
- export declare class AssetManager {
11
- private assets;
16
+ export declare class AssetManager implements IAssetManager {
17
+ private readonly renderManager;
18
+ private readonly assets;
19
+ constructor(renderManager: IRenderManager);
12
20
  getAssetsLoaded(): boolean;
13
- loadImage(url: string): HTMLImageElement;
21
+ loadImage(url: string, preloadTexture?: boolean): HTMLImageElement;
14
22
  loadAudio(url: string): HTMLAudioElement;
15
23
  loadFont(family: string, url: string): FontFace;
16
24
  getImage(url: string): HTMLImageElement;