angry-pixel 1.2.6 → 1.2.8

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.
Files changed (156) hide show
  1. package/lib/index.cjs.js +2 -1
  2. package/lib/index.cjs.js.map +1 -0
  3. package/lib/index.d.ts +5 -41
  4. package/lib/index.esm.js +2 -1
  5. package/lib/index.esm.js.map +1 -0
  6. package/lib/index.js +2 -1
  7. package/lib/index.js.map +1 -0
  8. package/package.json +6 -30
  9. package/.github/workflows/analyzeCode.yml +0 -25
  10. package/.github/workflows/buildCode.yml +0 -23
  11. package/.github/workflows/main.yml +0 -15
  12. package/.github/workflows/setupNode.yml +0 -40
  13. package/api-docs/.nojekyll +0 -1
  14. package/api-docs/assets/highlight.css +0 -92
  15. package/api-docs/assets/main.js +0 -59
  16. package/api-docs/assets/navigation.js +0 -1
  17. package/api-docs/assets/search.js +0 -1
  18. package/api-docs/assets/style.css +0 -1383
  19. package/api-docs/classes/Animator.html +0 -128
  20. package/api-docs/classes/AudioPlayer.html +0 -131
  21. package/api-docs/classes/BallCollider.html +0 -132
  22. package/api-docs/classes/BoxCollider.html +0 -136
  23. package/api-docs/classes/Button.html +0 -125
  24. package/api-docs/classes/Camera.html +0 -114
  25. package/api-docs/classes/Component.html +0 -106
  26. package/api-docs/classes/EdgeCollider.html +0 -134
  27. package/api-docs/classes/Game.html +0 -24
  28. package/api-docs/classes/GameCamera.html +0 -163
  29. package/api-docs/classes/GameObject.html +0 -149
  30. package/api-docs/classes/GamepadController.html +0 -11
  31. package/api-docs/classes/GamepadData.html +0 -81
  32. package/api-docs/classes/KeyboardController.html +0 -43
  33. package/api-docs/classes/MaskRenderer.html +0 -119
  34. package/api-docs/classes/MouseController.html +0 -14
  35. package/api-docs/classes/PhysicsComponent.html +0 -107
  36. package/api-docs/classes/PolygonCollider.html +0 -134
  37. package/api-docs/classes/PreRenderComponent.html +0 -107
  38. package/api-docs/classes/Rectangle.html +0 -30
  39. package/api-docs/classes/RigidBody.html +0 -123
  40. package/api-docs/classes/Rotation.html +0 -5
  41. package/api-docs/classes/Scene.html +0 -73
  42. package/api-docs/classes/SpacePointer.html +0 -147
  43. package/api-docs/classes/Sprite.html +0 -20
  44. package/api-docs/classes/SpriteRenderer.html +0 -134
  45. package/api-docs/classes/TextRenderer.html +0 -138
  46. package/api-docs/classes/TiledTilemapRenderer.html +0 -127
  47. package/api-docs/classes/TilemapCollider.html +0 -124
  48. package/api-docs/classes/TilemapRenderer.html +0 -126
  49. package/api-docs/classes/TouchController.html +0 -8
  50. package/api-docs/classes/Transform.html +0 -124
  51. package/api-docs/classes/Vector2.html +0 -65
  52. package/api-docs/classes/VideoRenderer.html +0 -145
  53. package/api-docs/enums/BroadPhaseMethods.html +0 -3
  54. package/api-docs/enums/ButtonType.html +0 -3
  55. package/api-docs/enums/CollisionMethods.html +0 -3
  56. package/api-docs/enums/RigidBodyType.html +0 -4
  57. package/api-docs/enums/TextOrientation.html +0 -5
  58. package/api-docs/enums/TilemapOrientation.html +0 -5
  59. package/api-docs/functions/between.html +0 -5
  60. package/api-docs/functions/clamp.html +0 -5
  61. package/api-docs/functions/fixedRound.html +0 -4
  62. package/api-docs/functions/randomFloat.html +0 -4
  63. package/api-docs/functions/randomInt.html +0 -4
  64. package/api-docs/functions/range.html +0 -5
  65. package/api-docs/index.html +0 -37
  66. package/api-docs/interfaces/AnimationConfig.html +0 -10
  67. package/api-docs/interfaces/AnimatorOptions.html +0 -6
  68. package/api-docs/interfaces/AudioPlayerOptions.html +0 -8
  69. package/api-docs/interfaces/BallColliderOptions.html +0 -16
  70. package/api-docs/interfaces/BoxColliderOptions.html +0 -20
  71. package/api-docs/interfaces/ButtonOptions.html +0 -16
  72. package/api-docs/interfaces/ColliderComponent.html +0 -14
  73. package/api-docs/interfaces/CollisionData.html +0 -10
  74. package/api-docs/interfaces/EdgeColliderOptions.html +0 -18
  75. package/api-docs/interfaces/GameConfig.html +0 -28
  76. package/api-docs/interfaces/IAssetManager.html +0 -40
  77. package/api-docs/interfaces/ICollider.html +0 -11
  78. package/api-docs/interfaces/ICollision.html +0 -4
  79. package/api-docs/interfaces/ICollisionResolution.html +0 -4
  80. package/api-docs/interfaces/IDomManager.html +0 -6
  81. package/api-docs/interfaces/IGameObjectManager.html +0 -49
  82. package/api-docs/interfaces/IInputManager.html +0 -12
  83. package/api-docs/interfaces/IPhysicsManager.html +0 -8
  84. package/api-docs/interfaces/IRenderManager.html +0 -7
  85. package/api-docs/interfaces/ISceneManager.html +0 -18
  86. package/api-docs/interfaces/ITimeManager.html +0 -16
  87. package/api-docs/interfaces/MaskRendererOptions.html +0 -18
  88. package/api-docs/interfaces/PolygonColliderOptions.html +0 -18
  89. package/api-docs/interfaces/RigidBodyOptions.html +0 -17
  90. package/api-docs/interfaces/Slice.html +0 -5
  91. package/api-docs/interfaces/SpriteConfig.html +0 -10
  92. package/api-docs/interfaces/SpriteRendererOptions.html +0 -32
  93. package/api-docs/interfaces/TextRendererOptions.html +0 -38
  94. package/api-docs/interfaces/TiledChunk.html +0 -7
  95. package/api-docs/interfaces/TiledLayer.html +0 -17
  96. package/api-docs/interfaces/TiledTilemap.html +0 -9
  97. package/api-docs/interfaces/TiledTilemapRendererOptions.html +0 -18
  98. package/api-docs/interfaces/TilemapColliderOptions.html +0 -12
  99. package/api-docs/interfaces/TilemapRendererOptions.html +0 -22
  100. package/api-docs/interfaces/Tileset.html +0 -13
  101. package/api-docs/interfaces/TouchInteraction.html +0 -6
  102. package/api-docs/interfaces/VideoRendererOptions.html +0 -34
  103. package/api-docs/modules.html +0 -85
  104. package/api-docs/types/CollisionMatrix.html +0 -1
  105. package/lib/component/Animation.d.ts +0 -12
  106. package/lib/component/Animator.d.ts +0 -139
  107. package/lib/component/AudioPlayer.d.ts +0 -97
  108. package/lib/component/Button.d.ts +0 -117
  109. package/lib/component/Camera.d.ts +0 -47
  110. package/lib/component/RigidBody.d.ts +0 -97
  111. package/lib/component/Sprite.d.ts +0 -22
  112. package/lib/component/Transform.d.ts +0 -65
  113. package/lib/component/collider/BallCollider.d.ts +0 -73
  114. package/lib/component/collider/BoxCollider.d.ts +0 -90
  115. package/lib/component/collider/Collider.d.ts +0 -82
  116. package/lib/component/collider/EdgeCollider.d.ts +0 -81
  117. package/lib/component/collider/PolygonCollider.d.ts +0 -92
  118. package/lib/component/collider/TilemapCollider.d.ts +0 -71
  119. package/lib/component/rendering/MaskRenderer.d.ts +0 -83
  120. package/lib/component/rendering/Sprite.d.ts +0 -61
  121. package/lib/component/rendering/SpriteRenderer.d.ts +0 -133
  122. package/lib/component/rendering/TextRenderer.d.ts +0 -145
  123. package/lib/component/rendering/TiledTilemapRenderer.d.ts +0 -186
  124. package/lib/component/rendering/TilemapRenderer.d.ts +0 -170
  125. package/lib/component/rendering/VideoRenderer.d.ts +0 -158
  126. package/lib/core/Component.d.ts +0 -203
  127. package/lib/core/Game.d.ts +0 -112
  128. package/lib/core/GameActor.d.ts +0 -131
  129. package/lib/core/GameConfig.d.ts +0 -61
  130. package/lib/core/GameObject.d.ts +0 -196
  131. package/lib/core/Scene.d.ts +0 -45
  132. package/lib/core/facades/AssetManagerFacade.d.ts +0 -51
  133. package/lib/core/facades/DomManagerFacade.d.ts +0 -8
  134. package/lib/core/facades/GameObjectManagerFacade.d.ts +0 -70
  135. package/lib/core/facades/InputManagerFacade.d.ts +0 -13
  136. package/lib/core/facades/SceneManagerFacade.d.ts +0 -18
  137. package/lib/core/facades/TimeManagerFacade.d.ts +0 -11
  138. package/lib/core/ioc/Config.d.ts +0 -4
  139. package/lib/core/managers/AssetManager.d.ts +0 -95
  140. package/lib/core/managers/DomManager.d.ts +0 -23
  141. package/lib/core/managers/GameObjectManager.d.ts +0 -118
  142. package/lib/core/managers/HeadlessIterationManager.d.ts +0 -33
  143. package/lib/core/managers/IterationManager.d.ts +0 -63
  144. package/lib/core/managers/SceneManager.d.ts +0 -93
  145. package/lib/core/managers/TimeManager.d.ts +0 -73
  146. package/lib/gameObject/GameCamera.d.ts +0 -38
  147. package/lib/gameObject/SpacePointer.d.ts +0 -15
  148. package/lib/input/GamepadController.d.ts +0 -225
  149. package/lib/input/InputManager.d.ts +0 -37
  150. package/lib/input/KeyboardController.d.ts +0 -81
  151. package/lib/input/MouseController.d.ts +0 -56
  152. package/lib/input/TouchController.d.ts +0 -45
  153. package/lib/utils/Container.d.ts +0 -13
  154. package/lib/utils/Exception.d.ts +0 -5
  155. package/lib/utils/UUID.d.ts +0 -1
  156. package/typedoc.json +0 -13
