angry-pixel 1.0.5 → 1.0.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.
Files changed (126) hide show
  1. package/lib/Engine/Component.d.ts +15 -4
  2. package/lib/Engine/Components/Animator.d.ts +0 -1
  3. package/lib/Engine/Components/AudioPlayer.d.ts +0 -1
  4. package/lib/Engine/Components/Camera.d.ts +0 -1
  5. package/lib/Engine/Components/Colliders/BoxCollider.d.ts +0 -1
  6. package/lib/Engine/Components/Colliders/TilemapCollider.d.ts +0 -1
  7. package/lib/Engine/Components/ComponentTypes.d.ts +13 -0
  8. package/lib/Engine/Components/Renderer/CsvTilemapRenderer.d.ts +2 -1
  9. package/lib/Engine/Components/Renderer/SpriteRenderer.d.ts +2 -1
  10. package/lib/Engine/Components/Renderer/TextRenderer.d.ts +8 -1
  11. package/lib/Engine/Components/Renderer/TiledTilemapRenderer.d.ts +1 -1
  12. package/lib/Engine/Components/Renderer/TilemapRenderer.d.ts +16 -3
  13. package/lib/Engine/Components/RigidBody.d.ts +0 -1
  14. package/lib/Engine/Components/Transform.d.ts +0 -1
  15. package/lib/Engine/Core/GameObject/GameObjectManager.d.ts +5 -5
  16. package/lib/Engine/Core/Input/GamepadController.d.ts +1 -1
  17. package/lib/Engine/Core/Rendering/RenderData/ImageRenderData.d.ts +1 -0
  18. package/lib/Engine/Core/Rendering/RenderData/TextRenderData.d.ts +4 -0
  19. package/lib/Engine/Core/Rendering/RenderData/TilemapRenderData.d.ts +1 -0
  20. package/lib/Engine/Core/Rendering/WebGL/ProgramManager.d.ts +7 -3
  21. package/lib/Engine/Core/Rendering/WebGL/Renderer/GeometricRenderer.d.ts +0 -1
  22. package/lib/Engine/Core/Rendering/WebGL/Renderer/ImageRenderer.d.ts +0 -1
  23. package/lib/Engine/Core/Rendering/WebGL/Renderer/TextRenderer.d.ts +2 -1
  24. package/lib/Engine/Core/Rendering/WebGL/Renderer/TilemapRenderer.d.ts +0 -1
  25. package/lib/Engine/Core/Rendering/WebGL/Shader/Legacy/imageFragmentShader.d.ts +1 -1
  26. package/lib/Engine/Core/Rendering/WebGL/Shader/imageFragmentShader.d.ts +1 -1
  27. package/lib/Engine/Core/Rendering/WebGL/Utils.d.ts +3 -2
  28. package/lib/Engine/Facades/GameObjectManagerFacade.d.ts +4 -4
  29. package/lib/Engine/GameObject.d.ts +12 -7
  30. package/lib/Engine/Math/Rotation.d.ts +4 -0
  31. package/lib/Engine/Scene.d.ts +10 -5
  32. package/lib/component/Animation.d.ts +12 -0
  33. package/lib/component/Animator.d.ts +18 -0
  34. package/lib/component/AudioPlayer.d.ts +27 -0
  35. package/lib/component/Camera.d.ts +30 -0
  36. package/lib/component/ComponentTypes.d.ts +14 -0
  37. package/lib/component/RigidBody.d.ts +39 -0
  38. package/lib/component/Sprite.d.ts +31 -0
  39. package/lib/component/Transform.d.ts +32 -0
  40. package/lib/component/colliderComponent/AbstractColliderComponent.d.ts +22 -0
  41. package/lib/component/colliderComponent/BoxCollider.d.ts +32 -0
  42. package/lib/component/colliderComponent/TilemapCollider.d.ts +15 -0
  43. package/lib/component/renderingComponent/MaskRenderer.d.ts +29 -0
  44. package/lib/component/renderingComponent/SpriteRenderer.d.ts +46 -0
  45. package/lib/component/renderingComponent/TextRenderer.d.ts +49 -0
  46. package/lib/component/renderingComponent/tilemap/CsvTilemapRenderer.d.ts +13 -0
  47. package/lib/component/renderingComponent/tilemap/Tile.d.ts +7 -0
  48. package/lib/component/renderingComponent/tilemap/TileData.d.ts +10 -0
  49. package/lib/component/renderingComponent/tilemap/TiledTilemapRenderer.d.ts +43 -0
  50. package/lib/component/renderingComponent/tilemap/TilemapRenderer.d.ts +72 -0
  51. package/lib/component/renderingComponent/tilemap/Tileset.d.ts +25 -0
  52. package/lib/core/Component.d.ts +130 -0
  53. package/lib/core/Game.d.ts +77 -0
  54. package/lib/core/GameObject.d.ts +158 -0
  55. package/lib/core/Scene.d.ts +67 -0
  56. package/lib/core/facades/AssetManagerFacade.d.ts +29 -0
  57. package/lib/core/facades/DomManagerFacade.d.ts +8 -0
  58. package/lib/core/facades/GameObjectManagerFacade.d.ts +54 -0
  59. package/lib/core/facades/InputManagerFacade.d.ts +13 -0
  60. package/lib/core/facades/SceneManagerFacade.d.ts +18 -0
  61. package/lib/core/facades/TimeManagerFacade.d.ts +10 -0
  62. package/lib/core/ioc/Config.d.ts +3 -0
  63. package/lib/core/managers/AssetManager.d.ts +16 -0
  64. package/lib/core/managers/DomManager.d.ts +9 -0
  65. package/lib/core/managers/GameObjectManager.d.ts +17 -0
  66. package/lib/core/managers/IterationManager.d.ts +29 -0
  67. package/lib/core/managers/SceneManager.d.ts +18 -0
  68. package/lib/core/managers/TimeManager.d.ts +18 -0
  69. package/lib/gameObject/GameCamera.d.ts +17 -0
  70. package/lib/gameObject/SpacePointer.d.ts +8 -0
  71. package/lib/index.cjs.js +1 -1
  72. package/lib/index.d.ts +39 -36
  73. package/lib/index.esm.js +1 -1
  74. package/lib/index.js +1 -1
  75. package/lib/input/GamepadController.d.ts +48 -0
  76. package/lib/input/InputManager.d.ts +12 -0
  77. package/lib/input/KeyboardController.d.ts +12 -0
  78. package/lib/input/MouseController.d.ts +21 -0
  79. package/lib/input/TouchController.d.ts +13 -0
  80. package/lib/math/Rectangle.d.ts +50 -0
  81. package/lib/math/Rotation.d.ts +16 -0
  82. package/lib/math/Utils.d.ts +33 -0
  83. package/lib/math/Vector2.d.ts +114 -0
  84. package/lib/physics/collision/CollisionData.d.ts +8 -0
  85. package/lib/physics/collision/CollisionManager.d.ts +27 -0
  86. package/lib/physics/collision/QuadTree.d.ts +32 -0
  87. package/lib/physics/collision/collider/ICollider.d.ts +13 -0
  88. package/lib/physics/collision/collider/RectangleCollider.d.ts +31 -0
  89. package/lib/physics/collision/resolver/AABBResolver.d.ts +14 -0
  90. package/lib/physics/collision/resolver/ICollisionResolver.d.ts +5 -0
  91. package/lib/physics/collision/resolver/SatResolver.d.ts +14 -0
  92. package/lib/physics/collision/shape/Rectangle.d.ts +13 -0
  93. package/lib/physics/collision/shape/Shape.d.ts +28 -0
  94. package/lib/rendering/CameraData.d.ts +9 -0
  95. package/lib/rendering/ContextRenderer.d.ts +6 -0
  96. package/lib/rendering/CullingService.d.ts +11 -0
  97. package/lib/rendering/FontAtlasFactory.d.ts +24 -0
  98. package/lib/rendering/RenderManager.d.ts +22 -0
  99. package/lib/rendering/context2D/Context2DRenderer.d.ts +19 -0
  100. package/lib/rendering/renderData/ColliderRenderData.d.ts +7 -0
  101. package/lib/rendering/renderData/GeometricRenderData.d.ts +12 -0
  102. package/lib/rendering/renderData/ImageRenderData.d.ts +22 -0
  103. package/lib/rendering/renderData/MaskRenderData.d.ts +9 -0
  104. package/lib/rendering/renderData/RenderData.d.ts +23 -0
  105. package/lib/rendering/renderData/TextRenderData.d.ts +22 -0
  106. package/lib/rendering/renderData/TilemapRenderData.d.ts +22 -0
  107. package/lib/rendering/webGL/ProgramFactory.d.ts +7 -0
  108. package/lib/rendering/webGL/ProgramManager.d.ts +26 -0
  109. package/lib/rendering/webGL/ShaderLoader.d.ts +3 -0
  110. package/lib/rendering/webGL/TextureFactory.d.ts +8 -0
  111. package/lib/rendering/webGL/TextureManager.d.ts +11 -0
  112. package/lib/rendering/webGL/Utils.d.ts +7 -0
  113. package/lib/rendering/webGL/WebGLRenderer.d.ts +36 -0
  114. package/lib/rendering/webGL/renderer/GeometricRenderer.d.ts +22 -0
  115. package/lib/rendering/webGL/renderer/ImageRenderer.d.ts +16 -0
  116. package/lib/rendering/webGL/renderer/MaskRenderer.d.ts +14 -0
  117. package/lib/rendering/webGL/renderer/TextRenderer.d.ts +21 -0
  118. package/lib/rendering/webGL/renderer/TilemapRenderer.d.ts +19 -0
  119. package/lib/rendering/webGL/shader/imageFragmentShader.d.ts +1 -0
  120. package/lib/rendering/webGL/shader/imageVertexShader.d.ts +1 -0
  121. package/lib/rendering/webGL/shader/legacy/imageFragmentShader.d.ts +1 -0
  122. package/lib/rendering/webGL/shader/legacy/imageVertexShader.d.ts +1 -0
  123. package/lib/utils/Container.d.ts +12 -0
  124. package/lib/utils/Exception.d.ts +4 -0
  125. package/lib/utils/UUID.d.ts +1 -0
  126. package/package.json +1 -1
