angry-pixel 1.2.5 → 1.2.6
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/core/Game.d.ts +26 -3
- package/lib/core/managers/GameObjectManager.d.ts +1 -0
- package/lib/core/managers/HeadlessIterationManager.d.ts +4 -1
- package/lib/core/managers/IterationManager.d.ts +4 -1
- package/lib/core/managers/SceneManager.d.ts +52 -18
- package/lib/index.cjs.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +2 -2
package/lib/core/Game.d.ts
CHANGED
|
@@ -66,10 +66,33 @@ export declare class Game {
|
|
|
66
66
|
*
|
|
67
67
|
* @param sceneClass the class of the scene
|
|
68
68
|
* @param name The name of the scene
|
|
69
|
-
* @param options [optional] This options will be passed to the init method
|
|
70
|
-
* @param openingScene [default FALSE] If this is the opening scene, set TRUE, FALSE instead
|
|
71
69
|
*/
|
|
72
|
-
addScene(sceneClass: SceneClass, name: string
|
|
70
|
+
addScene(sceneClass: SceneClass, name: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Add a scene to the game
|
|
73
|
+
*
|
|
74
|
+
* @param sceneClass the class of the scene
|
|
75
|
+
* @param name The name of the scene
|
|
76
|
+
* @param options This options will be passed to the init method
|
|
77
|
+
*/
|
|
78
|
+
addScene(sceneClass: SceneClass, name: string, options: InitOptions): void;
|
|
79
|
+
/**
|
|
80
|
+
* Add a scene to the game
|
|
81
|
+
*
|
|
82
|
+
* @param sceneClass the class of the scene
|
|
83
|
+
* @param name The name of the scene
|
|
84
|
+
* @param openingScene If this is the opening scene, set TRUE, FALSE instead
|
|
85
|
+
*/
|
|
86
|
+
addScene(sceneClass: SceneClass, name: string, openingScene: boolean): void;
|
|
87
|
+
/**
|
|
88
|
+
* Add a scene to the game
|
|
89
|
+
*
|
|
90
|
+
* @param sceneClass the class of the scene
|
|
91
|
+
* @param name The name of the scene
|
|
92
|
+
* @param options This options will be passed to the init method
|
|
93
|
+
* @param openingScene If this is the opening scene, set TRUE, FALSE instead
|
|
94
|
+
*/
|
|
95
|
+
addScene(sceneClass: SceneClass, name: string, options: InitOptions, openingScene: boolean): void;
|
|
73
96
|
/**
|
|
74
97
|
* Run the game
|
|
75
98
|
*/
|
|
@@ -100,6 +100,7 @@ export interface IGameObjectManager {
|
|
|
100
100
|
export declare class GameObjectManager implements IGameObjectManager {
|
|
101
101
|
private readonly container;
|
|
102
102
|
private gameObjects;
|
|
103
|
+
private lastId;
|
|
103
104
|
constructor(container: Container);
|
|
104
105
|
addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions, parent?: GameObject, name?: string): T;
|
|
105
106
|
findGameObjects<T extends GameObject>(gameObjectClass?: GameObjectClass<T>): T[];
|
|
@@ -10,11 +10,14 @@ export declare class HeadlessIterationManager implements IIterationManager {
|
|
|
10
10
|
private readonly gameObjectManager;
|
|
11
11
|
private readonly sceneManager;
|
|
12
12
|
running: boolean;
|
|
13
|
-
private
|
|
13
|
+
private loadedScene;
|
|
14
14
|
private gameObjects;
|
|
15
15
|
private components;
|
|
16
16
|
private gameInterval;
|
|
17
17
|
private physicsInterval;
|
|
18
|
+
private changingScene;
|
|
19
|
+
private readonly sceneEvents;
|
|
20
|
+
private readonly gameObjectEvents;
|
|
18
21
|
constructor(timeManager: ITimeManager, physicsManager: IPhysicsManager, gameObjectManager: IGameObjectManager, sceneManager: ISceneManager);
|
|
19
22
|
start(): void;
|
|
20
23
|
pause(): void;
|
|
@@ -40,10 +40,13 @@ export declare class IterationManager implements IIterationManager {
|
|
|
40
40
|
private readonly canvasColor;
|
|
41
41
|
running: boolean;
|
|
42
42
|
private gameLoopAccumulator;
|
|
43
|
-
private
|
|
43
|
+
private loadedScene;
|
|
44
44
|
private gameObjects;
|
|
45
45
|
private components;
|
|
46
46
|
private physicsIntervalId;
|
|
47
|
+
private changingScene;
|
|
48
|
+
private readonly sceneEvents;
|
|
49
|
+
private readonly gameObjectEvents;
|
|
47
50
|
constructor(timeManager: ITimeManager, physicsManager: IPhysicsManager, renderManager: IRenderManager, inputManager: IInputManager, gameObjectManager: IGameObjectManager, sceneManager: ISceneManager, canvasColor: string);
|
|
48
51
|
start(): void;
|
|
49
52
|
pause(): void;
|
|
@@ -9,14 +9,10 @@ import { Container } from "../../utils/Container";
|
|
|
9
9
|
* @example
|
|
10
10
|
* ```js
|
|
11
11
|
* this.sceneManager.loadScene("MainScene");
|
|
12
|
+
* const loadedScene = this.sceneManager.getLoadedScene();
|
|
12
13
|
* ```
|
|
13
14
|
*/
|
|
14
15
|
export interface ISceneManager {
|
|
15
|
-
/**
|
|
16
|
-
* Retrieves the current loaded scene.
|
|
17
|
-
* @returns The scene instance.
|
|
18
|
-
*/
|
|
19
|
-
getCurrentScene<T extends Scene>(): T;
|
|
20
16
|
/**
|
|
21
17
|
* Adds a new scene.
|
|
22
18
|
* @param sceneClass The scene class .
|
|
@@ -25,19 +21,37 @@ export interface ISceneManager {
|
|
|
25
21
|
* @param openingScene [optional] TRUE if it's the first scene to load.
|
|
26
22
|
*/
|
|
27
23
|
addScene(sceneClass: SceneClass, name: string, options?: InitOptions, openingScene?: boolean): void;
|
|
28
|
-
/** Loads the scene flagged as the opening scene. */
|
|
29
|
-
loadOpeningScene(): void;
|
|
30
24
|
/**
|
|
31
25
|
* Loads a Scene by the given name.
|
|
32
26
|
* @param name The name of the Scene.
|
|
33
27
|
*/
|
|
34
28
|
loadScene(name: string): void;
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves the current loaded scene.
|
|
31
|
+
* @returns The scene instance.
|
|
32
|
+
*/
|
|
33
|
+
getLoadedScene<T extends Scene>(): T;
|
|
34
|
+
/**
|
|
35
|
+
* Loads the scene flagged as the opening scene.
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
loadOpeningScene(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Check if there is a pending scene change.
|
|
41
|
+
* @return TRUE if there is a pending scene to load, FALSE instead
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
pendingSceneToload(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Loads the next pending scene.
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
loadPendingScene(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Unloads the current loaded scene.
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
38
54
|
unloadCurrentScene(): void;
|
|
39
|
-
/** @private */
|
|
40
|
-
stopGame(): void;
|
|
41
55
|
}
|
|
42
56
|
/** @private */
|
|
43
57
|
export declare class SceneManager implements ISceneManager {
|
|
@@ -46,14 +60,34 @@ export declare class SceneManager implements ISceneManager {
|
|
|
46
60
|
private scenes;
|
|
47
61
|
private currentScene;
|
|
48
62
|
private openingSceneName;
|
|
49
|
-
private
|
|
63
|
+
private sceneNamePendingToLoad;
|
|
50
64
|
constructor(container: Container, renderManager?: IRenderManager);
|
|
51
|
-
|
|
65
|
+
/**
|
|
66
|
+
* @inheritdoc
|
|
67
|
+
*/
|
|
52
68
|
addScene(sceneClass: SceneClass, name: string, options?: InitOptions, openingScene?: boolean): void;
|
|
53
|
-
|
|
69
|
+
/**
|
|
70
|
+
* @inheritdoc
|
|
71
|
+
*/
|
|
54
72
|
loadScene(name: string): void;
|
|
55
|
-
|
|
56
|
-
|
|
73
|
+
/**
|
|
74
|
+
* @inheritdoc
|
|
75
|
+
*/
|
|
76
|
+
getLoadedScene<T extends Scene>(): T;
|
|
77
|
+
/**
|
|
78
|
+
* @inheritdoc
|
|
79
|
+
*/
|
|
80
|
+
loadOpeningScene(): void;
|
|
81
|
+
/**
|
|
82
|
+
* @inheritdoc
|
|
83
|
+
*/
|
|
84
|
+
pendingSceneToload(): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* @inheritdoc
|
|
87
|
+
*/
|
|
88
|
+
loadPendingScene(): void;
|
|
89
|
+
/**
|
|
90
|
+
* @inheritdoc
|
|
91
|
+
*/
|
|
57
92
|
unloadCurrentScene(): void;
|
|
58
|
-
stopGame(): void;
|
|
59
93
|
}
|