excalibur 0.25.2 → 0.25.3

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 (446) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/build/dist/Actions/Action/Blink.js +51 -0
  3. package/build/dist/Actions/Action/Blink.js.map +1 -0
  4. package/build/dist/Actions/Action/CallMethod.js +21 -0
  5. package/build/dist/Actions/Action/CallMethod.js.map +1 -0
  6. package/build/dist/Actions/Action/Delay.js +25 -0
  7. package/build/dist/Actions/Action/Delay.js.map +1 -0
  8. package/build/dist/Actions/Action/Die.js +22 -0
  9. package/build/dist/Actions/Action/Die.js.map +1 -0
  10. package/build/dist/Actions/Action/EaseTo.js +69 -0
  11. package/build/dist/Actions/Action/EaseTo.js.map +1 -0
  12. package/build/dist/Actions/Action/Fade.js +46 -0
  13. package/build/dist/Actions/Action/Fade.js.map +1 -0
  14. package/build/dist/Actions/Action/Follow.js +55 -0
  15. package/build/dist/Actions/Action/Follow.js.map +1 -0
  16. package/build/dist/Actions/Action/Meet.js +52 -0
  17. package/build/dist/Actions/Action/Meet.js.map +1 -0
  18. package/build/dist/Actions/Action/MoveBy.js +47 -0
  19. package/build/dist/Actions/Action/MoveBy.js.map +1 -0
  20. package/build/dist/Actions/Action/MoveTo.js +40 -0
  21. package/build/dist/Actions/Action/MoveTo.js.map +1 -0
  22. package/build/dist/Actions/Action/Repeat.js +31 -0
  23. package/build/dist/Actions/Action/Repeat.js.map +1 -0
  24. package/build/dist/Actions/Action/RepeatForever.js +37 -0
  25. package/build/dist/Actions/Action/RepeatForever.js.map +1 -0
  26. package/build/dist/Actions/Action/RotateBy.js +91 -0
  27. package/build/dist/Actions/Action/RotateBy.js.map +1 -0
  28. package/build/dist/Actions/Action/RotateTo.js +90 -0
  29. package/build/dist/Actions/Action/RotateTo.js.map +1 -0
  30. package/build/dist/Actions/Action/ScaleBy.js +45 -0
  31. package/build/dist/Actions/Action/ScaleBy.js.map +1 -0
  32. package/build/dist/Actions/Action/ScaleTo.js +56 -0
  33. package/build/dist/Actions/Action/ScaleTo.js.map +1 -0
  34. package/build/dist/Actions/Action.js +2 -0
  35. package/build/dist/Actions/Action.js.map +1 -0
  36. package/build/dist/Actions/ActionContext.js +305 -0
  37. package/build/dist/Actions/ActionContext.js.map +1 -0
  38. package/build/dist/Actions/ActionQueue.js +87 -0
  39. package/build/dist/Actions/ActionQueue.js.map +1 -0
  40. package/build/dist/Actions/Actionable.js +2 -0
  41. package/build/dist/Actions/Actionable.js.map +1 -0
  42. package/build/dist/Actions/ActionsComponent.js +198 -0
  43. package/build/dist/Actions/ActionsComponent.js.map +1 -0
  44. package/build/dist/Actions/ActionsSystem.js +18 -0
  45. package/build/dist/Actions/ActionsSystem.js.map +1 -0
  46. package/build/dist/Actions/Index.js +22 -0
  47. package/build/dist/Actions/Index.js.map +1 -0
  48. package/build/dist/Actions/RotationType.js +27 -0
  49. package/build/dist/Actions/RotationType.js.map +1 -0
  50. package/build/dist/Actor.js +831 -0
  51. package/build/dist/Actor.js.map +1 -0
  52. package/build/dist/Camera.js +663 -0
  53. package/build/dist/Camera.js.map +1 -0
  54. package/build/dist/Class.js +48 -0
  55. package/build/dist/Class.js.map +1 -0
  56. package/build/dist/Collision/BodyComponent.js +351 -0
  57. package/build/dist/Collision/BodyComponent.js.map +1 -0
  58. package/build/dist/Collision/BoundingBox.js +361 -0
  59. package/build/dist/Collision/BoundingBox.js.map +1 -0
  60. package/build/dist/Collision/ColliderComponent.js +198 -0
  61. package/build/dist/Collision/ColliderComponent.js.map +1 -0
  62. package/build/dist/Collision/Colliders/CircleCollider.js +264 -0
  63. package/build/dist/Collision/Colliders/CircleCollider.js.map +1 -0
  64. package/build/dist/Collision/Colliders/ClosestLineJumpTable.js +211 -0
  65. package/build/dist/Collision/Colliders/ClosestLineJumpTable.js.map +1 -0
  66. package/build/dist/Collision/Colliders/Collider.js +26 -0
  67. package/build/dist/Collision/Colliders/Collider.js.map +1 -0
  68. package/build/dist/Collision/Colliders/CollisionJumpTable.js +301 -0
  69. package/build/dist/Collision/Colliders/CollisionJumpTable.js.map +1 -0
  70. package/build/dist/Collision/Colliders/CompositeCollider.js +232 -0
  71. package/build/dist/Collision/Colliders/CompositeCollider.js.map +1 -0
  72. package/build/dist/Collision/Colliders/EdgeCollider.js +253 -0
  73. package/build/dist/Collision/Colliders/EdgeCollider.js.map +1 -0
  74. package/build/dist/Collision/Colliders/PolygonCollider.js +389 -0
  75. package/build/dist/Collision/Colliders/PolygonCollider.js.map +1 -0
  76. package/build/dist/Collision/Colliders/SeparatingAxis.js +67 -0
  77. package/build/dist/Collision/Colliders/SeparatingAxis.js.map +1 -0
  78. package/build/dist/Collision/Colliders/Shape.js +102 -0
  79. package/build/dist/Collision/Colliders/Shape.js.map +1 -0
  80. package/build/dist/Collision/CollisionSystem.js +116 -0
  81. package/build/dist/Collision/CollisionSystem.js.map +1 -0
  82. package/build/dist/Collision/CollisionType.js +33 -0
  83. package/build/dist/Collision/CollisionType.js.map +1 -0
  84. package/build/dist/Collision/Detection/CollisionContact.js +46 -0
  85. package/build/dist/Collision/Detection/CollisionContact.js.map +1 -0
  86. package/build/dist/Collision/Detection/CollisionProcessor.js +2 -0
  87. package/build/dist/Collision/Detection/CollisionProcessor.js.map +1 -0
  88. package/build/dist/Collision/Detection/DynamicTree.js +442 -0
  89. package/build/dist/Collision/Detection/DynamicTree.js.map +1 -0
  90. package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.js +211 -0
  91. package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.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/Group/CollisionGroup.js +114 -0
  95. package/build/dist/Collision/Group/CollisionGroup.js.map +1 -0
  96. package/build/dist/Collision/Group/CollisionGroupManager.js +52 -0
  97. package/build/dist/Collision/Group/CollisionGroupManager.js.map +1 -0
  98. package/build/dist/Collision/Index.js +29 -0
  99. package/build/dist/Collision/Index.js.map +1 -0
  100. package/build/dist/Collision/Integrator.js +11 -0
  101. package/build/dist/Collision/Integrator.js.map +1 -0
  102. package/build/dist/Collision/MotionSystem.js +42 -0
  103. package/build/dist/Collision/MotionSystem.js.map +1 -0
  104. package/build/dist/Collision/Physics.js +163 -0
  105. package/build/dist/Collision/Physics.js.map +1 -0
  106. package/build/dist/Collision/Side.js +51 -0
  107. package/build/dist/Collision/Side.js.map +1 -0
  108. package/build/dist/Collision/Solver/ArcadeSolver.js +101 -0
  109. package/build/dist/Collision/Solver/ArcadeSolver.js.map +1 -0
  110. package/build/dist/Collision/Solver/ContactConstraintPoint.js +83 -0
  111. package/build/dist/Collision/Solver/ContactConstraintPoint.js.map +1 -0
  112. package/build/dist/Collision/Solver/RealisticSolver.js +248 -0
  113. package/build/dist/Collision/Solver/RealisticSolver.js.map +1 -0
  114. package/build/dist/Collision/Solver/Solver.js +37 -0
  115. package/build/dist/Collision/Solver/Solver.js.map +1 -0
  116. package/build/dist/Color.js +461 -0
  117. package/build/dist/Color.js.map +1 -0
  118. package/build/dist/Configurable.js +32 -0
  119. package/build/dist/Configurable.js.map +1 -0
  120. package/build/dist/Debug/Debug.js +375 -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 +251 -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/Drawing/Animation.js +294 -0
  131. package/build/dist/Drawing/Animation.js.map +1 -0
  132. package/build/dist/Drawing/CanvasDrawComponent.js +16 -0
  133. package/build/dist/Drawing/CanvasDrawComponent.js.map +1 -0
  134. package/build/dist/Drawing/CanvasDrawingSystem.js +95 -0
  135. package/build/dist/Drawing/CanvasDrawingSystem.js.map +1 -0
  136. package/build/dist/Drawing/Index.js +10 -0
  137. package/build/dist/Drawing/Index.js.map +1 -0
  138. package/build/dist/Drawing/Polygon.js +139 -0
  139. package/build/dist/Drawing/Polygon.js.map +1 -0
  140. package/build/dist/Drawing/Sprite.js +355 -0
  141. package/build/dist/Drawing/Sprite.js.map +1 -0
  142. package/build/dist/Drawing/SpriteEffects.js +246 -0
  143. package/build/dist/Drawing/SpriteEffects.js.map +1 -0
  144. package/build/dist/Drawing/SpriteSheet.js +413 -0
  145. package/build/dist/Drawing/SpriteSheet.js.map +1 -0
  146. package/build/dist/Drawing/Texture.js +69 -0
  147. package/build/dist/Drawing/Texture.js.map +1 -0
  148. package/build/dist/Engine.d.ts +4 -1
  149. package/build/dist/Engine.js +985 -0
  150. package/build/dist/Engine.js.map +1 -0
  151. package/build/dist/EntityComponentSystem/Component.js +65 -0
  152. package/build/dist/EntityComponentSystem/Component.js.map +1 -0
  153. package/build/dist/EntityComponentSystem/Components/MotionComponent.js +33 -0
  154. package/build/dist/EntityComponentSystem/Components/MotionComponent.js.map +1 -0
  155. package/build/dist/EntityComponentSystem/Components/TransformComponent.js +249 -0
  156. package/build/dist/EntityComponentSystem/Components/TransformComponent.js.map +1 -0
  157. package/build/dist/EntityComponentSystem/Entity.js +452 -0
  158. package/build/dist/EntityComponentSystem/Entity.js.map +1 -0
  159. package/build/dist/EntityComponentSystem/EntityManager.js +128 -0
  160. package/build/dist/EntityComponentSystem/EntityManager.js.map +1 -0
  161. package/build/dist/EntityComponentSystem/Query.js +91 -0
  162. package/build/dist/EntityComponentSystem/Query.js.map +1 -0
  163. package/build/dist/EntityComponentSystem/QueryManager.js +90 -0
  164. package/build/dist/EntityComponentSystem/QueryManager.js.map +1 -0
  165. package/build/dist/EntityComponentSystem/System.js +76 -0
  166. package/build/dist/EntityComponentSystem/System.js.map +1 -0
  167. package/build/dist/EntityComponentSystem/SystemManager.js +102 -0
  168. package/build/dist/EntityComponentSystem/SystemManager.js.map +1 -0
  169. package/build/dist/EntityComponentSystem/Util.js +5 -0
  170. package/build/dist/EntityComponentSystem/Util.js.map +1 -0
  171. package/build/dist/EntityComponentSystem/World.js +55 -0
  172. package/build/dist/EntityComponentSystem/World.js.map +1 -0
  173. package/build/dist/EntityComponentSystem/index.js +11 -0
  174. package/build/dist/EntityComponentSystem/index.js.map +1 -0
  175. package/build/dist/EventDispatcher.js +114 -0
  176. package/build/dist/EventDispatcher.js.map +1 -0
  177. package/build/dist/Events/ExEvent.js +12 -0
  178. package/build/dist/Events/ExEvent.js.map +1 -0
  179. package/build/dist/Events/MediaEvents.js +75 -0
  180. package/build/dist/Events/MediaEvents.js.map +1 -0
  181. package/build/dist/Events/PointerEvents.js +52 -0
  182. package/build/dist/Events/PointerEvents.js.map +1 -0
  183. package/build/dist/Events.js +497 -0
  184. package/build/dist/Events.js.map +1 -0
  185. package/build/dist/Flags.js +90 -0
  186. package/build/dist/Flags.js.map +1 -0
  187. package/build/dist/Graphics/Animation.js +310 -0
  188. package/build/dist/Graphics/Animation.js.map +1 -0
  189. package/build/dist/Graphics/Canvas.js +38 -0
  190. package/build/dist/Graphics/Canvas.js.map +1 -0
  191. package/build/dist/Graphics/Circle.js +47 -0
  192. package/build/dist/Graphics/Circle.js.map +1 -0
  193. package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js +2 -0
  194. package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js.map +1 -0
  195. package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js +207 -0
  196. package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js.map +1 -0
  197. package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js +331 -0
  198. package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js.map +1 -0
  199. package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js +160 -0
  200. package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js.map +1 -0
  201. package/build/dist/Graphics/Context/debug-text.js +47 -0
  202. package/build/dist/Graphics/Context/debug-text.js.map +1 -0
  203. package/build/dist/Graphics/Context/image-renderer/image-renderer.js +209 -0
  204. package/build/dist/Graphics/Context/image-renderer/image-renderer.js.map +1 -0
  205. package/build/dist/Graphics/Context/line-renderer/line-renderer.js +87 -0
  206. package/build/dist/Graphics/Context/line-renderer/line-renderer.js.map +1 -0
  207. package/build/dist/Graphics/Context/point-renderer/point-renderer.js +82 -0
  208. package/build/dist/Graphics/Context/point-renderer/point-renderer.js.map +1 -0
  209. package/build/dist/Graphics/Context/quad-index-buffer.js +69 -0
  210. package/build/dist/Graphics/Context/quad-index-buffer.js.map +1 -0
  211. package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js +272 -0
  212. package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js.map +1 -0
  213. package/build/dist/Graphics/Context/render-source.js +16 -0
  214. package/build/dist/Graphics/Context/render-source.js.map +1 -0
  215. package/build/dist/Graphics/Context/render-target.js +65 -0
  216. package/build/dist/Graphics/Context/render-target.js.map +1 -0
  217. package/build/dist/Graphics/Context/renderer.js +2 -0
  218. package/build/dist/Graphics/Context/renderer.js.map +1 -0
  219. package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js +53 -0
  220. package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js.map +1 -0
  221. package/build/dist/Graphics/Context/shader.js +236 -0
  222. package/build/dist/Graphics/Context/shader.js.map +1 -0
  223. package/build/dist/Graphics/Context/state-stack.js +27 -0
  224. package/build/dist/Graphics/Context/state-stack.js.map +1 -0
  225. package/build/dist/Graphics/Context/texture-loader.d.ts +8 -0
  226. package/build/dist/Graphics/Context/texture-loader.js +121 -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 +45 -0
  231. package/build/dist/Graphics/Context/vertex-buffer.js.map +1 -0
  232. package/build/dist/Graphics/Context/vertex-layout.js +93 -0
  233. package/build/dist/Graphics/Context/vertex-layout.js.map +1 -0
  234. package/build/dist/Graphics/Context/webgl-adapter.js +19 -0
  235. package/build/dist/Graphics/Context/webgl-adapter.js.map +1 -0
  236. package/build/dist/Graphics/Context/webgl-util.js +105 -0
  237. package/build/dist/Graphics/Context/webgl-util.js.map +1 -0
  238. package/build/dist/Graphics/DebugGraphicsComponent.js +15 -0
  239. package/build/dist/Graphics/DebugGraphicsComponent.js.map +1 -0
  240. package/build/dist/Graphics/Filtering.js +17 -0
  241. package/build/dist/Graphics/Filtering.js.map +1 -0
  242. package/build/dist/Graphics/Font.js +293 -0
  243. package/build/dist/Graphics/Font.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/Graphic.js +200 -0
  247. package/build/dist/Graphics/Graphic.js.map +1 -0
  248. package/build/dist/Graphics/GraphicsComponent.js +290 -0
  249. package/build/dist/Graphics/GraphicsComponent.js.map +1 -0
  250. package/build/dist/Graphics/GraphicsDiagnostics.js +9 -0
  251. package/build/dist/Graphics/GraphicsDiagnostics.js.map +1 -0
  252. package/build/dist/Graphics/GraphicsGroup.js +69 -0
  253. package/build/dist/Graphics/GraphicsGroup.js.map +1 -0
  254. package/build/dist/Graphics/GraphicsSystem.js +153 -0
  255. package/build/dist/Graphics/GraphicsSystem.js.map +1 -0
  256. package/build/dist/Graphics/ImageSource.js +116 -0
  257. package/build/dist/Graphics/ImageSource.js.map +1 -0
  258. package/build/dist/Graphics/Polygon.js +59 -0
  259. package/build/dist/Graphics/Polygon.js.map +1 -0
  260. package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js +7 -0
  261. package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js.map +1 -0
  262. package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js +52 -0
  263. package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js.map +1 -0
  264. package/build/dist/Graphics/PostProcessor/PostProcessor.js +2 -0
  265. package/build/dist/Graphics/PostProcessor/PostProcessor.js.map +1 -0
  266. package/build/dist/Graphics/PostProcessor/ScreenShader.js +56 -0
  267. package/build/dist/Graphics/PostProcessor/ScreenShader.js.map +1 -0
  268. package/build/dist/Graphics/Raster.js +207 -0
  269. package/build/dist/Graphics/Raster.js.map +1 -0
  270. package/build/dist/Graphics/Rectangle.js +29 -0
  271. package/build/dist/Graphics/Rectangle.js.map +1 -0
  272. package/build/dist/Graphics/Sprite.js +103 -0
  273. package/build/dist/Graphics/Sprite.js.map +1 -0
  274. package/build/dist/Graphics/SpriteFont.js +120 -0
  275. package/build/dist/Graphics/SpriteFont.js.map +1 -0
  276. package/build/dist/Graphics/SpriteSheet.js +115 -0
  277. package/build/dist/Graphics/SpriteSheet.js.map +1 -0
  278. package/build/dist/Graphics/Text.js +94 -0
  279. package/build/dist/Graphics/Text.js.map +1 -0
  280. package/build/dist/Graphics/index.js +42 -0
  281. package/build/dist/Graphics/index.js.map +1 -0
  282. package/build/dist/Id.js +8 -0
  283. package/build/dist/Id.js.map +1 -0
  284. package/build/dist/Input/CapturePointerConfig.js +5 -0
  285. package/build/dist/Input/CapturePointerConfig.js.map +1 -0
  286. package/build/dist/Input/EngineInput.js +2 -0
  287. package/build/dist/Input/EngineInput.js.map +1 -0
  288. package/build/dist/Input/Gamepad.js +358 -0
  289. package/build/dist/Input/Gamepad.js.map +1 -0
  290. package/build/dist/Input/Index.js +22 -0
  291. package/build/dist/Input/Index.js.map +1 -0
  292. package/build/dist/Input/Keyboard.js +267 -0
  293. package/build/dist/Input/Keyboard.js.map +1 -0
  294. package/build/dist/Input/NativePointerButton.js +12 -0
  295. package/build/dist/Input/NativePointerButton.js.map +1 -0
  296. package/build/dist/Input/PointerAbstraction.js +41 -0
  297. package/build/dist/Input/PointerAbstraction.js.map +1 -0
  298. package/build/dist/Input/PointerButton.js +12 -0
  299. package/build/dist/Input/PointerButton.js.map +1 -0
  300. package/build/dist/Input/PointerComponent.js +28 -0
  301. package/build/dist/Input/PointerComponent.js.map +1 -0
  302. package/build/dist/Input/PointerEvent.js +25 -0
  303. package/build/dist/Input/PointerEvent.js.map +1 -0
  304. package/build/dist/Input/PointerEventReceiver.js +414 -0
  305. package/build/dist/Input/PointerEventReceiver.js.map +1 -0
  306. package/build/dist/Input/PointerScope.js +16 -0
  307. package/build/dist/Input/PointerScope.js.map +1 -0
  308. package/build/dist/Input/PointerSystem.js +217 -0
  309. package/build/dist/Input/PointerSystem.js.map +1 -0
  310. package/build/dist/Input/PointerType.js +11 -0
  311. package/build/dist/Input/PointerType.js.map +1 -0
  312. package/build/dist/Input/WheelDeltaMode.js +7 -0
  313. package/build/dist/Input/WheelDeltaMode.js.map +1 -0
  314. package/build/dist/Input/WheelEvent.js +21 -0
  315. package/build/dist/Input/WheelEvent.js.map +1 -0
  316. package/build/dist/Interfaces/Audio.js +2 -0
  317. package/build/dist/Interfaces/Audio.js.map +1 -0
  318. package/build/dist/Interfaces/AudioImplementation.js +11 -0
  319. package/build/dist/Interfaces/AudioImplementation.js.map +1 -0
  320. package/build/dist/Interfaces/Clonable.js +2 -0
  321. package/build/dist/Interfaces/Clonable.js.map +1 -0
  322. package/build/dist/Interfaces/Drawable.js +2 -0
  323. package/build/dist/Interfaces/Drawable.js.map +1 -0
  324. package/build/dist/Interfaces/Evented.js +2 -0
  325. package/build/dist/Interfaces/Evented.js.map +1 -0
  326. package/build/dist/Interfaces/Index.js +10 -0
  327. package/build/dist/Interfaces/Index.js.map +1 -0
  328. package/build/dist/Interfaces/LifecycleEvents.js +51 -0
  329. package/build/dist/Interfaces/LifecycleEvents.js.map +1 -0
  330. package/build/dist/Interfaces/Loadable.js +2 -0
  331. package/build/dist/Interfaces/Loadable.js.map +1 -0
  332. package/build/dist/Interfaces/PointerEventHandlers.js +2 -0
  333. package/build/dist/Interfaces/PointerEventHandlers.js.map +1 -0
  334. package/build/dist/Interfaces/Trait.js +2 -0
  335. package/build/dist/Interfaces/Trait.js.map +1 -0
  336. package/build/dist/Label.js +273 -0
  337. package/build/dist/Label.js.map +1 -0
  338. package/build/dist/Loader.js +367 -0
  339. package/build/dist/Loader.js.map +1 -0
  340. package/build/dist/Math/Index.js +10 -0
  341. package/build/dist/Math/Index.js.map +1 -0
  342. package/build/dist/Math/Random.js +239 -0
  343. package/build/dist/Math/Random.js.map +1 -0
  344. package/build/dist/Math/global-coordinates.js +30 -0
  345. package/build/dist/Math/global-coordinates.js.map +1 -0
  346. package/build/dist/Math/line.js +194 -0
  347. package/build/dist/Math/line.js.map +1 -0
  348. package/build/dist/Math/matrix.js +446 -0
  349. package/build/dist/Math/matrix.js.map +1 -0
  350. package/build/dist/Math/projection.js +24 -0
  351. package/build/dist/Math/projection.js.map +1 -0
  352. package/build/dist/Math/ray.js +52 -0
  353. package/build/dist/Math/ray.js.map +1 -0
  354. package/build/dist/Math/util.js +82 -0
  355. package/build/dist/Math/util.js.map +1 -0
  356. package/build/dist/Math/vector-view.js +25 -0
  357. package/build/dist/Math/vector-view.js.map +1 -0
  358. package/build/dist/Math/vector.js +326 -0
  359. package/build/dist/Math/vector.js.map +1 -0
  360. package/build/dist/Particles.js +449 -0
  361. package/build/dist/Particles.js.map +1 -0
  362. package/build/dist/Polyfill.js +56 -0
  363. package/build/dist/Polyfill.js.map +1 -0
  364. package/build/dist/Promises.js +205 -0
  365. package/build/dist/Promises.js.map +1 -0
  366. package/build/dist/Resources/Gif.js +479 -0
  367. package/build/dist/Resources/Gif.js.map +1 -0
  368. package/build/dist/Resources/Index.js +4 -0
  369. package/build/dist/Resources/Index.js.map +1 -0
  370. package/build/dist/Resources/Resource.js +74 -0
  371. package/build/dist/Resources/Resource.js.map +1 -0
  372. package/build/dist/Resources/Sound/AudioContext.js +16 -0
  373. package/build/dist/Resources/Sound/AudioContext.js.map +1 -0
  374. package/build/dist/Resources/Sound/Index.js +4 -0
  375. package/build/dist/Resources/Sound/Index.js.map +1 -0
  376. package/build/dist/Resources/Sound/Sound.js +240 -0
  377. package/build/dist/Resources/Sound/Sound.js.map +1 -0
  378. package/build/dist/Resources/Sound/WebAudioInstance.js +160 -0
  379. package/build/dist/Resources/Sound/WebAudioInstance.js.map +1 -0
  380. package/build/dist/Scene.js +458 -0
  381. package/build/dist/Scene.js.map +1 -0
  382. package/build/dist/Screen.js +634 -0
  383. package/build/dist/Screen.js.map +1 -0
  384. package/build/dist/ScreenElement.js +29 -0
  385. package/build/dist/ScreenElement.js.map +1 -0
  386. package/build/dist/TileMap.js +488 -0
  387. package/build/dist/TileMap.js.map +1 -0
  388. package/build/dist/Timer.js +198 -0
  389. package/build/dist/Timer.js.map +1 -0
  390. package/build/dist/Traits/Index.js +5 -0
  391. package/build/dist/Traits/Index.js.map +1 -0
  392. package/build/dist/Traits/OffscreenCulling.js +35 -0
  393. package/build/dist/Traits/OffscreenCulling.js.map +1 -0
  394. package/build/dist/Trigger.js +113 -0
  395. package/build/dist/Trigger.js.map +1 -0
  396. package/build/dist/Util/Actors.js +19 -0
  397. package/build/dist/Util/Actors.js.map +1 -0
  398. package/build/dist/Util/Browser.js +66 -0
  399. package/build/dist/Util/Browser.js.map +1 -0
  400. package/build/dist/Util/Clock.js +219 -0
  401. package/build/dist/Util/Clock.js.map +1 -0
  402. package/build/dist/Util/CullingBox.js +104 -0
  403. package/build/dist/Util/CullingBox.js.map +1 -0
  404. package/build/dist/Util/Decorators.js +78 -0
  405. package/build/dist/Util/Decorators.js.map +1 -0
  406. package/build/dist/Util/Detector.js +167 -0
  407. package/build/dist/Util/Detector.js.map +1 -0
  408. package/build/dist/Util/DrawUtil.js +117 -0
  409. package/build/dist/Util/DrawUtil.js.map +1 -0
  410. package/build/dist/Util/EasingFunctions.js +118 -0
  411. package/build/dist/Util/EasingFunctions.js.map +1 -0
  412. package/build/dist/Util/Fps.js +47 -0
  413. package/build/dist/Util/Fps.js.map +1 -0
  414. package/build/dist/Util/Index.js +7 -0
  415. package/build/dist/Util/Index.js.map +1 -0
  416. package/build/dist/Util/Log.js +195 -0
  417. package/build/dist/Util/Log.js.map +1 -0
  418. package/build/dist/Util/Observable.js +60 -0
  419. package/build/dist/Util/Observable.js.map +1 -0
  420. package/build/dist/Util/Pool.js +66 -0
  421. package/build/dist/Util/Pool.js.map +1 -0
  422. package/build/dist/Util/SortedList.js +261 -0
  423. package/build/dist/Util/SortedList.js.map +1 -0
  424. package/build/dist/Util/Sound.js +22 -0
  425. package/build/dist/Util/Sound.js.map +1 -0
  426. package/build/dist/Util/Util.js +294 -0
  427. package/build/dist/Util/Util.js.map +1 -0
  428. package/build/dist/Util/Watch.js +67 -0
  429. package/build/dist/Util/Watch.js.map +1 -0
  430. package/build/dist/Util/WebAudio.js +62 -0
  431. package/build/dist/Util/WebAudio.js.map +1 -0
  432. package/build/dist/excalibur.js +101 -22
  433. package/build/dist/excalibur.js.map +1 -1
  434. package/build/dist/excalibur.min.js +1 -1
  435. package/build/dist/excalibur.min.js.LICENSE.txt +1 -1
  436. package/build/dist/excalibur.min.js.map +1 -1
  437. package/build/dist/index.js +74 -0
  438. package/build/dist/index.js.map +1 -0
  439. package/build/esm/Engine.d.ts +4 -1
  440. package/build/esm/Graphics/Context/texture-loader.d.ts +8 -0
  441. package/build/esm/excalibur.js +101 -22
  442. package/build/esm/excalibur.js.map +1 -1
  443. package/build/esm/excalibur.min.js +1 -1
  444. package/build/esm/excalibur.min.js.LICENSE.txt +1 -1
  445. package/build/esm/excalibur.min.js.map +1 -1
  446. package/package.json +23 -22
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Checks if the current number is a power of two
3
+ */
4
+ export function isPowerOfTwo(x) {
5
+ return (x & (x - 1)) === 0;
6
+ }
7
+ /**
8
+ * Returns the next highest power of two
9
+ */
10
+ export function nextHighestPowerOfTwo(x) {
11
+ --x;
12
+ for (let i = 1; i < 32; i <<= 1) {
13
+ x = x | (x >> i);
14
+ }
15
+ return x + 1;
16
+ }
17
+ /**
18
+ * Returns the input number if a power of two, otherwise the next highest power of two
19
+ */
20
+ export function ensurePowerOfTwo(x) {
21
+ if (!isPowerOfTwo(x)) {
22
+ return nextHighestPowerOfTwo(x);
23
+ }
24
+ return x;
25
+ }
26
+ /**
27
+ * Return the size of the GlType in bytes
28
+ * @param gl
29
+ * @param type
30
+ */
31
+ export function getGlTypeSizeBytes(gl, type) {
32
+ switch (type) {
33
+ case gl.FLOAT:
34
+ return 4;
35
+ case gl.SHORT:
36
+ return 2;
37
+ case gl.UNSIGNED_SHORT:
38
+ return 2;
39
+ case gl.BYTE:
40
+ return 1;
41
+ case gl.UNSIGNED_BYTE:
42
+ return 1;
43
+ default:
44
+ return 1;
45
+ }
46
+ }
47
+ /**
48
+ * Based on the type return the number of attribute components
49
+ *
50
+ * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer
51
+ * @param gl
52
+ * @param type
53
+ */
54
+ export function getAttributeComponentSize(gl, type) {
55
+ switch (type) {
56
+ case gl.LOW_FLOAT:
57
+ case gl.HIGH_FLOAT:
58
+ case gl.FLOAT:
59
+ return 1;
60
+ case gl.FLOAT_VEC2:
61
+ return 2;
62
+ case gl.FLOAT_VEC3:
63
+ return 3;
64
+ case gl.FLOAT_VEC4:
65
+ return 4;
66
+ case gl.BYTE:
67
+ return 1;
68
+ case gl.UNSIGNED_BYTE:
69
+ return 1;
70
+ case gl.UNSIGNED_SHORT:
71
+ case gl.SHORT:
72
+ return 1;
73
+ default:
74
+ return 1;
75
+ }
76
+ }
77
+ /**
78
+ * Based on the attribute return the corresponding supported attrib pointer type
79
+ * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer
80
+ *
81
+ * @param gl
82
+ * @param type
83
+ */
84
+ export function getAttributePointerType(gl, type) {
85
+ switch (type) {
86
+ case gl.LOW_FLOAT:
87
+ case gl.HIGH_FLOAT:
88
+ case gl.FLOAT:
89
+ case gl.FLOAT_VEC2:
90
+ case gl.FLOAT_VEC3:
91
+ case gl.FLOAT_VEC4:
92
+ return gl.FLOAT;
93
+ case gl.BYTE:
94
+ return gl.BYTE;
95
+ case gl.UNSIGNED_BYTE:
96
+ return gl.UNSIGNED_BYTE;
97
+ case gl.SHORT:
98
+ return gl.SHORT;
99
+ case gl.UNSIGNED_SHORT:
100
+ return gl.UNSIGNED_SHORT;
101
+ default:
102
+ return gl.FLOAT;
103
+ }
104
+ }
105
+ //# sourceMappingURL=webgl-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-util.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/Context/webgl-util.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,CAAS;IAC7C,EAAE,CAAC,CAAC;IACJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE;QAC/B,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;KAClB;IACD,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,CAAS;IACxC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;QACpB,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC;KACjC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAyB,EAAE,IAAY;IACxE,QAAQ,IAAI,EAAE;QACZ,KAAK,EAAE,CAAC,KAAK;YACX,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,KAAK;YACX,OAAO,CA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QACjB,KAAK,EAAE,CAAC,aAAa;YACnB,OAAO,EAAE,CAAC,aAAa,CAAC;QAC1B,KAAK,EAAE,CAAC,KAAK;YACX,OAAO,EAAE,CAAC,KAAK,CAAC;QAClB,KAAK,EAAE,CAAC,cAAc;YACpB,OAAO,EAAE,CAAC,cAAc,CAAC;QAC3B;YACE,OAAO,EAAE,CAAC,KAAK,CAAC;KACnB;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Component } from '../EntityComponentSystem/Component';
2
+ /**
3
+ * Provide arbitrary drawing for the purposes of debugging your game
4
+ *
5
+ * Will only show when the Engine is set to debug mode [[Engine.showDebug]] or [[Engine.toggleDebug]]
6
+ *
7
+ */
8
+ export class DebugGraphicsComponent extends Component {
9
+ constructor(draw) {
10
+ super();
11
+ this.draw = draw;
12
+ this.type = 'ex.debuggraphics';
13
+ }
14
+ }
15
+ //# sourceMappingURL=DebugGraphicsComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DebugGraphicsComponent.js","sourceRoot":"","sources":["../../../src/engine/Graphics/DebugGraphicsComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAG/D;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAA6B;IAEvE,YAAmB,IAA6C;QAC9D,KAAK,EAAE,CAAC;QADS,SAAI,GAAJ,IAAI,CAAyC;QADvD,SAAI,GAAG,kBAAkB,CAAC;IAGnC,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Describes the different image filtering modes
3
+ */
4
+ export var ImageFiltering;
5
+ (function (ImageFiltering) {
6
+ /**
7
+ * Pixel is useful when you do not want smoothing aka antialiasing applied to your graphics.
8
+ *
9
+ * Useful for Pixel art aesthetics.
10
+ */
11
+ ImageFiltering["Pixel"] = "Pixel";
12
+ /**
13
+ * Blended is useful when you have high resolution artwork and would like it blended and smoothed
14
+ */
15
+ ImageFiltering["Blended"] = "Blended";
16
+ })(ImageFiltering || (ImageFiltering = {}));
17
+ //# sourceMappingURL=Filtering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Filtering.js","sourceRoot":"","sources":["../../../src/engine/Graphics/Filtering.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,CAAN,IAAY,cAaX;AAbD,WAAY,cAAc;IAExB;;;;OAIG;IACH,iCAAe,CAAA;IAEf;;OAEG;IACH,qCAAmB,CAAA;AACrB,CAAC,EAbW,cAAc,KAAd,cAAc,QAazB"}
@@ -0,0 +1,293 @@
1
+ import { BoundingBox } from '../Collision/Index';
2
+ import { Color } from '../Color';
3
+ import { line } from '../Util/DrawUtil';
4
+ import { BaseAlign, Direction, FontStyle, FontUnit, TextAlign } from './FontCommon';
5
+ import { Graphic } from './Graphic';
6
+ import { TextureLoader } from '.';
7
+ import { ImageFiltering } from './Filtering';
8
+ /**
9
+ * Represents a system or web font in Excalibur
10
+ *
11
+ * If no options specified, the system sans-serif 10 pixel is used
12
+ *
13
+ * If loading a custom web font be sure to have the font loaded before you use it https://erikonarheim.com/posts/dont-test-fonts/
14
+ */
15
+ export class Font extends Graphic {
16
+ constructor(options = {}) {
17
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
18
+ super(options); // <- Graphics properties
19
+ /**
20
+ * Set the font filtering mode, by default set to [[ImageFiltering.Blended]] regardless of the engine default smoothing
21
+ *
22
+ * If you have a pixel style font that may be a reason to switch this to [[ImageFiltering.Pixel]]
23
+ */
24
+ this.filtering = ImageFiltering.Blended;
25
+ /**
26
+ * Font quality determines the size of the underlying raster text, higher quality means less jagged edges.
27
+ * If quality is set to 1, then just enough raster bitmap is generated to render the text.
28
+ *
29
+ * You can think of quality as how zoomed in to the text you can get before seeing jagged edges.
30
+ *
31
+ * (Default 2)
32
+ */
33
+ this.quality = 2;
34
+ // Raster properties for fonts
35
+ this.padding = 2;
36
+ this.smoothing = false;
37
+ this.lineWidth = 1;
38
+ this.lineDash = [];
39
+ this.color = Color.Black;
40
+ this.family = 'sans-serif';
41
+ this.style = FontStyle.Normal;
42
+ this.bold = false;
43
+ this.unit = FontUnit.Px;
44
+ this.textAlign = TextAlign.Left;
45
+ this.baseAlign = BaseAlign.Alphabetic;
46
+ this.direction = Direction.LeftToRight;
47
+ this.size = 10;
48
+ this.shadow = null;
49
+ this._textBounds = new BoundingBox();
50
+ this._textToBitmap = new Map();
51
+ this._bitmapUsage = new Map();
52
+ // Raster properties
53
+ this.smoothing = (_a = options === null || options === void 0 ? void 0 : options.smoothing) !== null && _a !== void 0 ? _a : this.smoothing;
54
+ this.padding = (_b = options === null || options === void 0 ? void 0 : options.padding) !== null && _b !== void 0 ? _b : this.padding;
55
+ this.color = (_c = options === null || options === void 0 ? void 0 : options.color) !== null && _c !== void 0 ? _c : this.color;
56
+ this.strokeColor = (_d = options === null || options === void 0 ? void 0 : options.strokeColor) !== null && _d !== void 0 ? _d : this.strokeColor;
57
+ this.lineDash = (_e = options === null || options === void 0 ? void 0 : options.lineDash) !== null && _e !== void 0 ? _e : this.lineDash;
58
+ this.lineWidth = (_f = options === null || options === void 0 ? void 0 : options.lineWidth) !== null && _f !== void 0 ? _f : this.lineWidth;
59
+ this.filtering = (_g = options === null || options === void 0 ? void 0 : options.filtering) !== null && _g !== void 0 ? _g : this.filtering;
60
+ // Font specific properties
61
+ this.family = (_h = options === null || options === void 0 ? void 0 : options.family) !== null && _h !== void 0 ? _h : this.family;
62
+ this.style = (_j = options === null || options === void 0 ? void 0 : options.style) !== null && _j !== void 0 ? _j : this.style;
63
+ this.bold = (_k = options === null || options === void 0 ? void 0 : options.bold) !== null && _k !== void 0 ? _k : this.bold;
64
+ this.size = (_l = options === null || options === void 0 ? void 0 : options.size) !== null && _l !== void 0 ? _l : this.size;
65
+ this.unit = (_m = options === null || options === void 0 ? void 0 : options.unit) !== null && _m !== void 0 ? _m : this.unit;
66
+ this.textAlign = (_o = options === null || options === void 0 ? void 0 : options.textAlign) !== null && _o !== void 0 ? _o : this.textAlign;
67
+ this.baseAlign = (_p = options === null || options === void 0 ? void 0 : options.baseAlign) !== null && _p !== void 0 ? _p : this.baseAlign;
68
+ this.direction = (_q = options === null || options === void 0 ? void 0 : options.direction) !== null && _q !== void 0 ? _q : this.direction;
69
+ this.quality = (_r = options === null || options === void 0 ? void 0 : options.quality) !== null && _r !== void 0 ? _r : this.quality;
70
+ if (options === null || options === void 0 ? void 0 : options.shadow) {
71
+ this.shadow = {};
72
+ this.shadow.blur = (_s = options.shadow.blur) !== null && _s !== void 0 ? _s : this.shadow.blur;
73
+ this.shadow.offset = (_t = options.shadow.offset) !== null && _t !== void 0 ? _t : this.shadow.offset;
74
+ this.shadow.color = (_u = options.shadow.color) !== null && _u !== void 0 ? _u : this.shadow.color;
75
+ }
76
+ }
77
+ clone() {
78
+ return new Font({
79
+ ...this.cloneGraphicOptions(),
80
+ size: this.size,
81
+ unit: this.unit,
82
+ family: this.family,
83
+ style: this.style,
84
+ bold: this.bold,
85
+ textAlign: this.textAlign,
86
+ baseAlign: this.baseAlign,
87
+ direction: this.direction,
88
+ shadow: this.shadow
89
+ ? {
90
+ blur: this.shadow.blur,
91
+ offset: this.shadow.offset,
92
+ color: this.shadow.color
93
+ }
94
+ : null
95
+ });
96
+ }
97
+ get fontString() {
98
+ return `${this.style} ${this.bold ? 'bold' : ''} ${this.size}${this.unit} ${this.family}`;
99
+ }
100
+ get localBounds() {
101
+ return this._textBounds;
102
+ }
103
+ _drawImage(_ex, _x, _y) {
104
+ // TODO weird vestigial drawimage
105
+ }
106
+ _rotate(ex) {
107
+ var _a;
108
+ // TODO this needs to change depending on the bounding box...
109
+ const origin = (_a = this.origin) !== null && _a !== void 0 ? _a : this._textBounds.center;
110
+ ex.translate(origin.x, origin.y);
111
+ ex.rotate(this.rotation);
112
+ ex.translate(-origin.x, -origin.y);
113
+ }
114
+ _flip(ex) {
115
+ if (this.flipHorizontal) {
116
+ ex.translate(this._textBounds.width / this.scale.x, 0);
117
+ ex.scale(-1, 1);
118
+ }
119
+ if (this.flipVertical) {
120
+ ex.translate(0, -this._textBounds.height / 2 / this.scale.y);
121
+ ex.scale(1, -1);
122
+ }
123
+ }
124
+ /**
125
+ * Returns a BoundingBox that is the total size of the text including multiple lines
126
+ *
127
+ * Does not include any padding or adjustment
128
+ * @param text
129
+ * @returns BoundingBox
130
+ */
131
+ measureText(text) {
132
+ const lines = text.split('\n');
133
+ const maxWidthLine = lines.reduce((a, b) => {
134
+ return a.length > b.length ? a : b;
135
+ });
136
+ const ctx = this._getTextBitmap(text);
137
+ this._applyFont(ctx); // font must be applied to the context to measure it
138
+ const metrics = ctx.measureText(maxWidthLine);
139
+ let textHeight = Math.abs(metrics.actualBoundingBoxAscent) + Math.abs(metrics.actualBoundingBoxDescent);
140
+ // TODO lineheight makes the text bounds wonky
141
+ const lineAdjustedHeight = textHeight * lines.length;
142
+ textHeight = lineAdjustedHeight;
143
+ const bottomBounds = lineAdjustedHeight - Math.abs(metrics.actualBoundingBoxAscent);
144
+ const x = 0;
145
+ const y = 0;
146
+ return new BoundingBox({
147
+ left: x - Math.abs(metrics.actualBoundingBoxLeft) - this.padding,
148
+ top: y - Math.abs(metrics.actualBoundingBoxAscent) - this.padding,
149
+ bottom: y + bottomBounds + this.padding,
150
+ right: x + Math.abs(metrics.actualBoundingBoxRight) + this.padding
151
+ });
152
+ }
153
+ _setDimension(textBounds, bitmap) {
154
+ // Changing the width and height clears the context properties
155
+ // We double the bitmap width to account for all possible alignment
156
+ // We scale by "quality" so we render text without jaggies
157
+ bitmap.canvas.width = (textBounds.width + this.padding * 2) * 2 * this.quality;
158
+ bitmap.canvas.height = (textBounds.height + this.padding * 2) * 2 * this.quality;
159
+ }
160
+ _postDraw(ex) {
161
+ ex.restore();
162
+ }
163
+ /**
164
+ * We need to identify bitmaps with more than just the text content
165
+ *
166
+ * Any properties that can change the rendering of the text
167
+ */
168
+ _getRasterPropertiesHash(color) {
169
+ var _a, _b;
170
+ const hash = '__hashcode__' +
171
+ this.fontString +
172
+ this.showDebug +
173
+ this.textAlign +
174
+ this.baseAlign +
175
+ this.direction +
176
+ JSON.stringify(this.shadow) +
177
+ (this.padding.toString() +
178
+ this.smoothing.toString() +
179
+ this.lineWidth.toString() +
180
+ this.lineDash.toString() +
181
+ ((_a = this.strokeColor) === null || _a === void 0 ? void 0 : _a.toString()) +
182
+ (color ? color.toString() : (_b = this.color) === null || _b === void 0 ? void 0 : _b.toString()).toString());
183
+ return hash;
184
+ }
185
+ _applyRasterProperties(ctx, color) {
186
+ var _a, _b, _c;
187
+ ctx.translate(this.padding, this.padding);
188
+ ctx.imageSmoothingEnabled = this.smoothing;
189
+ ctx.lineWidth = this.lineWidth;
190
+ ctx.setLineDash((_a = this.lineDash) !== null && _a !== void 0 ? _a : ctx.getLineDash());
191
+ ctx.strokeStyle = (_b = this.strokeColor) === null || _b === void 0 ? void 0 : _b.toString();
192
+ ctx.fillStyle = color ? color.toString() : (_c = this.color) === null || _c === void 0 ? void 0 : _c.toString();
193
+ }
194
+ _applyFont(ctx) {
195
+ ctx.translate(this.padding + ctx.canvas.width / 2, this.padding + ctx.canvas.height / 2);
196
+ ctx.scale(this.quality, this.quality);
197
+ ctx.textAlign = this.textAlign;
198
+ ctx.textBaseline = this.baseAlign;
199
+ ctx.font = this.fontString;
200
+ ctx.direction = this.direction;
201
+ if (this.shadow) {
202
+ ctx.shadowColor = this.shadow.color.toString();
203
+ ctx.shadowBlur = this.shadow.blur;
204
+ ctx.shadowOffsetX = this.shadow.offset.x;
205
+ ctx.shadowOffsetY = this.shadow.offset.y;
206
+ }
207
+ }
208
+ _drawText(ctx, text, colorOverride, lineHeight) {
209
+ const lines = text.split('\n');
210
+ this._applyRasterProperties(ctx, colorOverride);
211
+ this._applyFont(ctx);
212
+ for (let i = 0; i < lines.length; i++) {
213
+ const line = lines[i];
214
+ if (this.color) {
215
+ ctx.fillText(line, 0, i * lineHeight);
216
+ }
217
+ if (this.strokeColor) {
218
+ ctx.strokeText(line, 0, i * lineHeight);
219
+ }
220
+ }
221
+ if (this.showDebug) {
222
+ // Horizontal line
223
+ /* istanbul ignore next */
224
+ line(ctx, Color.Red, -ctx.canvas.width / 2, 0, ctx.canvas.width / 2, 0, 2);
225
+ // Vertical line
226
+ /* istanbul ignore next */
227
+ line(ctx, Color.Red, 0, -ctx.canvas.height / 2, 0, ctx.canvas.height / 2, 2);
228
+ }
229
+ }
230
+ _getTextBitmap(text, color) {
231
+ const textAndHash = text + this._getRasterPropertiesHash(color);
232
+ const bitmap = this._textToBitmap.get(textAndHash);
233
+ if (bitmap) {
234
+ return bitmap;
235
+ }
236
+ const canvas = document.createElement('canvas');
237
+ const ctx = canvas.getContext('2d');
238
+ this._textToBitmap.set(textAndHash, ctx);
239
+ return ctx;
240
+ }
241
+ render(ex, text, colorOverride, x, y) {
242
+ if (this.showDebug) {
243
+ this.clearCache();
244
+ }
245
+ this.checkAndClearCache();
246
+ const bitmap = this._getTextBitmap(text, colorOverride);
247
+ const isNewBitmap = !this._bitmapUsage.get(bitmap);
248
+ this._textBounds = this.measureText(text);
249
+ if (isNewBitmap) {
250
+ this._setDimension(this._textBounds, bitmap);
251
+ }
252
+ this._preDraw(ex, x, y);
253
+ const lines = text.split('\n');
254
+ const lineHeight = this._textBounds.height / lines.length;
255
+ const rasterWidth = bitmap.canvas.width;
256
+ const rasterHeight = bitmap.canvas.height;
257
+ if (isNewBitmap) {
258
+ // draws the text to the bitmap
259
+ this._drawText(bitmap, text, colorOverride, lineHeight);
260
+ // draws the bitmap to excalibur graphics context
261
+ TextureLoader.load(bitmap.canvas, this.filtering, true);
262
+ }
263
+ ex.drawImage(bitmap.canvas, 0, 0, rasterWidth, rasterHeight, x - rasterWidth / this.quality / 2, y - rasterHeight / this.quality / 2, rasterWidth / this.quality, rasterHeight / this.quality);
264
+ this._postDraw(ex);
265
+ // Cache the bitmap for certain amount of time
266
+ this._bitmapUsage.set(bitmap, performance.now());
267
+ }
268
+ /**
269
+ * Get the internal cache size of the font
270
+ * This is useful when debugging memory usage, these numbers indicate the number of cached in memory text bitmaps
271
+ */
272
+ get cacheSize() {
273
+ return this._bitmapUsage.size;
274
+ }
275
+ /**
276
+ * Force clear all cached text bitmaps
277
+ */
278
+ clearCache() {
279
+ this._bitmapUsage.clear();
280
+ }
281
+ /**
282
+ * Remove any expired cached text bitmaps
283
+ */
284
+ checkAndClearCache() {
285
+ for (const [bitmap, time] of this._bitmapUsage.entries()) {
286
+ // if bitmap hasn't been used in 1 second clear it
287
+ if (time + 1000 < performance.now()) {
288
+ this._bitmapUsage.delete(bitmap);
289
+ }
290
+ }
291
+ }
292
+ }
293
+ //# sourceMappingURL=Font.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Font.js","sourceRoot":"","sources":["../../../src/engine/Graphics/Font.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAe,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAgB,MAAM,cAAc,CAAC;AAC/G,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,OAAO,IAAK,SAAQ,OAAO;IAO/B,YAAY,UAAwD,EAAE;;QACpE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB;QAP3C;;;;WAIG;QACI,cAAS,GAAmB,cAAc,CAAC,OAAO,CAAC;QAoD1D;;;;;;;WAOG;QACI,YAAO,GAAG,CAAC,CAAC;QAEnB,8BAA8B;QACvB,YAAO,GAAG,CAAC,CAAC;QACZ,cAAS,GAAG,KAAK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AG,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,EAAE;gBACnC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aAClC;SACF;IACH,CAAC;CACF"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Enum representing the different font size units
3
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
4
+ */
5
+ export var FontUnit;
6
+ (function (FontUnit) {
7
+ /**
8
+ * Em is a scalable unit, 1 em is equal to the current font size of the current element, parent elements can effect em values
9
+ */
10
+ FontUnit["Em"] = "em";
11
+ /**
12
+ * Rem is similar to the Em, it is a scalable unit. 1 rem is equal to the font size of the root element
13
+ */
14
+ FontUnit["Rem"] = "rem";
15
+ /**
16
+ * Pixel is a unit of length in screen pixels
17
+ */
18
+ FontUnit["Px"] = "px";
19
+ /**
20
+ * Point is a physical unit length (1/72 of an inch)
21
+ */
22
+ FontUnit["Pt"] = "pt";
23
+ /**
24
+ * Percent is a scalable unit similar to Em, the only difference is the Em units scale faster when Text-Size stuff
25
+ */
26
+ FontUnit["Percent"] = "%";
27
+ })(FontUnit || (FontUnit = {}));
28
+ /**
29
+ * Enum representing the different horizontal text alignments
30
+ */
31
+ export var TextAlign;
32
+ (function (TextAlign) {
33
+ /**
34
+ * The text is left-aligned.
35
+ */
36
+ TextAlign["Left"] = "left";
37
+ /**
38
+ * The text is right-aligned.
39
+ */
40
+ TextAlign["Right"] = "right";
41
+ /**
42
+ * The text is centered.
43
+ */
44
+ TextAlign["Center"] = "center";
45
+ /**
46
+ * The text is aligned at the normal start of the line (left-aligned for left-to-right locales,
47
+ * right-aligned for right-to-left locales).
48
+ */
49
+ TextAlign["Start"] = "start";
50
+ /**
51
+ * The text is aligned at the normal end of the line (right-aligned for left-to-right locales,
52
+ * left-aligned for right-to-left locales).
53
+ */
54
+ TextAlign["End"] = "end";
55
+ })(TextAlign || (TextAlign = {}));
56
+ /**
57
+ * Enum representing the different baseline text alignments
58
+ */
59
+ export var BaseAlign;
60
+ (function (BaseAlign) {
61
+ /**
62
+ * The text baseline is the top of the em square.
63
+ */
64
+ BaseAlign["Top"] = "top";
65
+ /**
66
+ * The text baseline is the hanging baseline. Currently unsupported; this will act like
67
+ * alphabetic.
68
+ */
69
+ BaseAlign["Hanging"] = "hanging";
70
+ /**
71
+ * The text baseline is the middle of the em square.
72
+ */
73
+ BaseAlign["Middle"] = "middle";
74
+ /**
75
+ * The text baseline is the normal alphabetic baseline.
76
+ */
77
+ BaseAlign["Alphabetic"] = "alphabetic";
78
+ /**
79
+ * The text baseline is the ideographic baseline; this is the bottom of
80
+ * the body of the characters, if the main body of characters protrudes
81
+ * beneath the alphabetic baseline. Currently unsupported; this will
82
+ * act like alphabetic.
83
+ */
84
+ BaseAlign["Ideographic"] = "ideographic";
85
+ /**
86
+ * The text baseline is the bottom of the bounding box. This differs
87
+ * from the ideographic baseline in that the ideographic baseline
88
+ * doesn't consider descenders.
89
+ */
90
+ BaseAlign["Bottom"] = "bottom";
91
+ })(BaseAlign || (BaseAlign = {}));
92
+ /**
93
+ * Enum representing the different possible font styles
94
+ */
95
+ export var FontStyle;
96
+ (function (FontStyle) {
97
+ FontStyle["Normal"] = "normal";
98
+ FontStyle["Italic"] = "italic";
99
+ FontStyle["Oblique"] = "oblique";
100
+ })(FontStyle || (FontStyle = {}));
101
+ /**
102
+ * Enum representing the text direction, useful for other languages, or writing text in reverse
103
+ */
104
+ export var Direction;
105
+ (function (Direction) {
106
+ Direction["LeftToRight"] = "ltr";
107
+ Direction["RightToLeft"] = "rtl";
108
+ })(Direction || (Direction = {}));
109
+ //# sourceMappingURL=FontCommon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FontCommon.js","sourceRoot":"","sources":["../../../src/engine/Graphics/FontCommon.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,CAAN,IAAY,QAqBX;AArBD,WAAY,QAAQ;IAClB;;OAEG;IACH,qBAAS,CAAA;IACT;;OAEG;IACH,uBAAW,CAAA;IACX;;OAEG;IACH,qBAAS,CAAA;IACT;;OAEG;IACH,qBAAS,CAAA;IACT;;OAEG;IACH,yBAAa,CAAA;AACf,CAAC,EArBW,QAAQ,KAAR,QAAQ,QAqBnB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SAuBX;AAvBD,WAAY,SAAS;IACnB;;OAEG;IACH,0BAAa,CAAA;IACb;;OAEG;IACH,4BAAe,CAAA;IACf;;OAEG;IACH,8BAAiB,CAAA;IACjB;;;OAGG;IACH,4BAAe,CAAA;IACf;;;OAGG;IACH,wBAAW,CAAA;AACb,CAAC,EAvBW,SAAS,KAAT,SAAS,QAuBpB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SA+BX;AA/BD,WAAY,SAAS;IACnB;;OAEG;IACH,wBAAW,CAAA;IACX;;;OAGG;IACH,gCAAmB,CAAA;IACnB;;OAEG;IACH,8BAAiB,CAAA;IACjB;;OAEG;IACH,sCAAyB,CAAA;IACzB;;;;;OAKG;IACH,wCAA2B,CAAA;IAC3B;;;;OAIG;IACH,8BAAiB,CAAA;AACnB,CAAC,EA/BW,SAAS,KAAT,SAAS,QA+BpB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;IACjB,gCAAmB,CAAA;AACrB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,gCAAmB,CAAA;IACnB,gCAAmB,CAAA;AACrB,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB"}