@@ -0,0 +1,158 @@
1
+ import { Component } from "./Component";
2
+ import { Transform } from "../component/Transform";
3
+ import { GameObjectFactory } from "../core/managers/GameObjectManager";
4
+ import { Scene } from "./Scene";
5
+ export declare const LAYER_DEFAULT = "Default";
6
+ export declare type ComponentFactory = () => Component;
7
+ export declare class GameObject {
8
+ readonly id: string;
9
+ name: string;
10
+ tag: string;
11
+ layer: string;
12
+ ui: boolean;
13
+ keep: boolean;
14
+ private _active;
15
+ private _parent;
16
+ private started;
17
+ private sceneManager;
18
+ private gameObjectManager;
19
+ private components;
20
+ private inactiveComponents;
21
+ private inactiveChildren;
22
+ constructor();
23
+ get transform(): Transform;
24
+ get active(): boolean;
25
+ get parent(): GameObject;
26
+ set parent(parent: GameObject | null);
27
+ private gameLoopEventHandler;
28
+ /**
29
+ * This method is only ever called once.
30
+ * Recommended for GameObject cration.
31
+ */
32
+ init(): void;
33
+ /**
34
+ * This method is only ever called once.
35
+ */
36
+ protected start(): void;
37
+ /**
38
+ * This method is called on every frame.
39
+ */
40
+ protected update(): void;
41
+ /**
42
+ * @returns The current loaded scene
43
+ */
44
+ protected getCurrentScene<T extends Scene>(): T;
45
+ /**
46
+ * @param gameObjectFactory The factory function for the game object
47
+ * @param name The name of the game object, this must not be used by another game object
48
+ * @returns The added game object
49
+ */
50
+ protected addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string): T;
51
+ /**
52
+ * @param name The name of the game object to find
53
+ * @returns The found game object
54
+ */
55
+ protected findGameObjectByName<T extends GameObject>(name: string): T;
56
+ /**
57
+ * @param tag The tag of the game objects to find
58
+ * @returns The found game objects
59
+ */
60
+ protected findGameObjectsByTag(tag: string): GameObject[];
61
+ /**
62
+ * @param tag The tag of the game object to find
63
+ * @returns The found game object
64
+ */
65
+ protected findGameObjectByTag<T extends GameObject>(tag: string): T;
66
+ /**
67
+ * Add a components to the game obejct
68
+ *
69
+ * @param componentFactory The factory function for the component
70
+ * @param name (optional) The name of the component, this must not be used by another component
71
+ * @returns The added component
72
+ */
73
+ addComponent<T extends Component>(componentFactory: ComponentFactory, name?: string | null): T;
74
+ private checkMultipleComponent;
75
+ /**
76
+ * @returns All the added components
77
+ */
78
+ getComponents(): Component[];
79
+ /**
80
+ * @param name The name of the component to find
81
+ * @returns The found component
82
+ */
83
+ getComponentByName<T extends Component>(name: string): T;
84
+ /**
85
+ * @param type The type of the component to find
86
+ * @returns The found component
87
+ */
88
+ getComponentByType<T extends Component>(type: string): T;
89
+ /**
90
+ * @param type The type of the components to find
91
+ * @returns The found components
92
+ */
93
+ getComponentsByType<T extends Component>(type: string): T[];
94
+ /**
95
+ * @param name The name of the component to find
96
+ * @returns TRUE or FALSE
97
+ */
98
+ hasComponentOfName(name: string): boolean;
99
+ /**
100
+ * @param type The type of the component to find
101
+ * @returns TRUE or FALSE
102
+ */
103
+ hasComponentOfType(type: string): boolean;
104
+ /**
105
+ * @param name The name of the component to remove
106
+ */
107
+ removeComponentByName(name: string): void;
108
+ /**
109
+ * @param type The tyepe of the component to remove
110
+ */
111
+ removeComponentByType(type: string): void;
112
+ /**
113
+ * Remove all added components
114
+ */
115
+ removeComponents(): void;
116
+ /**
117
+ * Add a child game object.
118
+ *
119
+ * @param gameObjectFactory The factory of the child game object
120
+ * @param name The name of the child game object, this must not be used by another game object
121
+ * @returns The added child game object
122
+ */
123
+ addChild<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string): T;
124
+ /**
125
+ * @returns The children game objects
126
+ */
127
+ getChildren(): GameObject[];
128
+ /**
129
+ * @param name The name of the child game object to find
130
+ * @returns The found child game object
131
+ */
132
+ getChild<T extends GameObject>(name: string): T;
133
+ /**
134
+ * Destroy all the children game objects
135
+ */
136
+ destroyChildren(): void;
137
+ /**
138
+ * If the object become inactive, every component and child game object will stop their execution.
139
+ *
140
+ * @param active TRUE or FALE
141
+ */
142
+ setActive(active: boolean): void;
143
+ private updateInactiveCache;
144
+ /**
145
+ * Destroy one game objects by its name
146
+ * @param name The name of the game object
147
+ */
148
+ destroyGameObjectByName(name: string): void;
149
+ /**
150
+ * Destroy the game objects
151
+ * @param gameObject The game object to destory
152
+ */
153
+ destroyGameObject(gameObject: GameObject): void;
154
+ /**
155
+ * @description NOTE: do not use this method. Use GameObject.destroyGameObject or Scene.destroyGameObject instead.
156
+ */
157
+ destroy(): void;
158
+ }
@@ -0,0 +1,67 @@
1
+ import { GameCamera } from "../gameObject/GameCamera";
2
+ import { Game } from "./Game";
3
+ import { GameObject } from "./GameObject";
4
+ import { GameObjectFactory } from "../core/managers/GameObjectManager";
5
+ export declare const GAME_CAMERA_ID = "GameCamera";
6
+ export declare class Scene {
7
+ private readonly gameObjectManager;
8
+ game: Game;
9
+ name: string;
10
+ private started;
11
+ constructor();
12
+ private gameLoopEventHandler;
13
+ get gameCamera(): GameCamera;
14
+ /**
15
+ * This method is only ever called once.
16
+ * Recommended for GameObject cration.
17
+ */
18
+ init(): void;
19
+ /**
20
+ * This method is only ever called once.
21
+ */
22
+ protected start(): void;
23
+ /**
24
+ * This method is called on every frame.
25
+ */
26
+ protected update(): void;
27
+ /**
28
+ * @param gameObjectFactory The factory function for the game object
29
+ * @param name The name of the game object, this must not be used by another game object
30
+ * @returns The added game object
31
+ */
32
+ protected addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string): T;
33
+ /**
34
+ * @returns The all the loaded game objects
35
+ */
36
+ protected getGameObjects(): GameObject[];
37
+ /**
38
+ * @param name The name of the game object to find
39
+ * @returns The found game object
40
+ */
41
+ protected findGameObjectByName<T extends GameObject>(name: string): T;
42
+ /**
43
+ * @param tag The tag of the game objects to find
44
+ * @returns The found game objects
45
+ */
46
+ protected findGameObjectsByTag(tag: string): GameObject[];
47
+ /**
48
+ * @param tag The tag of the game object to find
49
+ * @returns The found game object
50
+ */
51
+ protected findGameObjectByTag<T extends GameObject>(tag: string): T;
52
+ /**
53
+ * Destroy one game objects by its name
54
+ * @param name The name of the game object
55
+ */
56
+ protected destroyGameObjectByName(name: string): void;
57
+ /**
58
+ * Destroy the game objects
59
+ *
60
+ * @param gameObject The game object to destory
61
+ */
62
+ protected destroyGameObject(gameObject: GameObject): void;
63
+ /**
64
+ * @description NOTE: do not use this method. Use SceneManager.unloadCurrentScene instead.
65
+ */
66
+ destroy(): void;
67
+ }
@@ -0,0 +1,29 @@
1
+ import { AssetManager } from "../managers/AssetManager";
2
+ export declare class AssetManagerFacade {
3
+ private static assetManager;
4
+ static initialize(assetManager: AssetManager): void;
5
+ /**
6
+ * @returns TRUE if all the assets are loaded, FALSE instead
7
+ */
8
+ static getAssetsLoaded(): boolean;
9
+ /**
10
+ * @param url The url of the image
11
+ * @returns The created image element
12
+ */
13
+ static loadImage(url: string): HTMLImageElement;
14
+ /**
15
+ * @param url The url of the audio file
16
+ * @returns The created audio element
17
+ */
18
+ static loadAudio(url: string): HTMLAudioElement;
19
+ /**
20
+ * @param url The url of the image element to find
21
+ * @returns the found image element
22
+ */
23
+ static getImage(url: string): HTMLImageElement;
24
+ /**
25
+ * @param url The url of the audio element to find
26
+ * @returns The found audio element
27
+ */
28
+ static getAudio(url: string): HTMLAudioElement;
29
+ }
@@ -0,0 +1,8 @@
1
+ import { DomManager } from "../managers/DomManager";
2
+ export declare class DomManagerFacade {
3
+ private static domManager;
4
+ static initialize(domManager: DomManager): void;
5
+ static get gameWidth(): number;
6
+ static get gameHeight(): number;
7
+ static get canvas(): HTMLCanvasElement;
8
+ }
@@ -0,0 +1,54 @@
1
+ import { GameObjectManager, GameObjectFactory } from "../managers/GameObjectManager";
2
+ import { GameObject } from "../GameObject";
3
+ export declare class GameObjectManagerFacade {
4
+ private static manager;
5
+ static initialize(manager: GameObjectManager): void;
6
+ /**
7
+ * @param gameObjectFactory The factory function for the game object
8
+ * @param name The name of the game object, this must not be used by another game object
9
+ * @param parent (optional) The parent game object
10
+ * @returns the added game object
11
+ */
12
+ static addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string, parent?: GameObject): T;
13
+ /**
14
+ * @returns All the added game objects
15
+ */
16
+ static getGameObjects(): GameObject[];
17
+ /**
18
+ * @param name The name of the game object to find
19
+ * @returns The found game object
20
+ */
21
+ static findGameObjectByName<T extends GameObject>(name: string): T;
22
+ /**
23
+ * @param parent The parent game object
24
+ * @returns The found game objects
25
+ */
26
+ static findGameObjectsByParent(parent: GameObject): GameObject[];
27
+ /**
28
+ *
29
+ * @param parent The parent game object
30
+ * @param name The name of the game object to find
31
+ * @returns The found game objects
32
+ */
33
+ static findGameObjectByParentAndName<T extends GameObject>(parent: GameObject, name: string): T;
34
+ /**
35
+ * @param tag The tag of the game objects to find
36
+ * @returns The found game objects
37
+ */
38
+ static findGameObjectsByTag(tag: string): GameObject[];
39
+ /**
40
+ * @param tag The tag of the game object to find
41
+ * @returns The found game object
42
+ */
43
+ static findGameObjectByTag<T extends GameObject>(tag: string): T;
44
+ /**
45
+ * Destroy the game objects
46
+ * @param gameObject The game object to destory
47
+ */
48
+ static destroyGameObject(gameObject: GameObject): void;
49
+ /**
50
+ * Destroy one game objects by its name
51
+ * @param name The name of the game object
52
+ */
53
+ static destroyGameObjectByName(name: string): void;
54
+ }
@@ -0,0 +1,13 @@
1
+ import { GamepadController } from "../../input/GamepadController";
2
+ import { InputManager } from "../../input/InputManager";
3
+ import { KeyboardController } from "../../input/KeyboardController";
4
+ import { MouseController } from "../../input/MouseController";
5
+ import { TouchController } from "../../input/TouchController";
6
+ export declare class InputManagerFacade {
7
+ private static inputManager;
8
+ static initialize(inputManager: InputManager): void;
9
+ static get mouse(): MouseController;
10
+ static get keyboard(): KeyboardController;
11
+ static get gamepad(): GamepadController;
12
+ static get touch(): TouchController;
13
+ }
@@ -0,0 +1,18 @@
1
+ import { SceneManager } from "../managers/SceneManager";
2
+ export declare class SceneManagerFacade {
3
+ private static sceneManager;
4
+ static initialize(sceneManager: SceneManager): void;
5
+ /**
6
+ * Unload the current scene and load the new scene
7
+ * @param name The scene name to load
8
+ */
9
+ static loadScene(name: string): void;
10
+ /**
11
+ * @returns The name of the current scene
12
+ */
13
+ static getCurrentSceneName(): string;
14
+ /**
15
+ * Load the opening scene
16
+ */
17
+ static loadOpeningScene(): void;
18
+ }
@@ -0,0 +1,10 @@
1
+ import { TimeManager } from "../managers/TimeManager";
2
+ export declare class TimeManagerFacade {
3
+ private static timeManager;
4
+ static initialize(timeManager: TimeManager): void;
5
+ static get deltaTime(): number;
6
+ static getTimeScale(): number;
7
+ static setTimeScale(scale: number): void;
8
+ static get unscaledDeltaTime(): number;
9
+ static get physicsDeltaTime(): number;
10
+ }
@@ -0,0 +1,3 @@
1
+ import { GameConfig } from "../Game";
2
+ import { Container } from "../../utils/Container";
3
+ export declare const loadDependencies: (container: Container, gameConfig: GameConfig) => void;
@@ -0,0 +1,16 @@
1
+ export declare enum AssetType {
2
+ Image = "Image",
3
+ Audio = "Audio",
4
+ Video = "Video"
5
+ }
6
+ export declare class AssetManager {
7
+ private assets;
8
+ getAssetsLoaded(): boolean;
9
+ laadImage(url: string): HTMLImageElement;
10
+ loadAudio(url: string): HTMLAudioElement;
11
+ getImage(url: string): HTMLImageElement;
12
+ getVideo(url: string): HTMLVideoElement;
13
+ getAudio(url: string): HTMLAudioElement;
14
+ getAsset<EType extends HTMLImageElement | HTMLVideoElement | HTMLAudioElement>(url: string, type?: AssetType | null): EType;
15
+ private createAsset;
16
+ }
@@ -0,0 +1,9 @@
1
+ export declare class DomManager {
2
+ private gameWidth;
3
+ private gameHeight;
4
+ private containerNode;
5
+ private _canvas;
6
+ constructor(containerNode: HTMLElement, gameWidth: number, gameHeight: number);
7
+ get canvas(): HTMLCanvasElement;
8
+ private setupCanvas;
9
+ }
@@ -0,0 +1,17 @@
1
+ import { GameObject } from "../GameObject";
2
+ export declare type GameObjectFactory = () => GameObject;
3
+ export declare class GameObjectManager {
4
+ private gameObjects;
5
+ addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string, parent?: GameObject): T;
6
+ getGameObjects(): GameObject[];
7
+ findGameObjectById(id: string): GameObject;
8
+ findGameObjectByName(name: string): GameObject;
9
+ findGameObjectsByParent(parent: GameObject): GameObject[];
10
+ findGameObjectByParentAndName(parent: GameObject, name: string): GameObject;
11
+ findGameObjectsByTag(tag: string): GameObject[];
12
+ findGameObjectByTag(tag: string): GameObject;
13
+ destroyAllGameObjects(): void;
14
+ destroyGameObject(gameObject: GameObject): void;
15
+ private _destroyGameObject;
16
+ private destroyChildren;
17
+ }
@@ -0,0 +1,29 @@
1
+ import { InputManager } from "../../input/InputManager";
2
+ import { CollisionManager } from "../../physics/collision/CollisionManager";
3
+ import { RenderManager } from "../../rendering/RenderManager";
4
+ import { TimeManager } from "./TimeManager";
5
+ export declare const EVENT_START: string;
6
+ export declare const EVENT_UPDATE: string;
7
+ export declare const EVENT_UPDATE_ENGINE: string;
8
+ export declare const EVENT_UPDATE_COLLIDER: string;
9
+ export declare const EVENT_UPDATE_PHYSICS: string;
10
+ export declare const EVENT_UPDATE_TRANSFORM: string;
11
+ export declare const EVENT_UPDATE_PRERENDER: string;
12
+ export declare const EVENT_UPDATE_CAMERA: string;
13
+ export declare const EVENT_UPDATE_RENDER: string;
14
+ export declare class IterationManager {
15
+ private readonly timeManager;
16
+ private readonly collisionManager;
17
+ private readonly renderManager;
18
+ private readonly inputManager;
19
+ private gameLoopAccumulator;
20
+ private physicsLoopAccumulator;
21
+ private deltaAux;
22
+ constructor(timeManager: TimeManager, collisionManager: CollisionManager, renderManager: RenderManager, inputManager: InputManager);
23
+ update(time: number): void;
24
+ private mainIteration;
25
+ private physicsIteration;
26
+ private preRenderIteration;
27
+ private renderIteration;
28
+ private dispatchFrameEvent;
29
+ }
@@ -0,0 +1,18 @@
1
+ import { Game } from "../Game";
2
+ import { Scene } from "../Scene";
3
+ import { RenderManager } from "../../rendering/RenderManager";
4
+ export declare type SceneConstructor = () => Scene;
5
+ export declare class SceneManager {
6
+ private game;
7
+ private renderManager;
8
+ private scenes;
9
+ private currentScene;
10
+ private openingSceneName;
11
+ currentSceneName: string;
12
+ constructor(game: Game, renderManager: RenderManager);
13
+ getCurrentScene<T extends Scene>(): T;
14
+ addScene(name: string, sceneConstructor: SceneConstructor, openingScene?: boolean): void;
15
+ loadOpeningScene(): void;
16
+ loadScene(name: string): void;
17
+ unloadCurrentScene(): void;
18
+ }
@@ -0,0 +1,18 @@
1
+ export declare const MIN_GAME_FRAMERATE = 15;
2
+ export declare const DEFAULT_GAME_FRAMERATE = 60;
3
+ export declare const MIN_PHYSICS_FRAMERATE = 60;
4
+ export declare const DEFAULT_PHYSICS_FRAMERATE = 240;
5
+ export declare class TimeManager {
6
+ readonly maxGameDeltatime: number;
7
+ readonly maxPhysicsDeltaTime: number;
8
+ timeScale: number;
9
+ browserDeltaTime: number;
10
+ unscaledGameDeltaTime: number;
11
+ unscaledPhysicsDeltaTime: number;
12
+ private readonly max;
13
+ private then;
14
+ constructor(gameFramerate: number, physicsFramerate: number);
15
+ update(time: number): void;
16
+ get deltaTime(): number;
17
+ get physicsDeltaTime(): number;
18
+ }
@@ -0,0 +1,17 @@
1
+ import { GameObject } from "../core/GameObject";
2
+ import { Camera } from "../component/Camera";
3
+ import { Rectangle } from "../math/Rectangle";
4
+ export declare class GameCamera extends GameObject {
5
+ readonly camera: Camera;
6
+ constructor();
7
+ set layers(layers: string[]);
8
+ get layers(): string[];
9
+ set depth(depth: number);
10
+ get depth(): number;
11
+ set zoom(zoom: number);
12
+ get zoom(): number;
13
+ get originalViewporRect(): Rectangle;
14
+ get worldSpaceRect(): Rectangle;
15
+ get viewportRect(): Rectangle;
16
+ addLayer(layer: string): void;
17
+ }
@@ -0,0 +1,8 @@
1
+ import { GameObject } from "../core/GameObject";
2
+ export declare class SpacePointer extends GameObject {
3
+ private camera;
4
+ private mousePressed;
5
+ private position;
6
+ protected start(): void;
7
+ protected update(): void;
8
+ }