excalibur 0.28.3 → 0.28.4

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 (482) hide show
  1. package/.gitattributes +63 -63
  2. package/CHANGELOG.md +2003 -1955
  3. package/LICENSE.md +25 -25
  4. package/README.md +134 -134
  5. package/STYLEGUIDE.md +136 -136
  6. package/build/dist/Actions/Action/ActionSequence.js +31 -0
  7. package/build/dist/Actions/Action/ActionSequence.js.map +1 -0
  8. package/build/dist/Actions/Action/Blink.js +54 -0
  9. package/build/dist/Actions/Action/Blink.js.map +1 -0
  10. package/build/dist/Actions/Action/CallMethod.js +21 -0
  11. package/build/dist/Actions/Action/CallMethod.js.map +1 -0
  12. package/build/dist/Actions/Action/Delay.js +26 -0
  13. package/build/dist/Actions/Action/Delay.js.map +1 -0
  14. package/build/dist/Actions/Action/Die.js +22 -0
  15. package/build/dist/Actions/Action/Die.js.map +1 -0
  16. package/build/dist/Actions/Action/EaseBy.js +70 -0
  17. package/build/dist/Actions/Action/EaseBy.js.map +1 -0
  18. package/build/dist/Actions/Action/EaseTo.js +69 -0
  19. package/build/dist/Actions/Action/EaseTo.js.map +1 -0
  20. package/build/dist/Actions/Action/Fade.js +48 -0
  21. package/build/dist/Actions/Action/Fade.js.map +1 -0
  22. package/build/dist/Actions/Action/Follow.js +56 -0
  23. package/build/dist/Actions/Action/Follow.js.map +1 -0
  24. package/build/dist/Actions/Action/Meet.js +54 -0
  25. package/build/dist/Actions/Action/Meet.js.map +1 -0
  26. package/build/dist/Actions/Action/MoveBy.js +48 -0
  27. package/build/dist/Actions/Action/MoveBy.js.map +1 -0
  28. package/build/dist/Actions/Action/MoveTo.js +41 -0
  29. package/build/dist/Actions/Action/MoveTo.js.map +1 -0
  30. package/build/dist/Actions/Action/ParallelActions.js +23 -0
  31. package/build/dist/Actions/Action/ParallelActions.js.map +1 -0
  32. package/build/dist/Actions/Action/Repeat.js +31 -0
  33. package/build/dist/Actions/Action/Repeat.js.map +1 -0
  34. package/build/dist/Actions/Action/RepeatForever.js +37 -0
  35. package/build/dist/Actions/Action/RepeatForever.js.map +1 -0
  36. package/build/dist/Actions/Action/RotateBy.js +95 -0
  37. package/build/dist/Actions/Action/RotateBy.js.map +1 -0
  38. package/build/dist/Actions/Action/RotateTo.js +91 -0
  39. package/build/dist/Actions/Action/RotateTo.js.map +1 -0
  40. package/build/dist/Actions/Action/ScaleBy.js +46 -0
  41. package/build/dist/Actions/Action/ScaleBy.js.map +1 -0
  42. package/build/dist/Actions/Action/ScaleTo.js +58 -0
  43. package/build/dist/Actions/Action/ScaleTo.js.map +1 -0
  44. package/build/dist/Actions/Action.js +2 -0
  45. package/build/dist/Actions/Action.js.map +1 -0
  46. package/build/dist/Actions/ActionContext.js +322 -0
  47. package/build/dist/Actions/ActionContext.js.map +1 -0
  48. package/build/dist/Actions/ActionQueue.js +87 -0
  49. package/build/dist/Actions/ActionQueue.js.map +1 -0
  50. package/build/dist/Actions/Actionable.js +2 -0
  51. package/build/dist/Actions/Actionable.js.map +1 -0
  52. package/build/dist/Actions/ActionsComponent.js +195 -0
  53. package/build/dist/Actions/ActionsComponent.js.map +1 -0
  54. package/build/dist/Actions/ActionsSystem.js +30 -0
  55. package/build/dist/Actions/ActionsSystem.js.map +1 -0
  56. package/build/dist/Actions/Index.js +26 -0
  57. package/build/dist/Actions/Index.js.map +1 -0
  58. package/build/dist/Actions/RotationType.js +27 -0
  59. package/build/dist/Actions/RotationType.js.map +1 -0
  60. package/build/dist/Actor.js +629 -0
  61. package/build/dist/Actor.js.map +1 -0
  62. package/build/dist/Camera.js +660 -0
  63. package/build/dist/Camera.js.map +1 -0
  64. package/build/dist/Collision/BoundingBox.js +415 -0
  65. package/build/dist/Collision/BoundingBox.js.map +1 -0
  66. package/build/dist/Collision/ColliderComponent.js +202 -0
  67. package/build/dist/Collision/ColliderComponent.js.map +1 -0
  68. package/build/dist/Collision/Colliders/CircleCollider.js +226 -0
  69. package/build/dist/Collision/Colliders/CircleCollider.js.map +1 -0
  70. package/build/dist/Collision/Colliders/ClosestLineJumpTable.js +211 -0
  71. package/build/dist/Collision/Colliders/ClosestLineJumpTable.js.map +1 -0
  72. package/build/dist/Collision/Colliders/Collider.js +32 -0
  73. package/build/dist/Collision/Colliders/Collider.js.map +1 -0
  74. package/build/dist/Collision/Colliders/CollisionJumpTable.js +300 -0
  75. package/build/dist/Collision/Colliders/CollisionJumpTable.js.map +1 -0
  76. package/build/dist/Collision/Colliders/EdgeCollider.js +229 -0
  77. package/build/dist/Collision/Colliders/EdgeCollider.js.map +1 -0
  78. package/build/dist/Collision/Colliders/PolygonCollider.js +556 -0
  79. package/build/dist/Collision/Colliders/PolygonCollider.js.map +1 -0
  80. package/build/dist/Collision/Colliders/SeparatingAxis.js +67 -0
  81. package/build/dist/Collision/Colliders/SeparatingAxis.js.map +1 -0
  82. package/build/dist/Collision/Colliders/Shape.js +99 -0
  83. package/build/dist/Collision/Colliders/Shape.js.map +1 -0
  84. package/build/dist/Collision/CollisionType.js +33 -0
  85. package/build/dist/Collision/CollisionType.js.map +1 -0
  86. package/build/dist/Collision/Detection/CollisionContact.js +51 -0
  87. package/build/dist/Collision/Detection/CollisionContact.js.map +1 -0
  88. package/build/dist/Collision/Detection/CollisionProcessor.js +2 -0
  89. package/build/dist/Collision/Detection/CollisionProcessor.js.map +1 -0
  90. package/build/dist/Collision/Detection/DynamicTree.js +442 -0
  91. package/build/dist/Collision/Detection/DynamicTree.js.map +1 -0
  92. package/build/dist/Collision/Detection/Pair.js +92 -0
  93. package/build/dist/Collision/Detection/Pair.js.map +1 -0
  94. package/build/dist/Collision/Detection/QuadTree.js +193 -0
  95. package/build/dist/Collision/Detection/QuadTree.js.map +1 -0
  96. package/build/dist/Collision/Group/CollisionGroup.js +3 -3
  97. package/build/dist/Collision/Integrator.js +25 -0
  98. package/build/dist/Collision/Integrator.js.map +1 -0
  99. package/build/dist/Collision/MotionSystem.js +35 -0
  100. package/build/dist/Collision/MotionSystem.js.map +1 -0
  101. package/build/dist/Collision/Physics.js +163 -0
  102. package/build/dist/Collision/Physics.js.map +1 -0
  103. package/build/dist/Collision/PhysicsWorld.js +10 -0
  104. package/build/dist/Collision/PhysicsWorld.js.map +1 -0
  105. package/build/dist/Collision/Side.js +51 -0
  106. package/build/dist/Collision/Side.js.map +1 -0
  107. package/build/dist/Collision/Solver/ArcadeSolver.js +154 -0
  108. package/build/dist/Collision/Solver/ArcadeSolver.js.map +1 -0
  109. package/build/dist/Collision/Solver/ContactConstraintPoint.js +87 -0
  110. package/build/dist/Collision/Solver/ContactConstraintPoint.js.map +1 -0
  111. package/build/dist/Collision/Solver/RealisticSolver.js +293 -0
  112. package/build/dist/Collision/Solver/RealisticSolver.js.map +1 -0
  113. package/build/dist/Collision/Solver/Solver.js +2 -0
  114. package/build/dist/Collision/Solver/Solver.js.map +1 -0
  115. package/build/dist/Color.js +417 -0
  116. package/build/dist/Color.js.map +1 -0
  117. package/build/dist/Configurable.js +32 -0
  118. package/build/dist/Configurable.js.map +1 -0
  119. package/build/dist/Debug/Debug.d.ts +11 -0
  120. package/build/dist/Debug/Debug.js +385 -0
  121. package/build/dist/Debug/Debug.js.map +1 -0
  122. package/build/dist/Debug/DebugFlags.js +40 -0
  123. package/build/dist/Debug/DebugFlags.js.map +1 -0
  124. package/build/dist/Debug/DebugSystem.js +263 -0
  125. package/build/dist/Debug/DebugSystem.js.map +1 -0
  126. package/build/dist/Debug/index.js +4 -0
  127. package/build/dist/Debug/index.js.map +1 -0
  128. package/build/dist/Deprecated.js +2 -0
  129. package/build/dist/Deprecated.js.map +1 -0
  130. package/build/dist/Engine.js +986 -0
  131. package/build/dist/Engine.js.map +1 -0
  132. package/build/dist/EntityComponentSystem/Component.js +65 -0
  133. package/build/dist/EntityComponentSystem/Component.js.map +1 -0
  134. package/build/dist/EntityComponentSystem/Components/MotionComponent.js +33 -0
  135. package/build/dist/EntityComponentSystem/Components/MotionComponent.js.map +1 -0
  136. package/build/dist/EntityComponentSystem/Components/TransformComponent.js +107 -0
  137. package/build/dist/EntityComponentSystem/Components/TransformComponent.js.map +1 -0
  138. package/build/dist/EntityComponentSystem/Entity.js +487 -0
  139. package/build/dist/EntityComponentSystem/Entity.js.map +1 -0
  140. package/build/dist/EntityComponentSystem/EntityManager.js +137 -0
  141. package/build/dist/EntityComponentSystem/EntityManager.js.map +1 -0
  142. package/build/dist/EntityComponentSystem/Query.js +90 -0
  143. package/build/dist/EntityComponentSystem/Query.js.map +1 -0
  144. package/build/dist/EntityComponentSystem/QueryManager.js +90 -0
  145. package/build/dist/EntityComponentSystem/QueryManager.js.map +1 -0
  146. package/build/dist/EntityComponentSystem/System.js +76 -0
  147. package/build/dist/EntityComponentSystem/System.js.map +1 -0
  148. package/build/dist/EntityComponentSystem/SystemManager.js +104 -0
  149. package/build/dist/EntityComponentSystem/SystemManager.js.map +1 -0
  150. package/build/dist/EntityComponentSystem/Util.js +5 -0
  151. package/build/dist/EntityComponentSystem/Util.js.map +1 -0
  152. package/build/dist/EntityComponentSystem/World.js +55 -0
  153. package/build/dist/EntityComponentSystem/World.js.map +1 -0
  154. package/build/dist/EntityComponentSystem/index.js +11 -0
  155. package/build/dist/EntityComponentSystem/index.js.map +1 -0
  156. package/build/dist/EventDispatcher.js +122 -0
  157. package/build/dist/EventDispatcher.js.map +1 -0
  158. package/build/dist/EventEmitter.js +86 -0
  159. package/build/dist/EventEmitter.js.map +1 -0
  160. package/build/dist/Events/ExEvent.js +12 -0
  161. package/build/dist/Events/ExEvent.js.map +1 -0
  162. package/build/dist/Events/MediaEvents.js +75 -0
  163. package/build/dist/Events/MediaEvents.js.map +1 -0
  164. package/build/dist/Events/PointerEvents.js +52 -0
  165. package/build/dist/Events/PointerEvents.js.map +1 -0
  166. package/build/dist/Events.js +473 -0
  167. package/build/dist/Events.js.map +1 -0
  168. package/build/dist/Flags.js +67 -0
  169. package/build/dist/Flags.js.map +1 -0
  170. package/build/dist/Graphics/Animation.js +344 -0
  171. package/build/dist/Graphics/Animation.js.map +1 -0
  172. package/build/dist/Graphics/Canvas.js +38 -0
  173. package/build/dist/Graphics/Canvas.js.map +1 -0
  174. package/build/dist/Graphics/Circle.js +48 -0
  175. package/build/dist/Graphics/Circle.js.map +1 -0
  176. package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js +2 -0
  177. package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js.map +1 -0
  178. package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js +237 -0
  179. package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js.map +1 -0
  180. package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +1 -0
  181. package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js +481 -0
  182. package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js.map +1 -0
  183. package/build/dist/Graphics/Context/circle-renderer/circle-renderer.frag.glsl +52 -52
  184. package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js +174 -0
  185. package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js.map +1 -0
  186. package/build/dist/Graphics/Context/circle-renderer/circle-renderer.vert.glsl +37 -37
  187. package/build/dist/Graphics/Context/debug-text.js +47 -0
  188. package/build/dist/Graphics/Context/debug-text.js.map +1 -0
  189. package/build/dist/Graphics/Context/draw-call.js +16 -0
  190. package/build/dist/Graphics/Context/draw-call.js.map +1 -0
  191. package/build/dist/Graphics/Context/image-renderer/image-renderer.frag.glsl +32 -32
  192. package/build/dist/Graphics/Context/image-renderer/image-renderer.js +246 -0
  193. package/build/dist/Graphics/Context/image-renderer/image-renderer.js.map +1 -0
  194. package/build/dist/Graphics/Context/image-renderer/image-renderer.vert.glsl +32 -32
  195. package/build/dist/Graphics/Context/line-renderer/line-fragment.glsl +10 -10
  196. package/build/dist/Graphics/Context/line-renderer/line-renderer.js +90 -0
  197. package/build/dist/Graphics/Context/line-renderer/line-renderer.js.map +1 -0
  198. package/build/dist/Graphics/Context/line-renderer/line-vertex.glsl +14 -14
  199. package/build/dist/Graphics/Context/material-renderer/material-renderer.js +23 -2
  200. package/build/dist/Graphics/Context/material-renderer/material-renderer.js.map +1 -1
  201. package/build/dist/Graphics/Context/material.d.ts +2 -0
  202. package/build/dist/Graphics/Context/material.js +72 -0
  203. package/build/dist/Graphics/Context/material.js.map +1 -0
  204. package/build/dist/Graphics/Context/point-renderer/point-fragment.glsl +19 -19
  205. package/build/dist/Graphics/Context/point-renderer/point-renderer.js +91 -0
  206. package/build/dist/Graphics/Context/point-renderer/point-renderer.js.map +1 -0
  207. package/build/dist/Graphics/Context/point-renderer/point-vertex.glsl +11 -11
  208. package/build/dist/Graphics/Context/quad-index-buffer.js +67 -0
  209. package/build/dist/Graphics/Context/quad-index-buffer.js.map +1 -0
  210. package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.frag.glsl +85 -85
  211. package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js +305 -0
  212. package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js.map +1 -0
  213. package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.vert.glsl +42 -42
  214. package/build/dist/Graphics/Context/render-source.js +16 -0
  215. package/build/dist/Graphics/Context/render-source.js.map +1 -0
  216. package/build/dist/Graphics/Context/render-target.js +65 -0
  217. package/build/dist/Graphics/Context/render-target.js.map +1 -0
  218. package/build/dist/Graphics/Context/renderer.js +2 -0
  219. package/build/dist/Graphics/Context/renderer.js.map +1 -0
  220. package/build/dist/Graphics/Context/screen-pass-painter/screen-fragment.glsl +13 -13
  221. package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js +56 -0
  222. package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js.map +1 -0
  223. package/build/dist/Graphics/Context/screen-pass-painter/screen-vertex.glsl +11 -11
  224. package/build/dist/Graphics/Context/state-stack.js +37 -0
  225. package/build/dist/Graphics/Context/state-stack.js.map +1 -0
  226. package/build/dist/Graphics/Context/texture-loader.js +109 -0
  227. package/build/dist/Graphics/Context/texture-loader.js.map +1 -0
  228. package/build/dist/Graphics/Context/transform-stack.js +30 -0
  229. package/build/dist/Graphics/Context/transform-stack.js.map +1 -0
  230. package/build/dist/Graphics/Context/vertex-buffer.js +53 -0
  231. package/build/dist/Graphics/Context/vertex-buffer.js.map +1 -0
  232. package/build/dist/Graphics/Context/webgl-util.js +79 -0
  233. package/build/dist/Graphics/Context/webgl-util.js.map +1 -0
  234. package/build/dist/Graphics/DebugGraphicsComponent.d.ts +3 -2
  235. package/build/dist/Graphics/DebugGraphicsComponent.js +16 -0
  236. package/build/dist/Graphics/DebugGraphicsComponent.js.map +1 -0
  237. package/build/dist/Graphics/Filtering.js +17 -0
  238. package/build/dist/Graphics/Filtering.js.map +1 -0
  239. package/build/dist/Graphics/Font.js +148 -0
  240. package/build/dist/Graphics/Font.js.map +1 -0
  241. package/build/dist/Graphics/FontCache.d.ts +1 -0
  242. package/build/dist/Graphics/FontCache.js +80 -0
  243. package/build/dist/Graphics/FontCache.js.map +1 -0
  244. package/build/dist/Graphics/FontCommon.js +109 -0
  245. package/build/dist/Graphics/FontCommon.js.map +1 -0
  246. package/build/dist/Graphics/FontTextInstance.js +230 -0
  247. package/build/dist/Graphics/FontTextInstance.js.map +1 -0
  248. package/build/dist/Graphics/Graphic.js +208 -0
  249. package/build/dist/Graphics/Graphic.js.map +1 -0
  250. package/build/dist/Graphics/GraphicsComponent.js +336 -0
  251. package/build/dist/Graphics/GraphicsComponent.js.map +1 -0
  252. package/build/dist/Graphics/GraphicsDiagnostics.js +9 -0
  253. package/build/dist/Graphics/GraphicsDiagnostics.js.map +1 -0
  254. package/build/dist/Graphics/GraphicsGroup.js +69 -0
  255. package/build/dist/Graphics/GraphicsGroup.js.map +1 -0
  256. package/build/dist/Graphics/GraphicsSystem.js +210 -0
  257. package/build/dist/Graphics/GraphicsSystem.js.map +1 -0
  258. package/build/dist/Graphics/ImageSource.js +124 -0
  259. package/build/dist/Graphics/ImageSource.js.map +1 -0
  260. package/build/dist/Graphics/Line.js +45 -0
  261. package/build/dist/Graphics/Line.js.map +1 -0
  262. package/build/dist/Graphics/OffscreenSystem.js +64 -0
  263. package/build/dist/Graphics/OffscreenSystem.js.map +1 -0
  264. package/build/dist/Graphics/ParallaxComponent.js +11 -0
  265. package/build/dist/Graphics/ParallaxComponent.js.map +1 -0
  266. package/build/dist/Graphics/Polygon.js +59 -0
  267. package/build/dist/Graphics/Polygon.js.map +1 -0
  268. package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js +7 -0
  269. package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js.map +1 -0
  270. package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js +52 -0
  271. package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js.map +1 -0
  272. package/build/dist/Graphics/PostProcessor/PostProcessor.js +2 -0
  273. package/build/dist/Graphics/PostProcessor/PostProcessor.js.map +1 -0
  274. package/build/dist/Graphics/PostProcessor/ScreenShader.js +59 -0
  275. package/build/dist/Graphics/PostProcessor/ScreenShader.js.map +1 -0
  276. package/build/dist/Graphics/PostProcessor/color-blind-fragment.glsl +64 -64
  277. package/build/dist/Graphics/Raster.js +215 -0
  278. package/build/dist/Graphics/Raster.js.map +1 -0
  279. package/build/dist/Graphics/Rectangle.js +29 -0
  280. package/build/dist/Graphics/Rectangle.js.map +1 -0
  281. package/build/dist/Graphics/Sprite.js +82 -0
  282. package/build/dist/Graphics/Sprite.js.map +1 -0
  283. package/build/dist/Graphics/SpriteFont.js +139 -0
  284. package/build/dist/Graphics/SpriteFont.js.map +1 -0
  285. package/build/dist/Graphics/SpriteSheet.js +116 -0
  286. package/build/dist/Graphics/SpriteSheet.js.map +1 -0
  287. package/build/dist/Graphics/Text.js +103 -0
  288. package/build/dist/Graphics/Text.js.map +1 -0
  289. package/build/dist/Graphics/index.js +46 -0
  290. package/build/dist/Graphics/index.js.map +1 -0
  291. package/build/dist/Id.js +8 -0
  292. package/build/dist/Id.js.map +1 -0
  293. package/build/dist/Input/CapturePointerConfig.js +5 -0
  294. package/build/dist/Input/CapturePointerConfig.js.map +1 -0
  295. package/build/dist/Input/EngineInput.js +2 -0
  296. package/build/dist/Input/EngineInput.js.map +1 -0
  297. package/build/dist/Input/Gamepad.js +422 -0
  298. package/build/dist/Input/Gamepad.js.map +1 -0
  299. package/build/dist/Input/Index.js +88 -0
  300. package/build/dist/Input/Index.js.map +1 -0
  301. package/build/dist/Input/InputMapper.js +45 -0
  302. package/build/dist/Input/InputMapper.js.map +1 -0
  303. package/build/dist/Input/Keyboard.js +348 -0
  304. package/build/dist/Input/Keyboard.js.map +1 -0
  305. package/build/dist/Input/NativePointerButton.js +12 -0
  306. package/build/dist/Input/NativePointerButton.js.map +1 -0
  307. package/build/dist/Input/PointerAbstraction.js +44 -0
  308. package/build/dist/Input/PointerAbstraction.js.map +1 -0
  309. package/build/dist/Input/PointerButton.js +12 -0
  310. package/build/dist/Input/PointerButton.js.map +1 -0
  311. package/build/dist/Input/PointerComponent.js +28 -0
  312. package/build/dist/Input/PointerComponent.js.map +1 -0
  313. package/build/dist/Input/PointerEvent.js +25 -0
  314. package/build/dist/Input/PointerEvent.js.map +1 -0
  315. package/build/dist/Input/PointerEventReceiver.js +456 -0
  316. package/build/dist/Input/PointerEventReceiver.js.map +1 -0
  317. package/build/dist/Input/PointerScope.js +16 -0
  318. package/build/dist/Input/PointerScope.js.map +1 -0
  319. package/build/dist/Input/PointerSystem.js +249 -0
  320. package/build/dist/Input/PointerSystem.js.map +1 -0
  321. package/build/dist/Input/PointerType.js +11 -0
  322. package/build/dist/Input/PointerType.js.map +1 -0
  323. package/build/dist/Input/WheelDeltaMode.js +7 -0
  324. package/build/dist/Input/WheelDeltaMode.js.map +1 -0
  325. package/build/dist/Input/WheelEvent.js +21 -0
  326. package/build/dist/Input/WheelEvent.js.map +1 -0
  327. package/build/dist/Interfaces/Audio.js +2 -0
  328. package/build/dist/Interfaces/Audio.js.map +1 -0
  329. package/build/dist/Interfaces/AudioImplementation.js +11 -0
  330. package/build/dist/Interfaces/AudioImplementation.js.map +1 -0
  331. package/build/dist/Interfaces/Clonable.js +2 -0
  332. package/build/dist/Interfaces/Clonable.js.map +1 -0
  333. package/build/dist/Interfaces/Evented.js +2 -0
  334. package/build/dist/Interfaces/Evented.js.map +1 -0
  335. package/build/dist/Interfaces/Index.js +8 -0
  336. package/build/dist/Interfaces/Index.js.map +1 -0
  337. package/build/dist/Interfaces/LifecycleEvents.js +51 -0
  338. package/build/dist/Interfaces/LifecycleEvents.js.map +1 -0
  339. package/build/dist/Interfaces/Loadable.js +2 -0
  340. package/build/dist/Interfaces/Loadable.js.map +1 -0
  341. package/build/dist/Interfaces/PointerEventHandlers.js +2 -0
  342. package/build/dist/Interfaces/PointerEventHandlers.js.map +1 -0
  343. package/build/dist/Label.js +81 -0
  344. package/build/dist/Label.js.map +1 -0
  345. package/build/dist/Loader.js +416 -0
  346. package/build/dist/Loader.js.map +1 -0
  347. package/build/dist/Math/Index.js +13 -0
  348. package/build/dist/Math/Index.js.map +1 -0
  349. package/build/dist/Math/Random.js +239 -0
  350. package/build/dist/Math/Random.js.map +1 -0
  351. package/build/dist/Math/affine-matrix.js +331 -0
  352. package/build/dist/Math/affine-matrix.js.map +1 -0
  353. package/build/dist/Math/coord-plane.js +17 -0
  354. package/build/dist/Math/coord-plane.js.map +1 -0
  355. package/build/dist/Math/global-coordinates.js +30 -0
  356. package/build/dist/Math/global-coordinates.js.map +1 -0
  357. package/build/dist/Math/line-segment.js +205 -0
  358. package/build/dist/Math/line-segment.js.map +1 -0
  359. package/build/dist/Math/matrix.js +457 -0
  360. package/build/dist/Math/matrix.js.map +1 -0
  361. package/build/dist/Math/projection.js +24 -0
  362. package/build/dist/Math/projection.js.map +1 -0
  363. package/build/dist/Math/ray.js +52 -0
  364. package/build/dist/Math/ray.js.map +1 -0
  365. package/build/dist/Math/transform.js +219 -0
  366. package/build/dist/Math/transform.js.map +1 -0
  367. package/build/dist/Math/util.js +82 -0
  368. package/build/dist/Math/util.js.map +1 -0
  369. package/build/dist/Math/vector-view.js +25 -0
  370. package/build/dist/Math/vector-view.js.map +1 -0
  371. package/build/dist/Math/vector.js +340 -0
  372. package/build/dist/Math/vector.js.map +1 -0
  373. package/build/dist/Math/watch-vector.js +26 -0
  374. package/build/dist/Math/watch-vector.js.map +1 -0
  375. package/build/dist/Particles.js +430 -0
  376. package/build/dist/Particles.js.map +1 -0
  377. package/build/dist/Polyfill.js +56 -0
  378. package/build/dist/Polyfill.js.map +1 -0
  379. package/build/dist/Resources/Gif.js +464 -0
  380. package/build/dist/Resources/Gif.js.map +1 -0
  381. package/build/dist/Resources/Index.js +4 -0
  382. package/build/dist/Resources/Index.js.map +1 -0
  383. package/build/dist/Resources/Resource.js +81 -0
  384. package/build/dist/Resources/Resource.js.map +1 -0
  385. package/build/dist/Resources/Sound/AudioContext.js +16 -0
  386. package/build/dist/Resources/Sound/AudioContext.js.map +1 -0
  387. package/build/dist/Resources/Sound/Index.js +4 -0
  388. package/build/dist/Resources/Sound/Index.js.map +1 -0
  389. package/build/dist/Resources/Sound/Sound.js +326 -0
  390. package/build/dist/Resources/Sound/Sound.js.map +1 -0
  391. package/build/dist/Resources/Sound/WebAudioInstance.js +190 -0
  392. package/build/dist/Resources/Sound/WebAudioInstance.js.map +1 -0
  393. package/build/dist/Scene.js +444 -0
  394. package/build/dist/Scene.js.map +1 -0
  395. package/build/dist/Screen.js +782 -0
  396. package/build/dist/Screen.js.map +1 -0
  397. package/build/dist/ScreenElement.js +43 -0
  398. package/build/dist/ScreenElement.js.map +1 -0
  399. package/build/dist/TileMap/IsometricEntityComponent.js +17 -0
  400. package/build/dist/TileMap/IsometricEntityComponent.js.map +1 -0
  401. package/build/dist/TileMap/IsometricEntitySystem.js +23 -0
  402. package/build/dist/TileMap/IsometricEntitySystem.js.map +1 -0
  403. package/build/dist/TileMap/IsometricMap.js +311 -0
  404. package/build/dist/TileMap/IsometricMap.js.map +1 -0
  405. package/build/dist/TileMap/TileMap.d.ts +2 -1
  406. package/build/dist/TileMap/TileMap.js +630 -0
  407. package/build/dist/TileMap/TileMap.js.map +1 -0
  408. package/build/dist/TileMap/index.js +5 -0
  409. package/build/dist/TileMap/index.js.map +1 -0
  410. package/build/dist/Timer.js +202 -0
  411. package/build/dist/Timer.js.map +1 -0
  412. package/build/dist/Trigger.js +94 -0
  413. package/build/dist/Trigger.js.map +1 -0
  414. package/build/dist/Util/Browser.js +66 -0
  415. package/build/dist/Util/Browser.js.map +1 -0
  416. package/build/dist/Util/Clock.js +219 -0
  417. package/build/dist/Util/Clock.js.map +1 -0
  418. package/build/dist/Util/Decorators.js +78 -0
  419. package/build/dist/Util/Decorators.js.map +1 -0
  420. package/build/dist/Util/Detector.js +167 -0
  421. package/build/dist/Util/Detector.js.map +1 -0
  422. package/build/dist/Util/DrawUtil.js +115 -0
  423. package/build/dist/Util/DrawUtil.js.map +1 -0
  424. package/build/dist/Util/EasingFunctions.js +102 -0
  425. package/build/dist/Util/EasingFunctions.js.map +1 -0
  426. package/build/dist/Util/Fps.js +47 -0
  427. package/build/dist/Util/Fps.js.map +1 -0
  428. package/build/dist/Util/Future.js +30 -0
  429. package/build/dist/Util/Future.js.map +1 -0
  430. package/build/dist/Util/IFrame.js +23 -0
  431. package/build/dist/Util/IFrame.js.map +1 -0
  432. package/build/dist/Util/Index.js +7 -0
  433. package/build/dist/Util/Index.js.map +1 -0
  434. package/build/dist/Util/Log.js +195 -0
  435. package/build/dist/Util/Log.js.map +1 -0
  436. package/build/dist/Util/Observable.js +66 -0
  437. package/build/dist/Util/Observable.js.map +1 -0
  438. package/build/dist/Util/Pool.js +74 -0
  439. package/build/dist/Util/Pool.js.map +1 -0
  440. package/build/dist/Util/Semaphore.js +55 -0
  441. package/build/dist/Util/Semaphore.js.map +1 -0
  442. package/build/dist/Util/Sound.js +22 -0
  443. package/build/dist/Util/Sound.js.map +1 -0
  444. package/build/dist/Util/StateMachine.js +79 -0
  445. package/build/dist/Util/StateMachine.js.map +1 -0
  446. package/build/dist/Util/Toaster.css +28 -28
  447. package/build/dist/Util/Toaster.js +84 -0
  448. package/build/dist/Util/Toaster.js.map +1 -0
  449. package/build/dist/Util/Util.d.ts +6 -0
  450. package/build/dist/Util/Util.js +95 -0
  451. package/build/dist/Util/Util.js.map +1 -0
  452. package/build/dist/Util/Watch.js +67 -0
  453. package/build/dist/Util/Watch.js.map +1 -0
  454. package/build/dist/Util/WebAudio.js +62 -0
  455. package/build/dist/Util/WebAudio.js.map +1 -0
  456. package/build/dist/excalibur.d.ts +2 -2
  457. package/build/dist/excalibur.js +389 -258
  458. package/build/dist/excalibur.js.map +1 -1
  459. package/build/dist/excalibur.min.js +1 -1
  460. package/build/dist/excalibur.min.js.LICENSE.txt +1 -1
  461. package/build/dist/excalibur.min.js.map +1 -1
  462. package/build/dist/index.js +81 -0
  463. package/build/dist/index.js.map +1 -0
  464. package/build/esm/Debug/Debug.d.ts +11 -0
  465. package/build/esm/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +1 -0
  466. package/build/esm/Graphics/Context/material.d.ts +2 -0
  467. package/build/esm/Graphics/DebugGraphicsComponent.d.ts +3 -2
  468. package/build/esm/Graphics/FontCache.d.ts +1 -0
  469. package/build/esm/TileMap/TileMap.d.ts +2 -1
  470. package/build/esm/Util/Util.d.ts +6 -0
  471. package/build/esm/excalibur.d.ts +2 -2
  472. package/build/esm/excalibur.js +389 -258
  473. package/build/esm/excalibur.js.map +1 -1
  474. package/build/esm/excalibur.min.js +1 -1
  475. package/build/esm/excalibur.min.js.LICENSE.txt +1 -1
  476. package/build/esm/excalibur.min.js.map +1 -1
  477. package/docker-compose.yml +11 -11
  478. package/package.json +131 -131
  479. package/build/dist/Loader.css +0 -122
  480. package/build/nuget/Excalibur.0.28.3.nupkg +0 -0
  481. package/build/v0.28.3.zip +0 -0
  482. package/excalibur-0.28.3.tgz +0 -0
