excalibur 0.25.1 → 0.25.2

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 (254) hide show
  1. package/.nvmrc +1 -1
  2. package/CHANGELOG.md +119 -27
  3. package/README.md +0 -1
  4. package/build/dist/Actions/ActionsComponent.d.ts +1 -1
  5. package/build/dist/Actor.d.ts +46 -45
  6. package/build/dist/Camera.d.ts +10 -2
  7. package/build/dist/Class.d.ts +4 -5
  8. package/build/dist/Collision/BodyComponent.d.ts +6 -2
  9. package/build/dist/Collision/BoundingBox.d.ts +6 -0
  10. package/build/dist/Collision/ColliderComponent.d.ts +1 -4
  11. package/build/dist/Collision/Colliders/CircleCollider.d.ts +18 -2
  12. package/build/dist/Collision/Colliders/EdgeCollider.d.ts +1 -1
  13. package/build/dist/Collision/Colliders/SeparatingAxis.d.ts +2 -2
  14. package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.d.ts +4 -4
  15. package/build/dist/Collision/Detection/Pair.d.ts +5 -1
  16. package/build/dist/Collision/Group/CollisionGroup.d.ts +0 -1
  17. package/build/dist/Collision/MotionSystem.d.ts +4 -0
  18. package/build/dist/Collision/Solver/ContactConstraintPoint.d.ts +1 -1
  19. package/build/dist/Collision/Solver/Solver.d.ts +1 -1
  20. package/build/dist/Debug/Debug.d.ts +18 -1
  21. package/build/dist/Debug/DebugFlags.d.ts +16 -3
  22. package/build/dist/Engine.d.ts +66 -8
  23. package/build/dist/EntityComponentSystem/Component.d.ts +3 -3
  24. package/build/dist/EntityComponentSystem/Components/MotionComponent.d.ts +2 -2
  25. package/build/dist/EntityComponentSystem/Entity.d.ts +4 -4
  26. package/build/dist/EntityComponentSystem/System.d.ts +1 -1
  27. package/build/dist/EntityComponentSystem/SystemManager.d.ts +6 -1
  28. package/build/dist/EventDispatcher.d.ts +0 -5
  29. package/build/dist/Events/ExEvent.d.ts +6 -0
  30. package/build/dist/Events/PointerEvents.d.ts +37 -0
  31. package/build/dist/Graphics/Animation.d.ts +3 -2
  32. package/build/dist/Graphics/Circle.d.ts +2 -0
  33. package/build/dist/Graphics/Context/ExcaliburGraphicsContext.d.ts +37 -5
  34. package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.d.ts +12 -2
  35. package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +29 -13
  36. package/build/dist/Graphics/Context/circle-renderer/circle-renderer.d.ts +22 -0
  37. package/build/dist/Graphics/Context/circle-renderer/circle-renderer.frag.glsl +53 -0
  38. package/build/dist/Graphics/Context/circle-renderer/circle-renderer.vert.glsl +37 -0
  39. package/build/dist/Graphics/Context/image-renderer/image-renderer.d.ts +27 -0
  40. package/build/dist/Graphics/Context/image-renderer/image-renderer.frag.glsl +28 -0
  41. package/build/dist/Graphics/Context/{shaders/image-vertex.glsl → image-renderer/image-renderer.vert.glsl} +2 -7
  42. package/build/dist/Graphics/Context/{shaders → line-renderer}/line-fragment.glsl +0 -0
  43. package/build/dist/Graphics/Context/line-renderer/line-renderer.d.ts +21 -0
  44. package/build/dist/Graphics/Context/{shaders → line-renderer}/line-vertex.glsl +2 -2
  45. package/build/dist/Graphics/Context/{shaders → point-renderer}/point-fragment.glsl +6 -2
  46. package/build/dist/Graphics/Context/point-renderer/point-renderer.d.ts +21 -0
  47. package/build/dist/Graphics/Context/{shaders → point-renderer}/point-vertex.glsl +2 -2
  48. package/build/dist/Graphics/Context/quad-index-buffer.d.ts +36 -0
  49. package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.d.ts +23 -0
  50. package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.frag.glsl +85 -0
  51. package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.vert.glsl +42 -0
  52. package/build/dist/Graphics/Context/render-source.d.ts +7 -0
  53. package/build/dist/Graphics/Context/render-target.d.ts +26 -0
  54. package/build/dist/Graphics/Context/renderer.d.ts +20 -51
  55. package/build/dist/Graphics/Context/screen-pass-painter/screen-fragment.glsl +11 -0
  56. package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.d.ts +13 -0
  57. package/build/dist/Graphics/Context/screen-pass-painter/screen-vertex.glsl +11 -0
  58. package/build/dist/Graphics/Context/shader.d.ts +116 -42
  59. package/build/dist/Graphics/Context/shaders/crt-effect.glsl +64 -0
  60. package/build/dist/Graphics/Context/shaders/grayscale-fragment.glsl +13 -0
  61. package/build/dist/Graphics/Context/shaders/invert-fragment.glsl +12 -0
  62. package/build/dist/Graphics/Context/texture-loader.d.ts +8 -2
  63. package/build/dist/Graphics/Context/vertex-buffer.d.ts +49 -0
  64. package/build/dist/Graphics/Context/vertex-layout.d.ts +52 -0
  65. package/build/dist/Graphics/Context/webgl-adapter.d.ts +9 -0
  66. package/build/dist/Graphics/Context/webgl-util.d.ts +22 -0
  67. package/build/dist/Graphics/DebugGraphicsComponent.d.ts +13 -0
  68. package/build/dist/Graphics/Filtering.d.ts +15 -0
  69. package/build/dist/Graphics/Font.d.ts +61 -23
  70. package/build/dist/Graphics/FontCommon.d.ts +43 -2
  71. package/build/dist/Graphics/Graphic.d.ts +23 -9
  72. package/build/dist/Graphics/GraphicsSystem.d.ts +0 -1
  73. package/build/dist/Graphics/ImageSource.d.ts +8 -3
  74. package/build/dist/Graphics/Polygon.d.ts +2 -0
  75. package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.d.ts +5 -0
  76. package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.d.ts +17 -0
  77. package/build/dist/Graphics/PostProcessor/PostProcessor.d.ts +7 -0
  78. package/build/dist/Graphics/PostProcessor/ScreenShader.d.ts +16 -0
  79. package/build/dist/Graphics/PostProcessor/color-blind-fragment.glsl +62 -0
  80. package/build/dist/Graphics/Raster.d.ts +32 -5
  81. package/build/dist/Graphics/Sprite.d.ts +5 -0
  82. package/build/dist/Graphics/SpriteFont.d.ts +6 -7
  83. package/build/dist/Graphics/SpriteSheet.d.ts +1 -2
  84. package/build/dist/Graphics/Text.d.ts +18 -2
  85. package/build/dist/Graphics/index.d.ts +14 -0
  86. package/build/dist/Id.d.ts +1 -1
  87. package/build/dist/Input/EngineInput.d.ts +2 -2
  88. package/build/dist/Input/Index.d.ts +10 -3
  89. package/build/dist/Input/NativePointerButton.d.ts +10 -0
  90. package/build/dist/Input/PointerAbstraction.d.ts +33 -0
  91. package/build/dist/Input/PointerButton.d.ts +10 -0
  92. package/build/dist/Input/PointerComponent.d.ts +24 -0
  93. package/build/dist/Input/PointerEvent.d.ts +18 -0
  94. package/build/dist/Input/PointerEventReceiver.d.ts +114 -0
  95. package/build/dist/Input/PointerScope.d.ts +14 -0
  96. package/build/dist/Input/PointerSystem.d.ts +43 -0
  97. package/build/dist/Input/PointerType.d.ts +9 -0
  98. package/build/dist/Input/WheelDeltaMode.d.ts +5 -0
  99. package/build/dist/Input/WheelEvent.d.ts +18 -0
  100. package/build/dist/Interfaces/PointerEventHandlers.d.ts +17 -16
  101. package/build/dist/Label.d.ts +9 -2
  102. package/build/dist/Loader.d.ts +5 -2
  103. package/build/dist/Math/Index.d.ts +1 -0
  104. package/build/dist/Math/matrix.d.ts +19 -1
  105. package/build/dist/Math/util.d.ts +45 -0
  106. package/build/dist/Particles.d.ts +12 -0
  107. package/build/dist/Resources/Gif.d.ts +1 -1
  108. package/build/dist/Scene.d.ts +10 -1
  109. package/build/dist/Screen.d.ts +4 -3
  110. package/build/dist/TileMap.d.ts +3 -2
  111. package/build/dist/Traits/Index.d.ts +0 -1
  112. package/build/dist/Trigger.d.ts +4 -0
  113. package/build/dist/Util/Clock.d.ts +118 -0
  114. package/build/dist/Util/Fps.d.ts +40 -0
  115. package/build/dist/Util/Observable.d.ts +1 -1
  116. package/build/dist/Util/Pool.d.ts +2 -10
  117. package/build/dist/Util/Util.d.ts +23 -66
  118. package/build/dist/excalibur.js +9124 -7580
  119. package/build/dist/excalibur.js.map +1 -1
  120. package/build/dist/excalibur.min.js +1 -1
  121. package/build/dist/excalibur.min.js.LICENSE.txt +2 -2
  122. package/build/dist/excalibur.min.js.map +1 -1
  123. package/build/dist/index.d.ts +5 -2
  124. package/build/esm/Actions/ActionsComponent.d.ts +1 -1
  125. package/build/esm/Actor.d.ts +46 -45
  126. package/build/esm/Camera.d.ts +10 -2
  127. package/build/esm/Class.d.ts +4 -5
  128. package/build/esm/Collision/BodyComponent.d.ts +6 -2
  129. package/build/esm/Collision/BoundingBox.d.ts +6 -0
  130. package/build/esm/Collision/ColliderComponent.d.ts +1 -4
  131. package/build/esm/Collision/Colliders/CircleCollider.d.ts +18 -2
  132. package/build/esm/Collision/Colliders/EdgeCollider.d.ts +1 -1
  133. package/build/esm/Collision/Colliders/SeparatingAxis.d.ts +2 -2
  134. package/build/esm/Collision/Detection/DynamicTreeCollisionProcessor.d.ts +4 -4
  135. package/build/esm/Collision/Detection/Pair.d.ts +5 -1
  136. package/build/esm/Collision/Group/CollisionGroup.d.ts +0 -1
  137. package/build/esm/Collision/MotionSystem.d.ts +4 -0
  138. package/build/esm/Collision/Solver/ContactConstraintPoint.d.ts +1 -1
  139. package/build/esm/Collision/Solver/Solver.d.ts +1 -1
  140. package/build/esm/Debug/Debug.d.ts +18 -1
  141. package/build/esm/Debug/DebugFlags.d.ts +16 -3
  142. package/build/esm/Engine.d.ts +66 -8
  143. package/build/esm/EntityComponentSystem/Component.d.ts +3 -3
  144. package/build/esm/EntityComponentSystem/Components/MotionComponent.d.ts +2 -2
  145. package/build/esm/EntityComponentSystem/Entity.d.ts +4 -4
  146. package/build/esm/EntityComponentSystem/System.d.ts +1 -1
  147. package/build/esm/EntityComponentSystem/SystemManager.d.ts +6 -1
  148. package/build/esm/EventDispatcher.d.ts +0 -5
  149. package/build/esm/Events/ExEvent.d.ts +6 -0
  150. package/build/esm/Events/PointerEvents.d.ts +37 -0
  151. package/build/esm/Graphics/Animation.d.ts +3 -2
  152. package/build/esm/Graphics/Circle.d.ts +2 -0
  153. package/build/esm/Graphics/Context/ExcaliburGraphicsContext.d.ts +37 -5
  154. package/build/esm/Graphics/Context/ExcaliburGraphicsContext2DCanvas.d.ts +12 -2
  155. package/build/esm/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +29 -13
  156. package/build/esm/Graphics/Context/circle-renderer/circle-renderer.d.ts +22 -0
  157. package/build/esm/Graphics/Context/image-renderer/image-renderer.d.ts +27 -0
  158. package/build/esm/Graphics/Context/line-renderer/line-renderer.d.ts +21 -0
  159. package/build/esm/Graphics/Context/point-renderer/point-renderer.d.ts +21 -0
  160. package/build/esm/Graphics/Context/quad-index-buffer.d.ts +36 -0
  161. package/build/esm/Graphics/Context/rectangle-renderer/rectangle-renderer.d.ts +23 -0
  162. package/build/esm/Graphics/Context/render-source.d.ts +7 -0
  163. package/build/esm/Graphics/Context/render-target.d.ts +26 -0
  164. package/build/esm/Graphics/Context/renderer.d.ts +20 -51
  165. package/build/esm/Graphics/Context/screen-pass-painter/screen-pass-painter.d.ts +13 -0
  166. package/build/esm/Graphics/Context/shader.d.ts +116 -42
  167. package/build/esm/Graphics/Context/texture-loader.d.ts +8 -2
  168. package/build/esm/Graphics/Context/vertex-buffer.d.ts +49 -0
  169. package/build/esm/Graphics/Context/vertex-layout.d.ts +52 -0
  170. package/build/esm/Graphics/Context/webgl-adapter.d.ts +9 -0
  171. package/build/esm/Graphics/Context/webgl-util.d.ts +22 -0
  172. package/build/esm/Graphics/DebugGraphicsComponent.d.ts +13 -0
  173. package/build/esm/Graphics/Filtering.d.ts +15 -0
  174. package/build/esm/Graphics/Font.d.ts +61 -23
  175. package/build/esm/Graphics/FontCommon.d.ts +43 -2
  176. package/build/esm/Graphics/Graphic.d.ts +23 -9
  177. package/build/esm/Graphics/GraphicsSystem.d.ts +0 -1
  178. package/build/esm/Graphics/ImageSource.d.ts +8 -3
  179. package/build/esm/Graphics/Polygon.d.ts +2 -0
  180. package/build/esm/Graphics/PostProcessor/ColorBlindnessMode.d.ts +5 -0
  181. package/build/esm/Graphics/PostProcessor/ColorBlindnessPostProcessor.d.ts +17 -0
  182. package/build/esm/Graphics/PostProcessor/PostProcessor.d.ts +7 -0
  183. package/build/esm/Graphics/PostProcessor/ScreenShader.d.ts +16 -0
  184. package/build/esm/Graphics/Raster.d.ts +32 -5
  185. package/build/esm/Graphics/Sprite.d.ts +5 -0
  186. package/build/esm/Graphics/SpriteFont.d.ts +6 -7
  187. package/build/esm/Graphics/SpriteSheet.d.ts +1 -2
  188. package/build/esm/Graphics/Text.d.ts +18 -2
  189. package/build/esm/Graphics/index.d.ts +14 -0
  190. package/build/esm/Id.d.ts +1 -1
  191. package/build/esm/Input/EngineInput.d.ts +2 -2
  192. package/build/esm/Input/Index.d.ts +10 -3
  193. package/build/esm/Input/NativePointerButton.d.ts +10 -0
  194. package/build/esm/Input/PointerAbstraction.d.ts +33 -0
  195. package/build/esm/Input/PointerButton.d.ts +10 -0
  196. package/build/esm/Input/PointerComponent.d.ts +24 -0
  197. package/build/esm/Input/PointerEvent.d.ts +18 -0
  198. package/build/esm/Input/PointerEventReceiver.d.ts +114 -0
  199. package/build/esm/Input/PointerScope.d.ts +14 -0
  200. package/build/esm/Input/PointerSystem.d.ts +43 -0
  201. package/build/esm/Input/PointerType.d.ts +9 -0
  202. package/build/esm/Input/WheelDeltaMode.d.ts +5 -0
  203. package/build/esm/Input/WheelEvent.d.ts +18 -0
  204. package/build/esm/Interfaces/PointerEventHandlers.d.ts +17 -16
  205. package/build/esm/Label.d.ts +9 -2
  206. package/build/esm/Loader.d.ts +5 -2
  207. package/build/esm/Math/Index.d.ts +1 -0
  208. package/build/esm/Math/matrix.d.ts +19 -1
  209. package/build/esm/Math/util.d.ts +45 -0
  210. package/build/esm/Particles.d.ts +12 -0
  211. package/build/esm/Resources/Gif.d.ts +1 -1
  212. package/build/esm/Scene.d.ts +10 -1
  213. package/build/esm/Screen.d.ts +4 -3
  214. package/build/esm/TileMap.d.ts +3 -2
  215. package/build/esm/Traits/Index.d.ts +0 -1
  216. package/build/esm/Trigger.d.ts +4 -0
  217. package/build/esm/Util/Clock.d.ts +118 -0
  218. package/build/esm/Util/Fps.d.ts +40 -0
  219. package/build/esm/Util/Observable.d.ts +1 -1
  220. package/build/esm/Util/Pool.d.ts +2 -10
  221. package/build/esm/Util/Util.d.ts +23 -66
  222. package/build/esm/excalibur.js +9001 -7438
  223. package/build/esm/excalibur.js.map +1 -1
  224. package/build/esm/excalibur.min.js +1 -1
  225. package/build/esm/excalibur.min.js.LICENSE.txt +2 -2
  226. package/build/esm/excalibur.min.js.map +1 -1
  227. package/build/esm/index.d.ts +5 -2
  228. package/package.json +31 -27
  229. package/build/dist/Graphics/Context/batch.d.ts +0 -11
  230. package/build/dist/Graphics/Context/draw-image-command.d.ts +0 -47
  231. package/build/dist/Graphics/Context/image-renderer.d.ts +0 -39
  232. package/build/dist/Graphics/Context/line-renderer.d.ts +0 -22
  233. package/build/dist/Graphics/Context/point-renderer.d.ts +0 -22
  234. package/build/dist/Graphics/Context/shaders/image-fragment.glsl +0 -48
  235. package/build/dist/Input/Pointer.d.ts +0 -134
  236. package/build/dist/Input/PointerEvents.d.ts +0 -170
  237. package/build/dist/Input/Pointers.d.ts +0 -78
  238. package/build/dist/PostProcessing/ColorBlindCorrector.d.ts +0 -28
  239. package/build/dist/PostProcessing/Index.d.ts +0 -2
  240. package/build/dist/PostProcessing/PostProcessor.d.ts +0 -6
  241. package/build/dist/Traits/CapturePointer.d.ts +0 -10
  242. package/build/esm/Graphics/Context/batch.d.ts +0 -11
  243. package/build/esm/Graphics/Context/draw-image-command.d.ts +0 -47
  244. package/build/esm/Graphics/Context/image-renderer.d.ts +0 -39
  245. package/build/esm/Graphics/Context/line-renderer.d.ts +0 -22
  246. package/build/esm/Graphics/Context/point-renderer.d.ts +0 -22
  247. package/build/esm/Input/Pointer.d.ts +0 -134
  248. package/build/esm/Input/PointerEvents.d.ts +0 -170
  249. package/build/esm/Input/Pointers.d.ts +0 -78
  250. package/build/esm/PostProcessing/ColorBlindCorrector.d.ts +0 -28
  251. package/build/esm/PostProcessing/Index.d.ts +0 -2
  252. package/build/esm/PostProcessing/PostProcessor.d.ts +0 -6
  253. package/build/esm/Traits/CapturePointer.d.ts +0 -10
  254. package/wallaby.js +0 -77