@@ -1,95 +0,0 @@
1
- import { IRenderManager } from "angry-pixel-2d-renderer";
2
- /**
3
- * Manages the asset loading (images, fonts, audios, videos).
4
- * @public
5
- * @category Managers
6
- * @example
7
- * ```js
8
- * this.assetManager.loadImage("image.png");
9
- * this.assetManager.loadAudio("audio.ogg");
10
- * this.assetManager.loadVideo("video.mp4");
11
- * this.assetManager.loadFont("custom-font", "custom-font.ttf");
12
- *
13
- * const imageElement = this.assetManager.getImage("image.png");
14
- * const audioElement = this.assetManager.getAudio("audio.ogg");
15
- * const videoElement = this.assetManager.getVideo("video.mp4");
16
- * const fontFace = this.assetManager.getFont("custom-font");
17
- *
18
- * if (this.assetManager.getAssetsLoaded()) {
19
- * // do something when assets are loaded
20
- * }
21
- * ```
22
- */
23
- export interface IAssetManager {
24
- /**
25
- * Returns TRUE if the assets are loaded
26
- * @returns TRUE or FALSE
27
- */
28
- getAssetsLoaded(): boolean;
29
- /**
30
- * Loads an image asset
31
- * @param url The asset URL
32
- * @param preloadTexture Creates the texture to be rendered at load time [optional]
33
- * @returns The HTML Image element created
34
- */
35
- loadImage(url: string, preloadTexture?: boolean): HTMLImageElement;
36
- /**
37
- * Loads an audio asset
38
- * @param url The asset URL
39
- * @returns The HTML Audio element created
40
- */
41
- loadAudio(url: string): HTMLAudioElement;
42
- /**
43
- * Loads a font asset
44
- * @param family The font family name
45
- * @param url The asset URL
46
- * @returns The FontFace object created
47
- */
48
- loadFont(family: string, url: string): FontFace;
49
- /**
50
- * Loads an video asset
51
- * @param url The asset URL
52
- * @returns The HTML Video element created
53
- */
54
- loadVideo(url: string): HTMLVideoElement;
55
- /**
56
- * Retrieves an image asset
57
- * @param url The asset URL
58
- * @returns The HTML Image element
59
- */
60
- getImage(url: string): HTMLImageElement;
61
- /**
62
- * Retrieves an audio asset
63
- * @param url The asset URL
64
- * @returns The HTML Audio element
65
- */
66
- getAudio(url: string): HTMLAudioElement;
67
- /**
68
- * Retrieves a font asset
69
- * @param url The asset URL
70
- * @returns The Font element
71
- */
72
- getFont(family: string): FontFace;
73
- /**
74
- * Retrieves a video asset
75
- * @param url The asset URL
76
- * @returns The HTML Video element
77
- */
78
- getVideo(url: string): HTMLVideoElement;
79
- }
80
- /** @private */
81
- export declare class AssetManager implements IAssetManager {
82
- private readonly renderManager;
83
- private readonly assets;
84
- constructor(renderManager: IRenderManager);
85
- getAssetsLoaded(): boolean;
86
- loadImage(url: string, preloadTexture?: boolean): HTMLImageElement;
87
- loadAudio(url: string): HTMLAudioElement;
88
- loadFont(family: string, url: string): FontFace;
89
- loadVideo(url: string): HTMLVideoElement;
90
- getImage(url: string): HTMLImageElement;
91
- getAudio(url: string): HTMLAudioElement;
92
- getFont(family: string): FontFace;
93
- getVideo(url: string): HTMLVideoElement;
94
- private createAsset;
95
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * Manages the canvas element
3
- * @public
4
- * @category Managers
5
- * @example
6
- * ```js
7
- * const canvasElement = this.domManager.canvas;
8
- * ```
9
- */
10
- export interface IDomManager {
11
- /** The canvas element where the game is rendered */
12
- canvas: HTMLCanvasElement;
13
- }
14
- /** @private */
15
- export declare class DomManager implements IDomManager {
16
- private gameWidth;
17
- private gameHeight;
18
- private containerNode;
19
- private _canvas;
20
- constructor(containerNode: HTMLElement, gameWidth: number, gameHeight: number);
21
- get canvas(): HTMLCanvasElement;
22
- private setupCanvas;
23
- }
@@ -1,118 +0,0 @@
1
- import { GameObject, GameObjectClass } from "../GameObject";
2
- import { InitOptions } from "../GameActor";
3
- import { Container } from "../../utils/Container";
4
- /**
5
- * Used to create, retrieve and destroy GameObject instances.
6
- * @public
7
- * @category Managers
8
- * @example
9
- * ```js
10
- * // create a new game object instance
11
- * this.gameObjectManager.addGameObject(Player);
12
- *
13
- * // find a game object by its class
14
- * const player = this.gameObjectManager.findGameObject(Player);
15
- *
16
- * // find game objects by their class
17
- * const coins = this.gameObjectManager.findGameObjects(Coin);
18
- *
19
- * // find game objects by their tag
20
- * const enemies = this.gameObjectManager.findGameObjectsByTag("Enemy");
21
- *
22
- * // destroy a game object
23
- * this.gameObjectManager.destroyGameObject(player);
24
- * ```
25
- */
26
- export interface IGameObjectManager {
27
- /**
28
- * Instantiates a new game object.
29
- * @param gameObjectClass The game object class.
30
- * @param options [optional] Options for the Init method.
31
- * @param parent [optional] The parent game object.
32
- * @param name [optional] The name associated to the game object.
33
- * @returns The game object instance.
34
- */
35
- addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions, parent?: GameObject, name?: string): T;
36
- /**
37
- * Returns a collection of found game objects for the given class, or all the game objects if there is no class.
38
- * @param gameObjectClass [optional] The game object class to find.
39
- * @returns The found game objects.
40
- */
41
- findGameObjects<T extends GameObject>(gameObjectClass?: GameObjectClass<T>): T[];
42
- /**
43
- * Returns the first game object found for the given id, or undefined otherwise.
44
- * @param id The game object id to find.
45
- * @returns The found game object.
46
- */
47
- findGameObjectById<T extends GameObject>(id: number): T;
48
- /**
49
- * Returns the first game object found for the given class, or undefined otherwise.
50
- * @param gameObjectClass The game object class to find.
51
- * @returns The found game object.
52
- */
53
- findGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
54
- /**
55
- * Returns the first game object found for the given name, or undefined otherwise.
56
- * @param name The name of the game object to find.
57
- * @returns The found game object.
58
- */
59
- findGameObject<T extends GameObject>(name: string): T;
60
- findGameObject<T extends GameObject>(filter: GameObjectClass<T> | string): T;
61
- /**
62
- * Returns a collection of children game objects for the given parent object.
63
- * @param parent The parent game object.
64
- * @returns The found game objects.
65
- */
66
- findGameObjectsByParent<T extends GameObject>(parent: GameObject): T[];
67
- /**
68
- * Returns the first child game object for the given parent object and filtered by the given game object class.
69
- * @param parent The parent game object.
70
- * @param gameObjectClass The game object class to find.
71
- * @returns The found game object.
72
- */
73
- findGameObjectByParent<T extends GameObject>(parent: GameObject, gameObjectClass: GameObjectClass<T>): T;
74
- /**
75
- * Returns the first child game object for the given parent object and filtered by the given name.
76
- * @param parent The parent game object.
77
- * @param name The name of the game object to find.
78
- * @returns The found game object.
79
- */
80
- findGameObjectByParent<T extends GameObject>(parent: GameObject, name: string): T;
81
- findGameObjectByParent<T extends GameObject>(parent: GameObject, filter: GameObjectClass<T> | string): T;
82
- /**
83
- * Returns a collection of game objects found for the given tag.
84
- * @param tag The tag of the game objects to find.
85
- * @returns The found game objects.
86
- */
87
- findGameObjectsByTag<T extends GameObject>(tag: string): T[];
88
- /**
89
- * Destroy all game objets.
90
- * @param ignoreKeep [optional] If TRUE, it also destroys objects with the "keep" property set to TRUE.
91
- */
92
- destroyAllGameObjects(ignoreKeep?: boolean): void;
93
- /**
94
- * Destroy the given game object.
95
- * @param gameObject The game object to destory.
96
- */
97
- destroyGameObject(gameObject: GameObject): void;
98
- }
99
- /** @private */
100
- export declare class GameObjectManager implements IGameObjectManager {
101
- private readonly container;
102
- private gameObjects;
103
- private lastId;
104
- constructor(container: Container);
105
- addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions, parent?: GameObject, name?: string): T;
106
- findGameObjects<T extends GameObject>(gameObjectClass?: GameObjectClass<T>): T[];
107
- findGameObjectById<T extends GameObject>(id: number): T;
108
- findGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
109
- findGameObject<T extends GameObject>(name: string): T;
110
- findGameObjectsByParent<T extends GameObject>(parent: GameObject): T[];
111
- findGameObjectByParent<T extends GameObject>(parent: GameObject, gameObjectClass: GameObjectClass<T>): T;
112
- findGameObjectByParent<T extends GameObject>(parent: GameObject, name: string): T;
113
- findGameObjectsByTag<T extends GameObject>(tag: string): T[];
114
- destroyAllGameObjects(ignoreKeep?: boolean): void;
115
- destroyGameObject(gameObject: GameObject): void;
116
- private destroy;
117
- private destroyChildren;
118
- }
@@ -1,33 +0,0 @@
1
- import { IGameObjectManager } from "./GameObjectManager";
2
- import { ISceneManager } from "./SceneManager";
3
- import { ITimeManager } from "./TimeManager";
4
- import { IIterationManager } from "./IterationManager";
5
- import { IPhysicsManager } from "angry-pixel-2d-physics";
6
- /** @private */
7
- export declare class HeadlessIterationManager implements IIterationManager {
8
- private readonly timeManager;
9
- private readonly physicsManager;
10
- private readonly gameObjectManager;
11
- private readonly sceneManager;
12
- running: boolean;
13
- private loadedScene;
14
- private gameObjects;
15
- private components;
16
- private gameInterval;
17
- private physicsInterval;
18
- private changingScene;
19
- private readonly sceneEvents;
20
- private readonly gameObjectEvents;
21
- constructor(timeManager: ITimeManager, physicsManager: IPhysicsManager, gameObjectManager: IGameObjectManager, sceneManager: ISceneManager);
22
- start(): void;
23
- pause(): void;
24
- resume(): void;
25
- stop(): void;
26
- private startLoop;
27
- private gameLogicIteration;
28
- private physicsIteration;
29
- private asyncGameLoop;
30
- private asyncPhysicsLoop;
31
- private load;
32
- private dispatchFrameEvent;
33
- }
@@ -1,63 +0,0 @@
1
- import { IGameObjectManager } from "./GameObjectManager";
2
- import { ISceneManager } from "./SceneManager";
3
- import { IInputManager } from "../../input/InputManager";
4
- import { IRenderManager } from "angry-pixel-2d-renderer";
5
- import { ITimeManager } from "./TimeManager";
6
- import { IPhysicsManager } from "angry-pixel-2d-physics";
7
- /** @private */
8
- export declare enum FrameEvent {
9
- Init = 0,
10
- Start = 1,
11
- Update = 2,
12
- UpdateEngine = 3,
13
- UpdateCollider = 4,
14
- UpdatePhysics = 5,
15
- UpdateTransform = 6,
16
- UpdatePreRender = 7,
17
- UpdateCamera = 8,
18
- UpdateRender = 9,
19
- Destroy = 10,
20
- StopGame = 11
21
- }
22
- /** @private */
23
- export interface IIterationManager {
24
- running: boolean;
25
- start(): void;
26
- pause(): void;
27
- resume(): void;
28
- stop(): void;
29
- }
30
- /** @private */
31
- export declare const now: () => number;
32
- /** @private */
33
- export declare class IterationManager implements IIterationManager {
34
- private readonly timeManager;
35
- private readonly physicsManager;
36
- private readonly renderManager;
37
- private readonly inputManager;
38
- private readonly gameObjectManager;
39
- private readonly sceneManager;
40
- private readonly canvasColor;
41
- running: boolean;
42
- private gameLoopAccumulator;
43
- private loadedScene;
44
- private gameObjects;
45
- private components;
46
- private physicsIntervalId;
47
- private changingScene;
48
- private readonly sceneEvents;
49
- private readonly gameObjectEvents;
50
- constructor(timeManager: ITimeManager, physicsManager: IPhysicsManager, renderManager: IRenderManager, inputManager: IInputManager, gameObjectManager: IGameObjectManager, sceneManager: ISceneManager, canvasColor: string);
51
- start(): void;
52
- pause(): void;
53
- resume(): void;
54
- stop(): void;
55
- private startLoop;
56
- private requestAnimationLoop;
57
- private gameLogicIteration;
58
- private renderIteration;
59
- private physicsIteration;
60
- private asyncPhysicsLoop;
61
- private load;
62
- private dispatchFrameEvent;
63
- }
@@ -1,93 +0,0 @@
1
- import { Scene, SceneClass } from "../Scene";
2
- import { IRenderManager } from "angry-pixel-2d-renderer";
3
- import { InitOptions } from "../GameActor";
4
- import { Container } from "../../utils/Container";
5
- /**
6
- * Manges the loading of the scenes.
7
- * @public
8
- * @category Managers
9
- * @example
10
- * ```js
11
- * this.sceneManager.loadScene("MainScene");
12
- * const loadedScene = this.sceneManager.getLoadedScene();
13
- * ```
14
- */
15
- export interface ISceneManager {
16
- /**
17
- * Adds a new scene.
18
- * @param sceneClass The scene class .
19
- * @param name The name to identify the scene.
20
- * @param options [optional] Options for the init method.
21
- * @param openingScene [optional] TRUE if it's the first scene to load.
22
- */
23
- addScene(sceneClass: SceneClass, name: string, options?: InitOptions, openingScene?: boolean): void;
24
- /**
25
- * Loads a Scene by the given name.
26
- * @param name The name of the Scene.
27
- */
28
- loadScene(name: string): void;
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
- */
54
- unloadCurrentScene(): void;
55
- }
56
- /** @private */
57
- export declare class SceneManager implements ISceneManager {
58
- private readonly container;
59
- private renderManager?;
60
- private scenes;
61
- private currentScene;
62
- private openingSceneName;
63
- private sceneNamePendingToLoad;
64
- constructor(container: Container, renderManager?: IRenderManager);
65
- /**
66
- * @inheritdoc
67
- */
68
- addScene(sceneClass: SceneClass, name: string, options?: InitOptions, openingScene?: boolean): void;
69
- /**
70
- * @inheritdoc
71
- */
72
- loadScene(name: string): void;
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
- */
92
- unloadCurrentScene(): void;
93
- }
@@ -1,73 +0,0 @@
1
- export declare const MIN_GAME_FRAMERATE = 30;
2
- export declare const DEFAULT_GAME_FRAMERATE = 60;
3
- export declare const DEFAULT_PHYSICS_FRAMERATE = 180;
4
- /**
5
- * Manages the properties associated with time.
6
- * @public
7
- * @category Managers
8
- * @example
9
- * ```js
10
- * // using deltaTime to increment a timer
11
- * this.timer += this.timeManager.deltaTime;
12
- *
13
- * // using physicsDeltaTime within a physics component to move the object it belongs to
14
- * this.transform.position.x += speed * this.timeManager.physicsDeltaTime;
15
- *
16
- * // stop all time-related interactions by setting the scale to zero
17
- * this.timeManager.timeScale = 0;
18
- * ```
19
- */
20
- export interface ITimeManager {
21
- /** @private */
22
- minGameDeltatime: number;
23
- /** @private */
24
- minPhysicsDeltaTime: number;
25
- /** @private */
26
- gameFramerate: number;
27
- /** @private */
28
- physicsFramerate: number;
29
- /** The time difference, in seconds, between the last frame and the current frame. */
30
- deltaTime: number;
31
- /** The time difference, in seconds, between the last physics frame and the current one. */
32
- physicsDeltaTime: number;
33
- /**
34
- * The scale on which time passes. The default value is 1.\
35
- * For example, if set to 2, the time will run at twice the speed.\
36
- * If set to 0.5, it will run at half the speed.\
37
- * If set to 0, everything associated with the time will stop.
38
- */
39
- timeScale: number;
40
- /** The time difference, in seconds, between the last frame and the current frame, unaffected by the scale. */
41
- unscaledDeltaTime: number;
42
- /** The time difference, in seconds, between the last physics frame and the current one, unaffected by the scale. */
43
- unscaledPhysicsDeltaTime: number;
44
- /** The time difference, in seconds, between the last frame of and the current frame recorded by the browser. */
45
- browserDeltaTime: number;
46
- /** @private */
47
- updateForGame(time: number): void;
48
- /** @private */
49
- updateForBrowser(time: number): void;
50
- /** @private */
51
- updateForPhysics(time: number): void;
52
- }
53
- /** @private */
54
- export declare class TimeManager implements ITimeManager {
55
- readonly minGameDeltatime: number;
56
- readonly minPhysicsDeltaTime: number;
57
- readonly gameFramerate: number;
58
- readonly physicsFramerate: number;
59
- timeScale: number;
60
- browserDeltaTime: number;
61
- unscaledDeltaTime: number;
62
- unscaledPhysicsDeltaTime: number;
63
- private readonly maxDeltaTime;
64
- private thenForGame;
65
- private thenForPhysics;
66
- private thenForBrowser;
67
- get deltaTime(): number;
68
- get physicsDeltaTime(): number;
69
- constructor(physicsFramerate: number);
70
- updateForGame(time: number): void;
71
- updateForBrowser(time: number): void;
72
- updateForPhysics(time: number): void;
73
- }
@@ -1,38 +0,0 @@
1
- import { GameObject } from "../core/GameObject";
2
- import { Camera } from "../component/Camera";
3
- import { Rectangle } from "angry-pixel-math";
4
- /**
5
- * This GameCamera object is automatically added to all scenes, but it also allows
6
- * new instances of it to be created, for example, to generate parallax effects.
7
- * @public
8
- * @category Game Objects
9
- */
10
- export declare class GameCamera extends GameObject {
11
- /** The Camera component instance */
12
- camera: Camera;
13
- protected init(): void;
14
- /** Layers to be rendered by this camera */
15
- set layers(layers: string[]);
16
- /** Layers to be rendered by this camera */
17
- get layers(): string[];
18
- /** In case you have more than one camera, the depth value determines which camera is rendered first */
19
- set depth(depth: number);
20
- /** In case you have more than one camera, the depth value determines which camera is rendered first */
21
- get depth(): number;
22
- /** Camera zoom. Default value is 1 */
23
- set zoom(zoom: number);
24
- /** Camera zoom. Default value is 1 */
25
- get zoom(): number;
26
- /**
27
- * Rectangle representing the field of view of the camera in the game world
28
- * @readonly
29
- */
30
- get worldSpaceRect(): Rectangle;
31
- /**
32
- * Rectangle representing the field of view of the camera from the perspective of the screen
33
- * @readonly
34
- */
35
- get viewportRect(): Rectangle;
36
- /** Adds a new layer to the end of the stack */
37
- addLayer(layer: string): void;
38
- }
@@ -1,15 +0,0 @@
1
- import { GameObject } from "../core/GameObject";
2
- /**
3
- * This object can be used to click anywhere in the game and get the coordinates relative to the game world.
4
- * The coordinates are expressed as an xy vector in the browser console.
5
- * It is a useful tool to know where to position objects.
6
- * @public
7
- * @category Game Objects
8
- */
9
- export declare class SpacePointer extends GameObject {
10
- private camera;
11
- private mousePressed;
12
- private position;
13
- protected start(): void;
14
- protected update(): void;
15
- }