@@ -0,0 +1,99 @@
1
+ import { PolygonCollider } from './PolygonCollider';
2
+ import { CircleCollider } from './CircleCollider';
3
+ import { EdgeCollider } from './EdgeCollider';
4
+ import { BoundingBox } from '../BoundingBox';
5
+ import { vec, Vector } from '../../Math/vector';
6
+ import { CompositeCollider } from './CompositeCollider';
7
+ import { Logger } from '../..';
8
+ /**
9
+ * Excalibur helper for defining colliders quickly
10
+ */
11
+ export class Shape {
12
+ /**
13
+ * Creates a box collider, under the hood defines a [[PolygonCollider]] collider
14
+ * @param width Width of the box
15
+ * @param height Height of the box
16
+ * @param anchor Anchor of the box (default (.5, .5)) which positions the box relative to the center of the collider's position
17
+ * @param offset Optional offset relative to the collider in local coordinates
18
+ */
19
+ static Box(width, height, anchor = Vector.Half, offset = Vector.Zero) {
20
+ return new PolygonCollider({
21
+ points: new BoundingBox(-width * anchor.x, -height * anchor.y, width - width * anchor.x, height - height * anchor.y).getPoints(),
22
+ offset: offset
23
+ });
24
+ }
25
+ /**
26
+ * Creates a new [[PolygonCollider|arbitrary polygon]] collider
27
+ *
28
+ * PolygonColliders are useful for creating convex polygon shapes
29
+ * @param points Points specified in counter clockwise
30
+ * @param offset Optional offset relative to the collider in local coordinates
31
+ */
32
+ static Polygon(points, offset = Vector.Zero) {
33
+ return new PolygonCollider({
34
+ points: points,
35
+ offset: offset
36
+ });
37
+ }
38
+ /**
39
+ * Creates a new [[CircleCollider|circle]] collider
40
+ *
41
+ * Circle colliders are useful for balls, or to make collisions more forgiving on sharp edges
42
+ * @param radius Radius of the circle collider
43
+ * @param offset Optional offset relative to the collider in local coordinates
44
+ */
45
+ static Circle(radius, offset = Vector.Zero) {
46
+ return new CircleCollider({
47
+ radius: radius,
48
+ offset: offset
49
+ });
50
+ }
51
+ /**
52
+ * Creates a new [[EdgeCollider|edge]] collider
53
+ *
54
+ * Edge colliders are useful for floors, walls, and other barriers
55
+ * @param begin Beginning of the edge in local coordinates to the collider
56
+ * @param end Ending of the edge in local coordinates to the collider
57
+ */
58
+ static Edge(begin, end) {
59
+ return new EdgeCollider({
60
+ begin: begin,
61
+ end: end
62
+ });
63
+ }
64
+ /**
65
+ * Creates a new capsule shaped [[CompositeCollider]] using 2 circles and a box
66
+ *
67
+ * Capsule colliders are useful for platformers with incline or jagged floors to have a smooth
68
+ * player experience.
69
+ * @param width
70
+ * @param height
71
+ * @param offset Optional offset
72
+ */
73
+ static Capsule(width, height, offset = Vector.Zero) {
74
+ const logger = Logger.getInstance();
75
+ if (width === height) {
76
+ logger.warn('A capsule collider with equal width and height is a circle, consider using a ex.Shape.Circle or ex.CircleCollider');
77
+ }
78
+ const vertical = height >= width;
79
+ if (vertical) {
80
+ // height > width, if equal maybe use a circle
81
+ const capsule = new CompositeCollider([
82
+ Shape.Circle(width / 2, vec(0, -height / 2 + width / 2).add(offset)),
83
+ Shape.Box(width, height - width, Vector.Half, offset),
84
+ Shape.Circle(width / 2, vec(0, height / 2 - width / 2).add(offset))
85
+ ]);
86
+ return capsule;
87
+ }
88
+ else {
89
+ // width > height, if equal maybe use a circle
90
+ const capsule = new CompositeCollider([
91
+ Shape.Circle(height / 2, vec(-width / 2 + height / 2, 0).add(offset)),
92
+ Shape.Box(width - height, height, Vector.Half, offset),
93
+ Shape.Circle(height / 2, vec(width / 2 - height / 2, 0).add(offset))
94
+ ]);
95
+ return capsule;
96
+ }
97
+ }
98
+ }
99
+ //# sourceMappingURL=Shape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shape.js","sourceRoot":"","sources":["../../../../src/engine/Collision/Colliders/Shape.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * An enum that describes the types of collisions bodies can participate in
3
+ */
4
+ export var CollisionType;
5
+ (function (CollisionType) {
6
+ /**
7
+ * Bodies with the `PreventCollision` setting do not participate in any
8
+ * collisions and do not raise collision events.
9
+ */
10
+ CollisionType["PreventCollision"] = "PreventCollision";
11
+ /**
12
+ * Bodies with the `Passive` setting only raise collision events, but are not
13
+ * influenced or moved by other bodies and do not influence or move other bodies.
14
+ * This is useful for use in trigger type behavior.
15
+ */
16
+ CollisionType["Passive"] = "Passive";
17
+ /**
18
+ * Bodies with the `Active` setting raise collision events and participate
19
+ * in collisions with other bodies and will be push or moved by bodies sharing
20
+ * the `Active` or `Fixed` setting.
21
+ */
22
+ CollisionType["Active"] = "Active";
23
+ /**
24
+ * Bodies with the `Fixed` setting raise collision events and participate in
25
+ * collisions with other bodies. Actors with the `Fixed` setting will not be
26
+ * pushed or moved by other bodies sharing the `Fixed`. Think of Fixed
27
+ * bodies as "immovable/unstoppable" objects. If two `Fixed` bodies meet they will
28
+ * not be pushed or moved by each other, they will not interact except to throw
29
+ * collision events.
30
+ */
31
+ CollisionType["Fixed"] = "Fixed";
32
+ })(CollisionType || (CollisionType = {}));
33
+ //# sourceMappingURL=CollisionType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollisionType.js","sourceRoot":"","sources":["../../../src/engine/Collision/CollisionType.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,aA2BX;AA3BD,WAAY,aAAa;IACvB;;;OAGG;IACH,sDAAqC,CAAA;IACrC;;;;OAIG;IACH,oCAAmB,CAAA;IACnB;;;;OAIG;IACH,kCAAiB,CAAA;IACjB;;;;;;;OAOG;IACH,gCAAe,CAAA;AACjB,CAAC,EA3BW,aAAa,KAAb,aAAa,QA2BxB"}
@@ -0,0 +1,51 @@
1
+ import { Physics } from '../Physics';
2
+ import { CollisionType } from '../CollisionType';
3
+ import { Pair } from './Pair';
4
+ import { BodyComponent } from '../BodyComponent';
5
+ /**
6
+ * Collision contacts are used internally by Excalibur to resolve collision between colliders. This
7
+ * Pair prevents collisions from being evaluated more than one time
8
+ */
9
+ export class CollisionContact {
10
+ constructor(colliderA, colliderB, mtv, normal, tangent, points, localPoints, info) {
11
+ var _a, _b;
12
+ this._canceled = false;
13
+ this.colliderA = colliderA;
14
+ this.colliderB = colliderB;
15
+ this.mtv = mtv;
16
+ this.normal = normal;
17
+ this.tangent = tangent;
18
+ this.points = points;
19
+ this.localPoints = localPoints;
20
+ this.info = info;
21
+ this.id = Pair.calculatePairHash(colliderA.id, colliderB.id);
22
+ if (colliderA.__compositeColliderId || colliderB.__compositeColliderId) {
23
+ // Add on the parent composite pair for start/end contact
24
+ this.id += '|' + Pair.calculatePairHash((_a = colliderA.__compositeColliderId) !== null && _a !== void 0 ? _a : colliderA.id, (_b = colliderB.__compositeColliderId) !== null && _b !== void 0 ? _b : colliderB.id);
25
+ }
26
+ }
27
+ /**
28
+ * Match contact awake state, except if body's are Fixed
29
+ */
30
+ matchAwake() {
31
+ const bodyA = this.colliderA.owner.get(BodyComponent);
32
+ const bodyB = this.colliderB.owner.get(BodyComponent);
33
+ if (bodyA && bodyB) {
34
+ if (bodyA.sleeping !== bodyB.sleeping) {
35
+ if (bodyA.sleeping && bodyA.collisionType !== CollisionType.Fixed && bodyB.sleepMotion >= Physics.wakeThreshold) {
36
+ bodyA.setSleeping(false);
37
+ }
38
+ if (bodyB.sleeping && bodyB.collisionType !== CollisionType.Fixed && bodyA.sleepMotion >= Physics.wakeThreshold) {
39
+ bodyB.setSleeping(false);
40
+ }
41
+ }
42
+ }
43
+ }
44
+ isCanceled() {
45
+ return this._canceled;
46
+ }
47
+ cancel() {
48
+ this._canceled = true;
49
+ }
50
+ }
51
+ //# sourceMappingURL=CollisionContact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollisionContact.js","sourceRoot":"","sources":["../../../../src/engine/Collision/Detection/CollisionContact.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAgD3B,YACE,SAAmB,EACnB,SAAmB,EACnB,GAAW,EACX,MAAc,EACd,OAAe,EACf,MAAgB,EAChB,WAAqB,EACrB,IAAoB;;QAvDd,cAAS,GAAG,KAAK,CAAC;QAyDxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;QAC7D,IAAI,SAAS,CAAC,qBAAqB,IAAI,SAAS,CAAC,qBAAqB,EAAE,CAAC;YACvE,yDAAyD;YACzD,IAAI,CAAC,EAAE,IAAI,GAAG,GAAG,IAAI,CAAC,iBAAiB,CACrC,MAAA,SAAS,CAAC,qBAAqB,mCAAI,SAAS,CAAC,EAAE,EAC/C,MAAA,SAAS,CAAC,qBAAqB,mCAAI,SAAS,CAAC,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED;;OAEG;IACI,UAAU;QACf,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACtD,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;YACnB,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACtC,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,aAAa,KAAK,aAAa,CAAC,KAAK,IAAI,KAAK,CAAC,WAAW,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;oBAChH,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBAC3B,CAAC;gBACD,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,aAAa,KAAK,aAAa,CAAC,KAAK,IAAI,KAAK,CAAC,WAAW,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;oBAChH,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBAC3B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,MAAM;QACX,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CollisionProcessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollisionProcessor.js","sourceRoot":"","sources":["../../../../src/engine/Collision/Detection/CollisionProcessor.ts"],"names":[],"mappings":""}
@@ -0,0 +1,442 @@
1
+ import { Physics } from '../Physics';
2
+ import { BoundingBox } from '../BoundingBox';
3
+ import { Logger } from '../../Util/Log';
4
+ import { BodyComponent } from '../BodyComponent';
5
+ import { Color } from '../..';
6
+ /**
7
+ * Dynamic Tree Node used for tracking bounds within the tree
8
+ */
9
+ export class TreeNode {
10
+ constructor(parent) {
11
+ this.parent = parent;
12
+ this.parent = parent || null;
13
+ this.data = null;
14
+ this.bounds = new BoundingBox();
15
+ this.left = null;
16
+ this.right = null;
17
+ this.height = 0;
18
+ }
19
+ isLeaf() {
20
+ return !this.left && !this.right;
21
+ }
22
+ }
23
+ /**
24
+ * The DynamicTrees provides a spatial partitioning data structure for quickly querying for overlapping bounding boxes for
25
+ * all tracked bodies. The worst case performance of this is O(n*log(n)) where n is the number of bodies in the tree.
26
+ *
27
+ * Internally the bounding boxes are organized as a balanced binary tree of bounding boxes, where the leaf nodes are tracked bodies.
28
+ * Every non-leaf node is a bounding box that contains child bounding boxes.
29
+ */
30
+ export class DynamicTree {
31
+ constructor(worldBounds = new BoundingBox(-Number.MAX_VALUE, -Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE)) {
32
+ this.worldBounds = worldBounds;
33
+ this.root = null;
34
+ this.nodes = {};
35
+ }
36
+ /**
37
+ * Inserts a node into the dynamic tree
38
+ */
39
+ _insert(leaf) {
40
+ // If there are no nodes in the tree, make this the root leaf
41
+ if (this.root === null) {
42
+ this.root = leaf;
43
+ this.root.parent = null;
44
+ return;
45
+ }
46
+ // Search the tree for a node that is not a leaf and find the best place to insert
47
+ const leafAABB = leaf.bounds;
48
+ let currentRoot = this.root;
49
+ while (!currentRoot.isLeaf()) {
50
+ const left = currentRoot.left;
51
+ const right = currentRoot.right;
52
+ const area = currentRoot.bounds.getPerimeter();
53
+ const combinedAABB = currentRoot.bounds.combine(leafAABB);
54
+ const combinedArea = combinedAABB.getPerimeter();
55
+ // Calculate cost heuristic for creating a new parent and leaf
56
+ const cost = 2 * combinedArea;
57
+ // Minimum cost of pushing the leaf down the tree
58
+ const inheritanceCost = 2 * (combinedArea - area);
59
+ // Cost of descending
60
+ let leftCost = 0;
61
+ const leftCombined = leafAABB.combine(left.bounds);
62
+ let newArea;
63
+ let oldArea;
64
+ if (left.isLeaf()) {
65
+ leftCost = leftCombined.getPerimeter() + inheritanceCost;
66
+ }
67
+ else {
68
+ oldArea = left.bounds.getPerimeter();
69
+ newArea = leftCombined.getPerimeter();
70
+ leftCost = newArea - oldArea + inheritanceCost;
71
+ }
72
+ let rightCost = 0;
73
+ const rightCombined = leafAABB.combine(right.bounds);
74
+ if (right.isLeaf()) {
75
+ rightCost = rightCombined.getPerimeter() + inheritanceCost;
76
+ }
77
+ else {
78
+ oldArea = right.bounds.getPerimeter();
79
+ newArea = rightCombined.getPerimeter();
80
+ rightCost = newArea - oldArea + inheritanceCost;
81
+ }
82
+ // cost is acceptable
83
+ if (cost < leftCost && cost < rightCost) {
84
+ break;
85
+ }
86
+ // Descend to the depths
87
+ if (leftCost < rightCost) {
88
+ currentRoot = left;
89
+ }
90
+ else {
91
+ currentRoot = right;
92
+ }
93
+ }
94
+ // Create the new parent node and insert into the tree
95
+ const oldParent = currentRoot.parent;
96
+ const newParent = new TreeNode(oldParent);
97
+ newParent.bounds = leafAABB.combine(currentRoot.bounds);
98
+ newParent.height = currentRoot.height + 1;
99
+ if (oldParent !== null) {
100
+ // The sibling node was not the root
101
+ if (oldParent.left === currentRoot) {
102
+ oldParent.left = newParent;
103
+ }
104
+ else {
105
+ oldParent.right = newParent;
106
+ }
107
+ newParent.left = currentRoot;
108
+ newParent.right = leaf;
109
+ currentRoot.parent = newParent;
110
+ leaf.parent = newParent;
111
+ }
112
+ else {
113
+ // The sibling node was the root
114
+ newParent.left = currentRoot;
115
+ newParent.right = leaf;
116
+ currentRoot.parent = newParent;
117
+ leaf.parent = newParent;
118
+ this.root = newParent;
119
+ }
120
+ // Walk up the tree fixing heights and AABBs
121
+ let currentNode = leaf.parent;
122
+ while (currentNode) {
123
+ currentNode = this._balance(currentNode);
124
+ if (!currentNode.left) {
125
+ throw new Error('Parent of current leaf cannot have a null left child' + currentNode);
126
+ }
127
+ if (!currentNode.right) {
128
+ throw new Error('Parent of current leaf cannot have a null right child' + currentNode);
129
+ }
130
+ currentNode.height = 1 + Math.max(currentNode.left.height, currentNode.right.height);
131
+ currentNode.bounds = currentNode.left.bounds.combine(currentNode.right.bounds);
132
+ currentNode = currentNode.parent;
133
+ }
134
+ }
135
+ /**
136
+ * Removes a node from the dynamic tree
137
+ */
138
+ _remove(leaf) {
139
+ if (leaf === this.root) {
140
+ this.root = null;
141
+ return;
142
+ }
143
+ const parent = leaf.parent;
144
+ const grandParent = parent.parent;
145
+ let sibling;
146
+ if (parent.left === leaf) {
147
+ sibling = parent.right;
148
+ }
149
+ else {
150
+ sibling = parent.left;
151
+ }
152
+ if (grandParent) {
153
+ if (grandParent.left === parent) {
154
+ grandParent.left = sibling;
155
+ }
156
+ else {
157
+ grandParent.right = sibling;
158
+ }
159
+ sibling.parent = grandParent;
160
+ let currentNode = grandParent;
161
+ while (currentNode) {
162
+ currentNode = this._balance(currentNode);
163
+ currentNode.bounds = currentNode.left.bounds.combine(currentNode.right.bounds);
164
+ currentNode.height = 1 + Math.max(currentNode.left.height, currentNode.right.height);
165
+ currentNode = currentNode.parent;
166
+ }
167
+ }
168
+ else {
169
+ this.root = sibling;
170
+ sibling.parent = null;
171
+ }
172
+ }
173
+ /**
174
+ * Tracks a body in the dynamic tree
175
+ */
176
+ trackCollider(collider) {
177
+ const node = new TreeNode();
178
+ node.data = collider;
179
+ node.bounds = collider.bounds;
180
+ node.bounds.left -= 2;
181
+ node.bounds.top -= 2;
182
+ node.bounds.right += 2;
183
+ node.bounds.bottom += 2;
184
+ this.nodes[collider.id.value] = node;
185
+ this._insert(node);
186
+ }
187
+ /**
188
+ * Updates the dynamic tree given the current bounds of each body being tracked
189
+ */
190
+ updateCollider(collider) {
191
+ var _a;
192
+ const node = this.nodes[collider.id.value];
193
+ if (!node) {
194
+ return false;
195
+ }
196
+ const b = collider.bounds;
197
+ // if the body is outside the world no longer update it
198
+ if (!this.worldBounds.contains(b)) {
199
+ Logger.getInstance().warn('Collider with id ' + collider.id.value + ' is outside the world bounds and will no longer be tracked for physics');
200
+ this.untrackCollider(collider);
201
+ return false;
202
+ }
203
+ if (node.bounds.contains(b)) {
204
+ return false;
205
+ }
206
+ this._remove(node);
207
+ b.left -= Physics.boundsPadding;
208
+ b.top -= Physics.boundsPadding;
209
+ b.right += Physics.boundsPadding;
210
+ b.bottom += Physics.boundsPadding;
211
+ // THIS IS CAUSING UNECESSARY CHECKS
212
+ if (collider.owner) {
213
+ const body = (_a = collider.owner) === null || _a === void 0 ? void 0 : _a.get(BodyComponent);
214
+ if (body) {
215
+ const multdx = ((body.vel.x * 32) / 1000) * Physics.dynamicTreeVelocityMultiplier;
216
+ const multdy = ((body.vel.y * 32) / 1000) * Physics.dynamicTreeVelocityMultiplier;
217
+ if (multdx < 0) {
218
+ b.left += multdx;
219
+ }
220
+ else {
221
+ b.right += multdx;
222
+ }
223
+ if (multdy < 0) {
224
+ b.top += multdy;
225
+ }
226
+ else {
227
+ b.bottom += multdy;
228
+ }
229
+ }
230
+ }
231
+ node.bounds = b;
232
+ this._insert(node);
233
+ return true;
234
+ }
235
+ /**
236
+ * Untracks a body from the dynamic tree
237
+ */
238
+ untrackCollider(collider) {
239
+ const node = this.nodes[collider.id.value];
240
+ if (!node) {
241
+ return;
242
+ }
243
+ this._remove(node);
244
+ this.nodes[collider.id.value] = null;
245
+ delete this.nodes[collider.id.value];
246
+ }
247
+ /**
248
+ * Balances the tree about a node
249
+ */
250
+ _balance(node) {
251
+ if (node === null) {
252
+ throw new Error('Cannot balance at null node');
253
+ }
254
+ if (node.isLeaf() || node.height < 2) {
255
+ return node;
256
+ }
257
+ const left = node.left;
258
+ const right = node.right;
259
+ const a = node;
260
+ const b = left;
261
+ const c = right;
262
+ const d = left.left;
263
+ const e = left.right;
264
+ const f = right.left;
265
+ const g = right.right;
266
+ const balance = c.height - b.height;
267
+ // Rotate c node up
268
+ if (balance > 1) {
269
+ // Swap the right node with it's parent
270
+ c.left = a;
271
+ c.parent = a.parent;
272
+ a.parent = c;
273
+ // The original node's old parent should point to the right node
274
+ // this is mega confusing
275
+ if (c.parent) {
276
+ if (c.parent.left === a) {
277
+ c.parent.left = c;
278
+ }
279
+ else {
280
+ c.parent.right = c;
281
+ }
282
+ }
283
+ else {
284
+ this.root = c;
285
+ }
286
+ // Rotate
287
+ if (f.height > g.height) {
288
+ c.right = f;
289
+ a.right = g;
290
+ g.parent = a;
291
+ a.bounds = b.bounds.combine(g.bounds);
292
+ c.bounds = a.bounds.combine(f.bounds);
293
+ a.height = 1 + Math.max(b.height, g.height);
294
+ c.height = 1 + Math.max(a.height, f.height);
295
+ }
296
+ else {
297
+ c.right = g;
298
+ a.right = f;
299
+ f.parent = a;
300
+ a.bounds = b.bounds.combine(f.bounds);
301
+ c.bounds = a.bounds.combine(g.bounds);
302
+ a.height = 1 + Math.max(b.height, f.height);
303
+ c.height = 1 + Math.max(a.height, g.height);
304
+ }
305
+ return c;
306
+ }
307
+ // Rotate left node up
308
+ if (balance < -1) {
309
+ // swap
310
+ b.left = a;
311
+ b.parent = a.parent;
312
+ a.parent = b;
313
+ // node's old parent should point to b
314
+ if (b.parent) {
315
+ if (b.parent.left === a) {
316
+ b.parent.left = b;
317
+ }
318
+ else {
319
+ if (b.parent.right !== a) {
320
+ throw 'Error rotating Dynamic Tree';
321
+ }
322
+ b.parent.right = b;
323
+ }
324
+ }
325
+ else {
326
+ this.root = b;
327
+ }
328
+ // rotate
329
+ if (d.height > e.height) {
330
+ b.right = d;
331
+ a.left = e;
332
+ e.parent = a;
333
+ a.bounds = c.bounds.combine(e.bounds);
334
+ b.bounds = a.bounds.combine(d.bounds);
335
+ a.height = 1 + Math.max(c.height, e.height);
336
+ b.height = 1 + Math.max(a.height, d.height);
337
+ }
338
+ else {
339
+ b.right = e;
340
+ a.left = d;
341
+ d.parent = a;
342
+ a.bounds = c.bounds.combine(d.bounds);
343
+ b.bounds = a.bounds.combine(e.bounds);
344
+ a.height = 1 + Math.max(c.height, d.height);
345
+ b.height = 1 + Math.max(a.height, e.height);
346
+ }
347
+ return b;
348
+ }
349
+ return node;
350
+ }
351
+ /**
352
+ * Returns the internal height of the tree, shorter trees are better. Performance drops as the tree grows
353
+ */
354
+ getHeight() {
355
+ if (this.root === null) {
356
+ return 0;
357
+ }
358
+ return this.root.height;
359
+ }
360
+ /**
361
+ * Queries the Dynamic Axis Aligned Tree for bodies that could be colliding with the provided body.
362
+ *
363
+ * In the query callback, it will be passed a potential collider. Returning true from this callback indicates
364
+ * that you are complete with your query and you do not want to continue. Returning false will continue searching
365
+ * the tree until all possible colliders have been returned.
366
+ */
367
+ query(collider, callback) {
368
+ const bounds = collider.bounds;
369
+ const helper = (currentNode) => {
370
+ if (currentNode && currentNode.bounds.overlaps(bounds)) {
371
+ if (currentNode.isLeaf() && currentNode.data !== collider) {
372
+ if (callback.call(collider, currentNode.data)) {
373
+ return true;
374
+ }
375
+ }
376
+ else {
377
+ return helper(currentNode.left) || helper(currentNode.right);
378
+ }
379
+ }
380
+ return false;
381
+ };
382
+ helper(this.root);
383
+ }
384
+ /**
385
+ * Queries the Dynamic Axis Aligned Tree for bodies that could be intersecting. By default the raycast query uses an infinitely
386
+ * long ray to test the tree specified by `max`.
387
+ *
388
+ * In the query callback, it will be passed a potential body that intersects with the raycast. Returning true from this
389
+ * callback indicates that your are complete with your query and do not want to continue. Return false will continue searching
390
+ * the tree until all possible bodies that would intersect with the ray have been returned.
391
+ */
392
+ rayCastQuery(ray, max = Infinity, callback) {
393
+ const helper = (currentNode) => {
394
+ if (currentNode && currentNode.bounds.rayCast(ray, max)) {
395
+ if (currentNode.isLeaf()) {
396
+ if (callback.call(ray, currentNode.data)) {
397
+ // ray hit a leaf! return the body
398
+ return true;
399
+ }
400
+ }
401
+ else {
402
+ // ray hit but not at a leaf, recurse deeper
403
+ return helper(currentNode.left) || helper(currentNode.right);
404
+ }
405
+ }
406
+ return false; // ray missed
407
+ };
408
+ helper(this.root);
409
+ }
410
+ getNodes() {
411
+ const helper = (currentNode) => {
412
+ if (currentNode) {
413
+ return [currentNode].concat(helper(currentNode.left), helper(currentNode.right));
414
+ }
415
+ else {
416
+ return [];
417
+ }
418
+ };
419
+ return helper(this.root);
420
+ }
421
+ debug(ex) {
422
+ // draw all the nodes in the Dynamic Tree
423
+ const helper = (currentNode) => {
424
+ if (currentNode) {
425
+ if (currentNode.isLeaf()) {
426
+ currentNode.bounds.draw(ex, Color.Green);
427
+ }
428
+ else {
429
+ currentNode.bounds.draw(ex, Color.White);
430
+ }
431
+ if (currentNode.left) {
432
+ helper(currentNode.left);
433
+ }
434
+ if (currentNode.right) {
435
+ helper(currentNode.right);
436
+ }
437
+ }
438
+ };
439
+ helper(this.root);
440
+ }
441
+ }
442
+ //# sourceMappingURL=DynamicTree.js.map