@@ -55,6 +55,7 @@ export declare class Scene extends Class implements CanInitialize, CanActivate,
55
55
  get screenElements(): ScreenElement[];
56
56
  private _isInitialized;
57
57
  private _timers;
58
+ get timers(): readonly Timer[];
58
59
  private _cancelQueue;
59
60
  constructor();
60
61
  on(eventName: Events.initialize, handler: (event: InitializeEvent<Scene>) => void): void;
@@ -118,12 +119,16 @@ export declare class Scene extends Class implements CanInitialize, CanActivate,
118
119
  * Safe to override onPreDraw lifecycle event handler. Synonymous with `.on('preupdate', (evt) =>{...})`
119
120
  *
120
121
  * `onPreDraw` is called directly before a scene is drawn.
122
+ *
123
+ * @deprecated Signature will change in v0.26.0
121
124
  */
122
125
  onPreDraw(_ctx: CanvasRenderingContext2D, _delta: number): void;
123
126
  /**
124
127
  * Safe to override onPostDraw lifecycle event handler. Synonymous with `.on('preupdate', (evt) =>{...})`
125
128
  *
126
129
  * `onPostDraw` is called directly after a scene is drawn.
130
+ *
131
+ * @deprecated Signature will change in v0.26.0
127
132
  */
128
133
  onPostDraw(_ctx: CanvasRenderingContext2D, _delta: number): void;
