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.
- package/CHANGELOG.md +7 -2
- package/build/dist/Actions/Action/Blink.js +51 -0
- package/build/dist/Actions/Action/Blink.js.map +1 -0
- package/build/dist/Actions/Action/CallMethod.js +21 -0
- package/build/dist/Actions/Action/CallMethod.js.map +1 -0
- package/build/dist/Actions/Action/Delay.js +25 -0
- package/build/dist/Actions/Action/Delay.js.map +1 -0
- package/build/dist/Actions/Action/Die.js +22 -0
- package/build/dist/Actions/Action/Die.js.map +1 -0
- package/build/dist/Actions/Action/EaseTo.js +69 -0
- package/build/dist/Actions/Action/EaseTo.js.map +1 -0
- package/build/dist/Actions/Action/Fade.js +46 -0
- package/build/dist/Actions/Action/Fade.js.map +1 -0
- package/build/dist/Actions/Action/Follow.js +55 -0
- package/build/dist/Actions/Action/Follow.js.map +1 -0
- package/build/dist/Actions/Action/Meet.js +52 -0
- package/build/dist/Actions/Action/Meet.js.map +1 -0
- package/build/dist/Actions/Action/MoveBy.js +47 -0
- package/build/dist/Actions/Action/MoveBy.js.map +1 -0
- package/build/dist/Actions/Action/MoveTo.js +40 -0
- package/build/dist/Actions/Action/MoveTo.js.map +1 -0
- package/build/dist/Actions/Action/Repeat.js +31 -0
- package/build/dist/Actions/Action/Repeat.js.map +1 -0
- package/build/dist/Actions/Action/RepeatForever.js +37 -0
- package/build/dist/Actions/Action/RepeatForever.js.map +1 -0
- package/build/dist/Actions/Action/RotateBy.js +91 -0
- package/build/dist/Actions/Action/RotateBy.js.map +1 -0
- package/build/dist/Actions/Action/RotateTo.js +90 -0
- package/build/dist/Actions/Action/RotateTo.js.map +1 -0
- package/build/dist/Actions/Action/ScaleBy.js +45 -0
- package/build/dist/Actions/Action/ScaleBy.js.map +1 -0
- package/build/dist/Actions/Action/ScaleTo.js +56 -0
- package/build/dist/Actions/Action/ScaleTo.js.map +1 -0
- package/build/dist/Actions/Action.js +2 -0
- package/build/dist/Actions/Action.js.map +1 -0
- package/build/dist/Actions/ActionContext.js +305 -0
- package/build/dist/Actions/ActionContext.js.map +1 -0
- package/build/dist/Actions/ActionQueue.js +87 -0
- package/build/dist/Actions/ActionQueue.js.map +1 -0
- package/build/dist/Actions/Actionable.js +2 -0
- package/build/dist/Actions/Actionable.js.map +1 -0
- package/build/dist/Actions/ActionsComponent.js +198 -0
- package/build/dist/Actions/ActionsComponent.js.map +1 -0
- package/build/dist/Actions/ActionsSystem.js +18 -0
- package/build/dist/Actions/ActionsSystem.js.map +1 -0
- package/build/dist/Actions/Index.js +22 -0
- package/build/dist/Actions/Index.js.map +1 -0
- package/build/dist/Actions/RotationType.js +27 -0
- package/build/dist/Actions/RotationType.js.map +1 -0
- package/build/dist/Actor.js +831 -0
- package/build/dist/Actor.js.map +1 -0
- package/build/dist/Camera.js +663 -0
- package/build/dist/Camera.js.map +1 -0
- package/build/dist/Class.js +48 -0
- package/build/dist/Class.js.map +1 -0
- package/build/dist/Collision/BodyComponent.js +351 -0
- package/build/dist/Collision/BodyComponent.js.map +1 -0
- package/build/dist/Collision/BoundingBox.js +361 -0
- package/build/dist/Collision/BoundingBox.js.map +1 -0
- package/build/dist/Collision/ColliderComponent.js +198 -0
- package/build/dist/Collision/ColliderComponent.js.map +1 -0
- package/build/dist/Collision/Colliders/CircleCollider.js +264 -0
- package/build/dist/Collision/Colliders/CircleCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js +211 -0
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/Collider.js +26 -0
- package/build/dist/Collision/Colliders/Collider.js.map +1 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js +301 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/CompositeCollider.js +232 -0
- package/build/dist/Collision/Colliders/CompositeCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js +253 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js +389 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/SeparatingAxis.js +67 -0
- package/build/dist/Collision/Colliders/SeparatingAxis.js.map +1 -0
- package/build/dist/Collision/Colliders/Shape.js +102 -0
- package/build/dist/Collision/Colliders/Shape.js.map +1 -0
- package/build/dist/Collision/CollisionSystem.js +116 -0
- package/build/dist/Collision/CollisionSystem.js.map +1 -0
- package/build/dist/Collision/CollisionType.js +33 -0
- package/build/dist/Collision/CollisionType.js.map +1 -0
- package/build/dist/Collision/Detection/CollisionContact.js +46 -0
- package/build/dist/Collision/Detection/CollisionContact.js.map +1 -0
- package/build/dist/Collision/Detection/CollisionProcessor.js +2 -0
- package/build/dist/Collision/Detection/CollisionProcessor.js.map +1 -0
- package/build/dist/Collision/Detection/DynamicTree.js +442 -0
- package/build/dist/Collision/Detection/DynamicTree.js.map +1 -0
- package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.js +211 -0
- package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.js.map +1 -0
- package/build/dist/Collision/Detection/Pair.js +92 -0
- package/build/dist/Collision/Detection/Pair.js.map +1 -0
- package/build/dist/Collision/Group/CollisionGroup.js +114 -0
- package/build/dist/Collision/Group/CollisionGroup.js.map +1 -0
- package/build/dist/Collision/Group/CollisionGroupManager.js +52 -0
- package/build/dist/Collision/Group/CollisionGroupManager.js.map +1 -0
- package/build/dist/Collision/Index.js +29 -0
- package/build/dist/Collision/Index.js.map +1 -0
- package/build/dist/Collision/Integrator.js +11 -0
- package/build/dist/Collision/Integrator.js.map +1 -0
- package/build/dist/Collision/MotionSystem.js +42 -0
- package/build/dist/Collision/MotionSystem.js.map +1 -0
- package/build/dist/Collision/Physics.js +163 -0
- package/build/dist/Collision/Physics.js.map +1 -0
- package/build/dist/Collision/Side.js +51 -0
- package/build/dist/Collision/Side.js.map +1 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js +101 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js.map +1 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js +83 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js.map +1 -0
- package/build/dist/Collision/Solver/RealisticSolver.js +248 -0
- package/build/dist/Collision/Solver/RealisticSolver.js.map +1 -0
- package/build/dist/Collision/Solver/Solver.js +37 -0
- package/build/dist/Collision/Solver/Solver.js.map +1 -0
- package/build/dist/Color.js +461 -0
- package/build/dist/Color.js.map +1 -0
- package/build/dist/Configurable.js +32 -0
- package/build/dist/Configurable.js.map +1 -0
- package/build/dist/Debug/Debug.js +375 -0
- package/build/dist/Debug/Debug.js.map +1 -0
- package/build/dist/Debug/DebugFlags.js +40 -0
- package/build/dist/Debug/DebugFlags.js.map +1 -0
- package/build/dist/Debug/DebugSystem.js +251 -0
- package/build/dist/Debug/DebugSystem.js.map +1 -0
- package/build/dist/Debug/index.js +4 -0
- package/build/dist/Debug/index.js.map +1 -0
- package/build/dist/Deprecated.js +2 -0
- package/build/dist/Deprecated.js.map +1 -0
- package/build/dist/Drawing/Animation.js +294 -0
- package/build/dist/Drawing/Animation.js.map +1 -0
- package/build/dist/Drawing/CanvasDrawComponent.js +16 -0
- package/build/dist/Drawing/CanvasDrawComponent.js.map +1 -0
- package/build/dist/Drawing/CanvasDrawingSystem.js +95 -0
- package/build/dist/Drawing/CanvasDrawingSystem.js.map +1 -0
- package/build/dist/Drawing/Index.js +10 -0
- package/build/dist/Drawing/Index.js.map +1 -0
- package/build/dist/Drawing/Polygon.js +139 -0
- package/build/dist/Drawing/Polygon.js.map +1 -0
- package/build/dist/Drawing/Sprite.js +355 -0
- package/build/dist/Drawing/Sprite.js.map +1 -0
- package/build/dist/Drawing/SpriteEffects.js +246 -0
- package/build/dist/Drawing/SpriteEffects.js.map +1 -0
- package/build/dist/Drawing/SpriteSheet.js +413 -0
- package/build/dist/Drawing/SpriteSheet.js.map +1 -0
- package/build/dist/Drawing/Texture.js +69 -0
- package/build/dist/Drawing/Texture.js.map +1 -0
- package/build/dist/Engine.d.ts +4 -1
- package/build/dist/Engine.js +985 -0
- package/build/dist/Engine.js.map +1 -0
- package/build/dist/EntityComponentSystem/Component.js +65 -0
- package/build/dist/EntityComponentSystem/Component.js.map +1 -0
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js +33 -0
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js +249 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Entity.js +452 -0
- package/build/dist/EntityComponentSystem/Entity.js.map +1 -0
- package/build/dist/EntityComponentSystem/EntityManager.js +128 -0
- package/build/dist/EntityComponentSystem/EntityManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Query.js +91 -0
- package/build/dist/EntityComponentSystem/Query.js.map +1 -0
- package/build/dist/EntityComponentSystem/QueryManager.js +90 -0
- package/build/dist/EntityComponentSystem/QueryManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/System.js +76 -0
- package/build/dist/EntityComponentSystem/System.js.map +1 -0
- package/build/dist/EntityComponentSystem/SystemManager.js +102 -0
- package/build/dist/EntityComponentSystem/SystemManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Util.js +5 -0
- package/build/dist/EntityComponentSystem/Util.js.map +1 -0
- package/build/dist/EntityComponentSystem/World.js +55 -0
- package/build/dist/EntityComponentSystem/World.js.map +1 -0
- package/build/dist/EntityComponentSystem/index.js +11 -0
- package/build/dist/EntityComponentSystem/index.js.map +1 -0
- package/build/dist/EventDispatcher.js +114 -0
- package/build/dist/EventDispatcher.js.map +1 -0
- package/build/dist/Events/ExEvent.js +12 -0
- package/build/dist/Events/ExEvent.js.map +1 -0
- package/build/dist/Events/MediaEvents.js +75 -0
- package/build/dist/Events/MediaEvents.js.map +1 -0
- package/build/dist/Events/PointerEvents.js +52 -0
- package/build/dist/Events/PointerEvents.js.map +1 -0
- package/build/dist/Events.js +497 -0
- package/build/dist/Events.js.map +1 -0
- package/build/dist/Flags.js +90 -0
- package/build/dist/Flags.js.map +1 -0
- package/build/dist/Graphics/Animation.js +310 -0
- package/build/dist/Graphics/Animation.js.map +1 -0
- package/build/dist/Graphics/Canvas.js +38 -0
- package/build/dist/Graphics/Canvas.js.map +1 -0
- package/build/dist/Graphics/Circle.js +47 -0
- package/build/dist/Graphics/Circle.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js +2 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js +207 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js +331 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js.map +1 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js +160 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/debug-text.js +47 -0
- package/build/dist/Graphics/Context/debug-text.js.map +1 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js +209 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js +87 -0
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js +82 -0
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/quad-index-buffer.js +69 -0
- package/build/dist/Graphics/Context/quad-index-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js +272 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/render-source.js +16 -0
- package/build/dist/Graphics/Context/render-source.js.map +1 -0
- package/build/dist/Graphics/Context/render-target.js +65 -0
- package/build/dist/Graphics/Context/render-target.js.map +1 -0
- package/build/dist/Graphics/Context/renderer.js +2 -0
- package/build/dist/Graphics/Context/renderer.js.map +1 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js +53 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js.map +1 -0
- package/build/dist/Graphics/Context/shader.js +236 -0
- package/build/dist/Graphics/Context/shader.js.map +1 -0
- package/build/dist/Graphics/Context/state-stack.js +27 -0
- package/build/dist/Graphics/Context/state-stack.js.map +1 -0
- package/build/dist/Graphics/Context/texture-loader.d.ts +8 -0
- package/build/dist/Graphics/Context/texture-loader.js +121 -0
- package/build/dist/Graphics/Context/texture-loader.js.map +1 -0
- package/build/dist/Graphics/Context/transform-stack.js +30 -0
- package/build/dist/Graphics/Context/transform-stack.js.map +1 -0
- package/build/dist/Graphics/Context/vertex-buffer.js +45 -0
- package/build/dist/Graphics/Context/vertex-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/vertex-layout.js +93 -0
- package/build/dist/Graphics/Context/vertex-layout.js.map +1 -0
- package/build/dist/Graphics/Context/webgl-adapter.js +19 -0
- package/build/dist/Graphics/Context/webgl-adapter.js.map +1 -0
- package/build/dist/Graphics/Context/webgl-util.js +105 -0
- package/build/dist/Graphics/Context/webgl-util.js.map +1 -0
- package/build/dist/Graphics/DebugGraphicsComponent.js +15 -0
- package/build/dist/Graphics/DebugGraphicsComponent.js.map +1 -0
- package/build/dist/Graphics/Filtering.js +17 -0
- package/build/dist/Graphics/Filtering.js.map +1 -0
- package/build/dist/Graphics/Font.js +293 -0
- package/build/dist/Graphics/Font.js.map +1 -0
- package/build/dist/Graphics/FontCommon.js +109 -0
- package/build/dist/Graphics/FontCommon.js.map +1 -0
- package/build/dist/Graphics/Graphic.js +200 -0
- package/build/dist/Graphics/Graphic.js.map +1 -0
- package/build/dist/Graphics/GraphicsComponent.js +290 -0
- package/build/dist/Graphics/GraphicsComponent.js.map +1 -0
- package/build/dist/Graphics/GraphicsDiagnostics.js +9 -0
- package/build/dist/Graphics/GraphicsDiagnostics.js.map +1 -0
- package/build/dist/Graphics/GraphicsGroup.js +69 -0
- package/build/dist/Graphics/GraphicsGroup.js.map +1 -0
- package/build/dist/Graphics/GraphicsSystem.js +153 -0
- package/build/dist/Graphics/GraphicsSystem.js.map +1 -0
- package/build/dist/Graphics/ImageSource.js +116 -0
- package/build/dist/Graphics/ImageSource.js.map +1 -0
- package/build/dist/Graphics/Polygon.js +59 -0
- package/build/dist/Graphics/Polygon.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js +7 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js +52 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.js +2 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js +56 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js.map +1 -0
- package/build/dist/Graphics/Raster.js +207 -0
- package/build/dist/Graphics/Raster.js.map +1 -0
- package/build/dist/Graphics/Rectangle.js +29 -0
- package/build/dist/Graphics/Rectangle.js.map +1 -0
- package/build/dist/Graphics/Sprite.js +103 -0
- package/build/dist/Graphics/Sprite.js.map +1 -0
- package/build/dist/Graphics/SpriteFont.js +120 -0
- package/build/dist/Graphics/SpriteFont.js.map +1 -0
- package/build/dist/Graphics/SpriteSheet.js +115 -0
- package/build/dist/Graphics/SpriteSheet.js.map +1 -0
- package/build/dist/Graphics/Text.js +94 -0
- package/build/dist/Graphics/Text.js.map +1 -0
- package/build/dist/Graphics/index.js +42 -0
- package/build/dist/Graphics/index.js.map +1 -0
- package/build/dist/Id.js +8 -0
- package/build/dist/Id.js.map +1 -0
- package/build/dist/Input/CapturePointerConfig.js +5 -0
- package/build/dist/Input/CapturePointerConfig.js.map +1 -0
- package/build/dist/Input/EngineInput.js +2 -0
- package/build/dist/Input/EngineInput.js.map +1 -0
- package/build/dist/Input/Gamepad.js +358 -0
- package/build/dist/Input/Gamepad.js.map +1 -0
- package/build/dist/Input/Index.js +22 -0
- package/build/dist/Input/Index.js.map +1 -0
- package/build/dist/Input/Keyboard.js +267 -0
- package/build/dist/Input/Keyboard.js.map +1 -0
- package/build/dist/Input/NativePointerButton.js +12 -0
- package/build/dist/Input/NativePointerButton.js.map +1 -0
- package/build/dist/Input/PointerAbstraction.js +41 -0
- package/build/dist/Input/PointerAbstraction.js.map +1 -0
- package/build/dist/Input/PointerButton.js +12 -0
- package/build/dist/Input/PointerButton.js.map +1 -0
- package/build/dist/Input/PointerComponent.js +28 -0
- package/build/dist/Input/PointerComponent.js.map +1 -0
- package/build/dist/Input/PointerEvent.js +25 -0
- package/build/dist/Input/PointerEvent.js.map +1 -0
- package/build/dist/Input/PointerEventReceiver.js +414 -0
- package/build/dist/Input/PointerEventReceiver.js.map +1 -0
- package/build/dist/Input/PointerScope.js +16 -0
- package/build/dist/Input/PointerScope.js.map +1 -0
- package/build/dist/Input/PointerSystem.js +217 -0
- package/build/dist/Input/PointerSystem.js.map +1 -0
- package/build/dist/Input/PointerType.js +11 -0
- package/build/dist/Input/PointerType.js.map +1 -0
- package/build/dist/Input/WheelDeltaMode.js +7 -0
- package/build/dist/Input/WheelDeltaMode.js.map +1 -0
- package/build/dist/Input/WheelEvent.js +21 -0
- package/build/dist/Input/WheelEvent.js.map +1 -0
- package/build/dist/Interfaces/Audio.js +2 -0
- package/build/dist/Interfaces/Audio.js.map +1 -0
- package/build/dist/Interfaces/AudioImplementation.js +11 -0
- package/build/dist/Interfaces/AudioImplementation.js.map +1 -0
- package/build/dist/Interfaces/Clonable.js +2 -0
- package/build/dist/Interfaces/Clonable.js.map +1 -0
- package/build/dist/Interfaces/Drawable.js +2 -0
- package/build/dist/Interfaces/Drawable.js.map +1 -0
- package/build/dist/Interfaces/Evented.js +2 -0
- package/build/dist/Interfaces/Evented.js.map +1 -0
- package/build/dist/Interfaces/Index.js +10 -0
- package/build/dist/Interfaces/Index.js.map +1 -0
- package/build/dist/Interfaces/LifecycleEvents.js +51 -0
- package/build/dist/Interfaces/LifecycleEvents.js.map +1 -0
- package/build/dist/Interfaces/Loadable.js +2 -0
- package/build/dist/Interfaces/Loadable.js.map +1 -0
- package/build/dist/Interfaces/PointerEventHandlers.js +2 -0
- package/build/dist/Interfaces/PointerEventHandlers.js.map +1 -0
- package/build/dist/Interfaces/Trait.js +2 -0
- package/build/dist/Interfaces/Trait.js.map +1 -0
- package/build/dist/Label.js +273 -0
- package/build/dist/Label.js.map +1 -0
- package/build/dist/Loader.js +367 -0
- package/build/dist/Loader.js.map +1 -0
- package/build/dist/Math/Index.js +10 -0
- package/build/dist/Math/Index.js.map +1 -0
- package/build/dist/Math/Random.js +239 -0
- package/build/dist/Math/Random.js.map +1 -0
- package/build/dist/Math/global-coordinates.js +30 -0
- package/build/dist/Math/global-coordinates.js.map +1 -0
- package/build/dist/Math/line.js +194 -0
- package/build/dist/Math/line.js.map +1 -0
- package/build/dist/Math/matrix.js +446 -0
- package/build/dist/Math/matrix.js.map +1 -0
- package/build/dist/Math/projection.js +24 -0
- package/build/dist/Math/projection.js.map +1 -0
- package/build/dist/Math/ray.js +52 -0
- package/build/dist/Math/ray.js.map +1 -0
- package/build/dist/Math/util.js +82 -0
- package/build/dist/Math/util.js.map +1 -0
- package/build/dist/Math/vector-view.js +25 -0
- package/build/dist/Math/vector-view.js.map +1 -0
- package/build/dist/Math/vector.js +326 -0
- package/build/dist/Math/vector.js.map +1 -0
- package/build/dist/Particles.js +449 -0
- package/build/dist/Particles.js.map +1 -0
- package/build/dist/Polyfill.js +56 -0
- package/build/dist/Polyfill.js.map +1 -0
- package/build/dist/Promises.js +205 -0
- package/build/dist/Promises.js.map +1 -0
- package/build/dist/Resources/Gif.js +479 -0
- package/build/dist/Resources/Gif.js.map +1 -0
- package/build/dist/Resources/Index.js +4 -0
- package/build/dist/Resources/Index.js.map +1 -0
- package/build/dist/Resources/Resource.js +74 -0
- package/build/dist/Resources/Resource.js.map +1 -0
- package/build/dist/Resources/Sound/AudioContext.js +16 -0
- package/build/dist/Resources/Sound/AudioContext.js.map +1 -0
- package/build/dist/Resources/Sound/Index.js +4 -0
- package/build/dist/Resources/Sound/Index.js.map +1 -0
- package/build/dist/Resources/Sound/Sound.js +240 -0
- package/build/dist/Resources/Sound/Sound.js.map +1 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js +160 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js.map +1 -0
- package/build/dist/Scene.js +458 -0
- package/build/dist/Scene.js.map +1 -0
- package/build/dist/Screen.js +634 -0
- package/build/dist/Screen.js.map +1 -0
- package/build/dist/ScreenElement.js +29 -0
- package/build/dist/ScreenElement.js.map +1 -0
- package/build/dist/TileMap.js +488 -0
- package/build/dist/TileMap.js.map +1 -0
- package/build/dist/Timer.js +198 -0
- package/build/dist/Timer.js.map +1 -0
- package/build/dist/Traits/Index.js +5 -0
- package/build/dist/Traits/Index.js.map +1 -0
- package/build/dist/Traits/OffscreenCulling.js +35 -0
- package/build/dist/Traits/OffscreenCulling.js.map +1 -0
- package/build/dist/Trigger.js +113 -0
- package/build/dist/Trigger.js.map +1 -0
- package/build/dist/Util/Actors.js +19 -0
- package/build/dist/Util/Actors.js.map +1 -0
- package/build/dist/Util/Browser.js +66 -0
- package/build/dist/Util/Browser.js.map +1 -0
- package/build/dist/Util/Clock.js +219 -0
- package/build/dist/Util/Clock.js.map +1 -0
- package/build/dist/Util/CullingBox.js +104 -0
- package/build/dist/Util/CullingBox.js.map +1 -0
- package/build/dist/Util/Decorators.js +78 -0
- package/build/dist/Util/Decorators.js.map +1 -0
- package/build/dist/Util/Detector.js +167 -0
- package/build/dist/Util/Detector.js.map +1 -0
- package/build/dist/Util/DrawUtil.js +117 -0
- package/build/dist/Util/DrawUtil.js.map +1 -0
- package/build/dist/Util/EasingFunctions.js +118 -0
- package/build/dist/Util/EasingFunctions.js.map +1 -0
- package/build/dist/Util/Fps.js +47 -0
- package/build/dist/Util/Fps.js.map +1 -0
- package/build/dist/Util/Index.js +7 -0
- package/build/dist/Util/Index.js.map +1 -0
- package/build/dist/Util/Log.js +195 -0
- package/build/dist/Util/Log.js.map +1 -0
- package/build/dist/Util/Observable.js +60 -0
- package/build/dist/Util/Observable.js.map +1 -0
- package/build/dist/Util/Pool.js +66 -0
- package/build/dist/Util/Pool.js.map +1 -0
- package/build/dist/Util/SortedList.js +261 -0
- package/build/dist/Util/SortedList.js.map +1 -0
- package/build/dist/Util/Sound.js +22 -0
- package/build/dist/Util/Sound.js.map +1 -0
- package/build/dist/Util/Util.js +294 -0
- package/build/dist/Util/Util.js.map +1 -0
- package/build/dist/Util/Watch.js +67 -0
- package/build/dist/Util/Watch.js.map +1 -0
- package/build/dist/Util/WebAudio.js +62 -0
- package/build/dist/Util/WebAudio.js.map +1 -0
- package/build/dist/excalibur.js +101 -22
- package/build/dist/excalibur.js.map +1 -1
- package/build/dist/excalibur.min.js +1 -1
- package/build/dist/excalibur.min.js.LICENSE.txt +1 -1
- package/build/dist/excalibur.min.js.map +1 -1
- package/build/dist/index.js +74 -0
- package/build/dist/index.js.map +1 -0
- package/build/esm/Engine.d.ts +4 -1
- package/build/esm/Graphics/Context/texture-loader.d.ts +8 -0
- package/build/esm/excalibur.js +101 -22
- package/build/esm/excalibur.js.map +1 -1
- package/build/esm/excalibur.min.js +1 -1
- package/build/esm/excalibur.min.js.LICENSE.txt +1 -1
- package/build/esm/excalibur.min.js.map +1 -1
- 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,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,cAAc;YACpB,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,IAAI;YACV,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,aAAa;YACnB,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,CAAC;KACZ;AACH,CAAC;AAGD;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,EAAyB,EAAE,IAAY;IAC/E,QAAQ,IAAI,E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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
|
+
}
|
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AAa,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SACzD;QAED,EAAE,CAAC,SAAS,CACV,MAAM,CAAC,MAAM,EACb,CAAC,EACD,CAAC,EACD,WAAW,EACX,YAAY,EACZ,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,EAClC,CAAC,GAAG,YAAY,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,EACnC,WAAW,GAAG,IAAI,CAAC,OAAO,EAC1B,YAAY,GAAG,IAAI,CAAC,OAAO,CAC5B,CAAC;QAEF,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAEnB,8CAA8C;QAC9C,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,UAAU;QACf,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,kBAAkB;QACvB,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE;YACxD,kDAAkD;YAClD,IAAI,IAAI,GAAG,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"}
|