angry-pixel 1.1.10 → 1.1.12
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/component/Animator.d.ts +12 -1
- package/lib/component/AudioPlayer.d.ts +28 -6
- package/lib/core/Component.d.ts +1 -0
- package/lib/core/GameActor.d.ts +1 -0
- package/lib/core/GameObject.d.ts +1 -0
- package/lib/core/Scene.d.ts +1 -0
- package/lib/core/managers/GameObjectManager.d.ts +1 -1
- package/lib/core/managers/IterationManager.d.ts +2 -1
- package/lib/core/managers/SceneManager.d.ts +1 -0
- package/lib/index.cjs.js +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { EngineComponent } from "../core/Component";
|
|
2
2
|
import { SpriteRenderer } from "./rendering/SpriteRenderer";
|
|
3
|
-
import {
|
|
3
|
+
import { Sprite } from "./Sprite";
|
|
4
4
|
import { InitOptions } from "../core/GameActor";
|
|
5
|
+
export interface AnimationConfig {
|
|
6
|
+
sprites: Sprite[];
|
|
7
|
+
loop: boolean;
|
|
8
|
+
framerate: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class Animation {
|
|
11
|
+
sprites: Sprite[];
|
|
12
|
+
framerate: number;
|
|
13
|
+
loop: boolean;
|
|
14
|
+
constructor(config: AnimationConfig);
|
|
15
|
+
}
|
|
5
16
|
export interface AnimatorOptions extends InitOptions {
|
|
6
17
|
spriteRenderer: SpriteRenderer;
|
|
7
18
|
}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import { EngineComponent } from "../core/Component";
|
|
2
2
|
import { InitOptions } from "../core/GameActor";
|
|
3
3
|
export interface AudioPlayerOptions extends InitOptions {
|
|
4
|
-
audioSource?: HTMLAudioElement;
|
|
5
4
|
volume?: number;
|
|
6
5
|
loop?: boolean;
|
|
7
|
-
playOnStart?: boolean;
|
|
8
6
|
}
|
|
9
7
|
export declare class AudioPlayer extends EngineComponent {
|
|
10
8
|
readonly allowMultiple: boolean;
|
|
11
9
|
private audioContext;
|
|
12
10
|
private tracks;
|
|
11
|
+
private audioSourceCache;
|
|
13
12
|
private _audioSource;
|
|
14
13
|
private _volume;
|
|
15
14
|
private _loop;
|
|
16
|
-
private playOnStart;
|
|
17
15
|
private _playing;
|
|
18
16
|
private _paused;
|
|
19
|
-
set audioSource(audioSource: HTMLAudioElement);
|
|
20
17
|
get audioSource(): HTMLAudioElement;
|
|
21
18
|
set volume(volume: number);
|
|
22
19
|
get volume(): number;
|
|
@@ -24,11 +21,36 @@ export declare class AudioPlayer extends EngineComponent {
|
|
|
24
21
|
get loop(): boolean;
|
|
25
22
|
get playing(): boolean;
|
|
26
23
|
get paused(): boolean;
|
|
27
|
-
protected init({
|
|
28
|
-
|
|
24
|
+
protected init({ loop, volume }?: AudioPlayerOptions): void;
|
|
25
|
+
/**
|
|
26
|
+
* Play once the given audio source
|
|
27
|
+
* @param audioSource
|
|
28
|
+
* @param volume optional
|
|
29
|
+
*/
|
|
29
30
|
playClip(audioSource: HTMLAudioElement, volume?: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* Add a new audio source
|
|
33
|
+
* @param audioSource
|
|
34
|
+
*/
|
|
35
|
+
addAudioSource(audioSource: HTMLAudioElement, name?: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Load the given audio source (if there is other audio source playing, it will stop)
|
|
38
|
+
* @param audioSourceName
|
|
39
|
+
* @param loop optional
|
|
40
|
+
* @param volume optional
|
|
41
|
+
*/
|
|
42
|
+
loadAudioSource(audioSourceName: string, loop?: boolean, volume?: number): void;
|
|
43
|
+
/**
|
|
44
|
+
* Play the loaded audio source
|
|
45
|
+
*/
|
|
30
46
|
play(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Stop playing the current audio source
|
|
49
|
+
*/
|
|
31
50
|
stop(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Plause the current audio source
|
|
53
|
+
*/
|
|
32
54
|
pause(): void;
|
|
33
55
|
private audioEventHandler;
|
|
34
56
|
private userInputEventHandler;
|
package/lib/core/Component.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export declare abstract class Component extends GameActor {
|
|
|
61
61
|
hasComponent(name: string): boolean;
|
|
62
62
|
removeComponent(component: Component): void;
|
|
63
63
|
protected _destroy(): void;
|
|
64
|
+
protected _stopGame(): void;
|
|
64
65
|
}
|
|
65
66
|
export declare abstract class EngineComponent extends Component {
|
|
66
67
|
protected readonly updateEvent: FrameEvent;
|
package/lib/core/GameActor.d.ts
CHANGED
package/lib/core/GameObject.d.ts
CHANGED
package/lib/core/Scene.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare class GameObjectManager {
|
|
|
14
14
|
findGameObjectByParent<T extends GameObject>(parent: GameObject, gameObjectClass: GameObjectClass<T>): T;
|
|
15
15
|
findGameObjectByParent<T extends GameObject>(parent: GameObject, name: string): T;
|
|
16
16
|
findGameObjectsByTag<T extends GameObject>(tag: string): T[];
|
|
17
|
-
destroyAllGameObjects(): void;
|
|
17
|
+
destroyAllGameObjects(ignoreKeep?: boolean): void;
|
|
18
18
|
destroyGameObject(gameObject: GameObject): void;
|
|
19
19
|
private destroy;
|
|
20
20
|
private destroyChildren;
|