129
134
  /**
@@ -175,6 +180,7 @@ export declare class Scene extends Class implements CanInitialize, CanActivate,
175
180
  *
176
181
  * Internal _predraw handler for [[onPreDraw]] lifecycle event
177
182
  *
183
+ * @deprecated Signature will change in v0.26.0
178
184
  * @internal
179
185
  */
180
186
  _predraw(_ctx: CanvasRenderingContext2D, _delta: number): void;
@@ -183,6 +189,7 @@ export declare class Scene extends Class implements CanInitialize, CanActivate,
183
189
  *
184
190
  * Internal _postdraw handler for [[onPostDraw]] lifecycle event
185
191
  *
192
+ * @deprecated Signature will change in v0.26.0
186
193
  * @internal
187
194
  */
188
195
  _postdraw(_ctx: CanvasRenderingContext2D, _delta: number): void;
@@ -194,6 +201,8 @@ export declare class Scene extends Class implements CanInitialize, CanActivate,
194
201
  update(engine: Engine, delta: number): void;
195
202
  /**
196
203
  * Draws all the actors in the Scene. Called by the [[Engine]].
204
+ *
205
+ * @deprecated Signature will change in v0.26.0
197
206
  * @param ctx The current rendering context
198
207
  * @param delta The number of milliseconds since the last draw
199
208
  */
@@ -201,7 +210,7 @@ export declare class Scene extends Class implements CanInitialize, CanActivate,
201
210
  /**
202
211
  * Draws all the actors' debug information in the Scene. Called by the [[Engine]].
203
212
  * @param ctx The current rendering context
204
- * @deprecated
213
+ * @deprecated Signature will change in v0.26.0
205
214
  */
206
215
  debugDraw(ctx: CanvasRenderingContext2D): void;
207
216
  /**
@@ -136,8 +136,8 @@ export interface ScreenOptions {
136
136
  * The Screen handles all aspects of interacting with the screen for Excalibur.
137
137
  */
138
138
  export declare class Screen {
139
+ graphicsContext: ExcaliburGraphicsContext;
139
140
  private _canvas;
140
- private _ctx;
141
141
  private _antialiasing;
142
142
  private _browser;
143
143
  private _camera;
@@ -154,6 +154,7 @@ export declare class Screen {
154
154
  private _logger;
155
155
  private _resizeObserver;
156
156
  constructor(options: ScreenOptions);
157
+ private _listenForPixelRatio;
157
158
  dispose(): void;
158
159
  private _fullscreenChangeHandler;
159
160
  private _pixelRatioChangeHandler;
@@ -182,7 +183,7 @@ export declare class Screen {
182
183
  get antialiasing(): boolean;
183
184
  set antialiasing(isSmooth: boolean);
184
185
  /**
185
- * Returns true if excalibur is fullscreened using the browser fullscreen api
186
+ * Returns true if excalibur is fullscreen using the browser fullscreen api
186
187
  */
187
188
  get isFullScreen(): boolean;
188
189
  /**
@@ -278,7 +279,7 @@ export declare class Screen {
278
279
  private _computeFitContainer;
279
280
  private _applyDisplayMode;
280
281
  /**
281
- * Sets the resoultion and viewport based on the selected display mode.
282
+ * Sets the resolution and viewport based on the selected display mode.
282
283
  */
283
284
  private _setResolutionAndViewportByDisplayMode;
284
285
  private _initializeDisplayModePosition;
@@ -100,6 +100,7 @@ export declare class TileMapImpl extends Entity {
100
100
  * @param delta The number of milliseconds since the last draw
101
101
  */
102
102
  draw(ctx: CanvasRenderingContext2D | ExcaliburGraphicsContext, delta: number): void;
103
+ debug(gfx: ExcaliburGraphicsContext): void;
103
104
  }
104
105
  export interface TileMapArgs extends Partial<TileMapImpl> {
105
106
  x: number;
@@ -161,7 +162,7 @@ export declare class CellImpl extends Entity {
161
162
  */
162
163
  readonly graphics: Graphics.Graphic[];
163
164
  /**
164
- * Abitrary data storage per cell, useful for any game specific data
165
+ * Arbitrary data storage per cell, useful for any game specific data
165
166
  */
166
167
  data: Map<string, any>;
167
168
  /**
@@ -191,7 +192,7 @@ export declare class CellImpl extends Entity {
191
192
  */
192
193
  removeGraphic(graphic: Graphics.Graphic | LegacySprite): void;
193
194
  /**
194
- * Clear all graphis from this cell
195
+ * Clear all graphics from this cell
195
196
  */
196
197
  clearGraphics(): void;
197
198
  }
@@ -1,5 +1,4 @@
1
1
  /**
2
2
  * @module
3
3
  */
4
- export * from './CapturePointer';
5
4
  export * from './OffscreenCulling';
@@ -44,5 +44,9 @@ export declare class Trigger extends Actor {
44
44
  get target(): Entity;
45
45
  _initialize(engine: Engine): void;
46
46
  private _dispatchAction;
47
+ /**
48
+ * @deprecated signature will change in v0.26.0
49
+ * @param ctx
50
+ */
47
51
  debugDraw(ctx: CanvasRenderingContext2D): void;
48
52
  }
@@ -0,0 +1,118 @@
1
+ import { FpsSampler } from './Fps';
2
+ export interface ClockOptions {
3
+ /**
4
+ * Define the function you'd like the clock to tick when it is started
5
+ */
6
+ tick: (elapsedMs: number) => any;
7
+ /**
8
+ * Optionally define the fatal exception handler, used if an error is thrown in tick
9
+ */
10
+ onFatalException?: (e: unknown) => any;
11
+ /**
12
+ * Optionally limit the maximum FPS of the clock
13
+ */
14
+ maxFps?: number;
15
+ }
16
+ /**
17
+ * Abstract Clock is the base type of all Clocks
18
+ *
19
+ * It has a few opinions
20
+ * 1. It manages the calculation of what "elapsed" time means and thus maximum fps
21
+ * 2. The default timing api is implemented in now()
22
+ *
23
+ * To implement your own clock, extend Clock and override start/stop to start and stop the clock, then call update() with whatever
24
+ * method is unique to your clock implementation.
25
+ */
26
+ export declare abstract class Clock {
27
+ protected tick: (elapsedMs: number) => any;
28
+ private _onFatalException;
29
+ private _maxFps;
30
+ private _lastTime;
31
+ fpsSampler: FpsSampler;
32
+ private _options;
33
+ private _elapsed;
34
+ private _scheduledCbs;
35
+ private _totalElapsed;
36
+ constructor(options: ClockOptions);
37
+ /**
38
+ * Get the elapsed time for the last completed frame
39
+ */
40
+ elapsed(): number;
41
+ /**
42
+ * Get the current time in milliseconds
43
+ */
44
+ now(): number;
45
+ toTestClock(): TestClock;
46
+ toStandardClock(): StandardClock;
47
+ setFatalExceptionHandler(handler: (e: unknown) => any): void;
48
+ /**
49
+ * Schedule a callback to fire given a timeout in milliseconds using the excalibur [[Clock]]
50
+ *
51
+ * This is useful to use over the built in browser `setTimeout` because callbacks will be tied to the
52
+ * excalibur update clock, instead of browser time, this means that callbacks wont fire if the game is
53
+ * stopped or paused.
54
+ *
55
+ * @param cb callback to fire
56
+ * @param timeoutMs Optionally specify a timeout in milliseconds from now, default is 0ms which means the next possible tick
57
+ */
58
+ schedule(cb: () => any, timeoutMs?: number): void;
59
+ private _runScheduledCbs;
60
+ protected update(overrideUpdateMs?: number): void;
61
+ /**
62
+ * Returns if the clock is currently running
63
+ */
64
+ abstract isRunning(): boolean;
65
+ /**
66
+ * Start the clock, it will then periodically call the tick(elapsedMilliseconds) since the last tick
67
+ */
68
+ abstract start(): void;
69
+ /**
70
+ * Stop the clock, tick() is no longer called
71
+ */
72
+ abstract stop(): void;
73
+ }
74
+ /**
75
+ * The [[StandardClock]] implements the requestAnimationFrame browser api to run the tick()
76
+ */
77
+ export declare class StandardClock extends Clock {
78
+ private _running;
79
+ private _requestId;
80
+ constructor(options: ClockOptions);
81
+ isRunning(): boolean;
82
+ start(): void;
83
+ stop(): void;
84
+ }
85
+ export interface TestClockOptions {
86
+ /**
87
+ * Specify the update milliseconds to use for each manual step()
88
+ */
89
+ defaultUpdateMs: number;
90
+ }
91
+ /**
92
+ * The TestClock is meant for debugging interactions in excalibur that require precise timing to replicate or test
93
+ */
94
+ export declare class TestClock extends Clock {
95
+ private _logger;
96
+ private _updateMs;
97
+ private _running;
98
+ private _currentTime;
99
+ constructor(options: ClockOptions & TestClockOptions);
100
+ /**
101
+ * Get the current time in milliseconds
102
+ */
103
+ now(): number;
104
+ isRunning(): boolean;
105
+ start(): void;
106
+ stop(): void;
107
+ /**
108
+ * Manually step the clock forward 1 tick, optionally specify an elapsed time in milliseconds
109
+ * @param overrideUpdateMs
110
+ */
111
+ step(overrideUpdateMs?: number): void;
112
+ /**
113
+ * Run a number of steps that tick the clock, optionally specify an elapsed time in milliseconds
114
+ * @param numberOfSteps
115
+ * @param overrideUpdateMs
116
+ */
117
+ run(numberOfSteps: number, overrideUpdateMs?: number): void;
118
+ }
@@ -0,0 +1,40 @@
1
+ export interface FpsSamplerOptions {
2
+ /**
3
+ * Specify the sampling period in milliseconds (default 100)
4
+ */
5
+ samplePeriod?: number;
6
+ /**
7
+ * Specify the initial FPS
8
+ */
9
+ initialFps: number;
10
+ /**
11
+ * Specify the function used to return the current time (in milliseconds)
12
+ */
13
+ nowFn: () => number;
14
+ }
15
+ export declare class FpsSampler {
16
+ private _fps;
17
+ private _samplePeriod;
18
+ private _currentFrameTime;
19
+ private _frames;
20
+ private _previousSampleTime;
21
+ private _beginFrameTime;
22
+ private _nowFn;
23
+ constructor(options: FpsSamplerOptions);
24
+ /**
25
+ * Start of code block to sample FPS for
26
+ */
27
+ start(): void;
28
+ /**
29
+ * End of code block to sample FPS for
30
+ */
31
+ end(): void;
32
+ /**
33
+ * Return the currently sampled fps over the last sample period, by default every 100ms
34
+ */
35
+ get fps(): number;
36
+ /**
37
+ * Return the instantaneous fps, this can be less useful because it will fluctuate given the current frames time
38
+ */
39
+ get instant(): number;
40
+ }
@@ -17,7 +17,7 @@ export interface Observer<T> {
17
17
  */
18
18
  export declare type MaybeObserver<T> = Partial<Observer<T>>;
19
19
  /**
20
- * Simple Observable implemenation
20
+ * Simple Observable implementation
21
21
  * @template T is the typescript Type that defines the data being observed
22
22
  */
23
23
  export declare class Observable<T> {
@@ -1,12 +1,4 @@
1
- export interface Poolable {
2
- /**
3
- * Any type that is a member of a an object pool will have a reference to teh pool
4
- * @internal
5
- */
6
- _pool?: Pool<this>;
7
- dispose(): this;
8
- }
9
- export declare class Pool<Type extends Poolable> {
1
+ export declare class Pool<Type> {
10
2
  builder: (...args: any[]) => Type;
11
3
  recycler: (instance: Type, ...args: any[]) => Type;
12
4
  maxObjects: number;
@@ -18,7 +10,7 @@ export declare class Pool<Type extends Poolable> {
18
10
  /**
19
11
  * Use many instances out of the in the context and return all to the pool.
20
12
  *
21
- * By returning values out of the contex they will be un-hooked from the pool and are free to be passed to consumers
13
+ * By returning values out of the context they will be un-hooked from the pool and are free to be passed to consumers
22
14
  * @param context
23
15
  */
24
16
  using(context: (pool: Pool<Type>) => Type[] | void): Type[];
@@ -1,79 +1,39 @@
1
1
  import { Vector } from '../Math/vector';
2
- import { Random } from '../Math/Random';
3
2
  import { Side } from '../Collision/Side';
3
+ import { Clock } from './Clock';
4
+ import { clamp as lclamp, randomInRange as lrandomInRange, randomIntInRange as lrandomIntInRange, canonicalizeAngle as lcanonicalizeAngle, toDegrees as ltoDegrees, toRadians as ltoRadians } from '../Math/util';
4
5
  /**
5
- * Two PI constant
6
+ * @deprecated ex.Util.TwoPI import site will be removed in v0.26.0, use ex.TwoPI
6
7
  */
7
8
  export declare const TwoPI: number;
8
9
  /**
9
- * Merges one or more objects into a single target object
10
- *
11
- * @param deep Whether or not to do a deep clone
12
- * @param target The target object to attach properties on
13
- * @param objects The objects whose properties to merge
14
- * @returns Merged object with properties from other objects
15
- */
16
- export declare function extend(deep: boolean, target: any, ...objects: any[]): any;
17
- /**
18
- * Merges one or more objects into a single target object
19
- *
20
- * @param target The target object to attach properties on
21
- * @param object2 The second object whose properties to merge
22
- * @returns Merged object with properties from other objects
23
- */
24
- export declare function extend<T1, T2>(target: T1, object2: T2): T1 & T2;
25
- /**
26
- * Merges one or more objects into a single target object
27
- *
28
- * @param target The target object to attach properties on
29
- * @param object2 The second object whose properties to merge
30
- * @param object3 The third object whose properties to merge
31
- * @returns Merged object with properties from other objects
32
- */
33
- export declare function extend<T1, T2, T3>(target: T1, object2: T2, object3: T3): T1 & T2 & T3;
34
- /**
35
- * Merges one or more objects into a single target object
36
- *
37
- * @param target The target object to attach properties on
38
- * @param objects The objects whose properties to merge
39
- * @returns Merged object with properties from other objects
10
+ * @deprecated ex.Util.clamp import site will be removed in v0.26.0, use ex.clamp
40
11
  */
41
- export declare function extend(target: any, ...objects: any[]): any;
12
+ export declare const clamp: typeof lclamp;
42
13
  /**
43
- * Encode a string in base64
44
- * @deprecated This will be removed in v0.26.0
14
+ * @deprecated ex.Util.randomInRange import site will be removed in v0.26.0, use ex.randomInRange
45
15
  */
46
- export declare function base64Encode(inputStr: string): string;
16
+ export declare const randomInRange: typeof lrandomInRange;
47
17
  /**
48
- * Sugar that will use `nullishVal` if it's not null or undefined. Simulates the `??` operator
49
- * @param nullishVal
50
- * @param defaultVal
18
+ * @deprecated ex.Util.randomIntInRange import site will be removed in v0.26.0, use ex.randomIntInRange
51
19
  */
52
- export declare function nullish<T>(nullishVal: T | undefined | null, defaultVal: T): T;
20
+ export declare const randomIntInRange: typeof lrandomIntInRange;
53
21
  /**
54
- * Clamps a value between a min and max inclusive
22
+ * @deprecated ex.Util.canonicalizeAngle import site will be removed in v0.26.0, use ex.canonicalizeAngle
55
23
  */
56
- export declare function clamp(val: number, min: number, max: number): number;
24
+ export declare const canonicalizeAngle: typeof lcanonicalizeAngle;
57
25
  /**
58
- * Find a random floating point number in range
26
+ * @deprecated ex.Util.toDegrees import site will be removed in v0.26.0, use ex.toDegrees
59
27
  */
60
- export declare function randomInRange(min: number, max: number, random?: Random): number;
28
+ export declare const toDegrees: typeof ltoDegrees;
61
29
  /**
62
- * Find a random integer in a range
30
+ * @deprecated ex.Util.toRadians import site will be removed in v0.26.0, use ex.toRadians
63
31
  */
64
- export declare function randomIntInRange(min: number, max: number, random?: Random): number;
32
+ export declare const toRadians: typeof ltoRadians;
65
33
  /**
66
- * Convert an angle to be the equivalent in the range [0, 2PI]
34
+ * @deprecated ex.Util.range import site will be removed in v0.26.0, use ex.range
67
35
  */
68
- export declare function canonicalizeAngle(angle: number): number;
69
- /**
70
- * Convert radians to degrees
71
- */
72
- export declare function toDegrees(radians: number): number;
73
- /**
74
- * Convert degrees to radians
75
- */
76
- export declare function toRadians(degrees: number): number;
36
+ export declare const range: (from: number, to: number) => number[];
77
37
  /**
78
38
  * Find the screen position of an HTML element
79
39
  */
@@ -93,7 +53,7 @@ export declare function removeItemFromArray<T>(item: T, array: T[]): boolean;
93
53
  */
94
54
  export declare function contains(array: Array<any>, obj: any): boolean;
95
55
  /**
96
- * Get the opposit side
56
+ * Get the opposite side
97
57
  * TODO: Move to Side type
98
58
  * @deprecated Will be removed in v0.26.0
99
59
  */
@@ -182,15 +142,12 @@ export declare class Collection<T> {
182
142
  * Used for exhaustive checks at compile time
183
143
  */
184
144
  export declare function fail(message: never): never;
185
- /**
186
- * Generate a range of numbers
187
- * For example: range(0, 5) -> [0, 1, 2, 3, 4, 5]
188
- * @param from inclusive
189
- * @param to inclusive
190
- */
191
- export declare const range: (from: number, to: number) => number[];
192
145
  /**
193
146
  * Create a promise that resolves after a certain number of milliseconds
147
+ *
148
+ * It is strongly recommended you pass the excalibur clock so delays are bound to the
149
+ * excalibur clock which would be unaffected by stop/pause.
194
150
  * @param milliseconds
151
+ * @param clock
195
152
  */
196
- export declare function delay(milliseconds: number): Promise<void>;
153
+ export declare function delay(milliseconds: number, clock?: Clock): Promise<void>;