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,153 @@
|
|
|
1
|
+
import { GraphicsComponent } from './GraphicsComponent';
|
|
2
|
+
import { vec } from '../Math/vector';
|
|
3
|
+
import { CoordPlane, TransformComponent } from '../EntityComponentSystem/Components/TransformComponent';
|
|
4
|
+
import { System, SystemType, TagComponent } from '../EntityComponentSystem';
|
|
5
|
+
import { EnterViewPortEvent, ExitViewPortEvent } from '../Events';
|
|
6
|
+
import { GraphicsGroup } from '.';
|
|
7
|
+
import { Particle } from '../Particles';
|
|
8
|
+
export class GraphicsSystem extends System {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.types = ['ex.transform', 'ex.graphics'];
|
|
12
|
+
this.systemType = SystemType.Draw;
|
|
13
|
+
this.priority = 0;
|
|
14
|
+
this._token = 0;
|
|
15
|
+
}
|
|
16
|
+
initialize(scene) {
|
|
17
|
+
this._graphicsContext = scene.engine.graphicsContext;
|
|
18
|
+
this._camera = scene.camera;
|
|
19
|
+
this._engine = scene.engine;
|
|
20
|
+
}
|
|
21
|
+
sort(a, b) {
|
|
22
|
+
return a.get(TransformComponent).z - b.get(TransformComponent).z;
|
|
23
|
+
}
|
|
24
|
+
update(entities, delta) {
|
|
25
|
+
this._token++;
|
|
26
|
+
let transform;
|
|
27
|
+
let graphics;
|
|
28
|
+
for (const entity of entities) {
|
|
29
|
+
transform = entity.get(TransformComponent);
|
|
30
|
+
graphics = entity.get(GraphicsComponent);
|
|
31
|
+
// Figure out if entities are offscreen
|
|
32
|
+
const entityOffscreen = this._isOffscreen(transform, graphics);
|
|
33
|
+
if (entityOffscreen && !entity.hasTag('offscreen')) {
|
|
34
|
+
entity.eventDispatcher.emit('exitviewport', new ExitViewPortEvent(entity));
|
|
35
|
+
entity.addComponent(new TagComponent('offscreen'));
|
|
36
|
+
}
|
|
37
|
+
if (!entityOffscreen && entity.hasTag('offscreen')) {
|
|
38
|
+
entity.eventDispatcher.emit('enterviewport', new EnterViewPortEvent(entity));
|
|
39
|
+
entity.removeComponent('offscreen');
|
|
40
|
+
}
|
|
41
|
+
// Skip entities that have graphics offscreen
|
|
42
|
+
if (entityOffscreen) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
// This optionally sets our camera based on the entity coord plan (world vs. screen)
|
|
46
|
+
this._pushCameraTransform(transform);
|
|
47
|
+
this._graphicsContext.save();
|
|
48
|
+
// Tick any graphics state (but only once) for animations and graphics groups
|
|
49
|
+
graphics.update(delta, this._token);
|
|
50
|
+
// Position the entity
|
|
51
|
+
this._applyTransform(entity);
|
|
52
|
+
// Optionally run the onPreDraw graphics lifecycle draw
|
|
53
|
+
if (graphics.onPreDraw) {
|
|
54
|
+
graphics.onPreDraw(this._graphicsContext, delta);
|
|
55
|
+
}
|
|
56
|
+
// TODO remove this hack on the particle redo
|
|
57
|
+
const particleOpacity = (entity instanceof Particle) ? entity.opacity : 1;
|
|
58
|
+
this._graphicsContext.opacity = graphics.opacity * particleOpacity;
|
|
59
|
+
// Draw the graphics component
|
|
60
|
+
this._drawGraphicsComponent(graphics);
|
|
61
|
+
// Optionally run the onPostDraw graphics lifecycle draw
|
|
62
|
+
if (graphics.onPostDraw) {
|
|
63
|
+
graphics.onPostDraw(this._graphicsContext, delta);
|
|
64
|
+
}
|
|
65
|
+
this._graphicsContext.restore();
|
|
66
|
+
// Reset the transform back to the original
|
|
67
|
+
this._popCameraTransform(transform);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
_isOffscreen(transform, graphics) {
|
|
71
|
+
if (transform.coordPlane === CoordPlane.World) {
|
|
72
|
+
const graphicsOffscreen = !this._camera.viewport.intersect(graphics.localBounds.transform(transform.getGlobalMatrix()));
|
|
73
|
+
return graphicsOffscreen;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// TODO screen coordinates
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
_drawGraphicsComponent(graphicsComponent) {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
if (graphicsComponent.visible) {
|
|
83
|
+
// this should be moved to the graphics system
|
|
84
|
+
for (const layer of graphicsComponent.layers.get()) {
|
|
85
|
+
for (const { graphic, options } of layer.graphics) {
|
|
86
|
+
let anchor = graphicsComponent.anchor;
|
|
87
|
+
let offset = graphicsComponent.offset;
|
|
88
|
+
if (options === null || options === void 0 ? void 0 : options.anchor) {
|
|
89
|
+
anchor = options.anchor;
|
|
90
|
+
}
|
|
91
|
+
if (options === null || options === void 0 ? void 0 : options.offset) {
|
|
92
|
+
offset = options.offset;
|
|
93
|
+
}
|
|
94
|
+
// See https://github.com/excaliburjs/Excalibur/pull/619 for discussion on this formula
|
|
95
|
+
const offsetX = -graphic.width * anchor.x + offset.x;
|
|
96
|
+
const offsetY = -graphic.height * anchor.y + offset.y;
|
|
97
|
+
graphic === null || graphic === void 0 ? void 0 : graphic.draw(this._graphicsContext, offsetX + layer.offset.x, offsetY + layer.offset.y);
|
|
98
|
+
if (((_a = this._engine) === null || _a === void 0 ? void 0 : _a.isDebug) && this._engine.debug.graphics.showBounds) {
|
|
99
|
+
const offset = vec(offsetX + layer.offset.x, offsetY + layer.offset.y);
|
|
100
|
+
if (graphic instanceof GraphicsGroup) {
|
|
101
|
+
for (const g of graphic.members) {
|
|
102
|
+
(_b = g.graphic) === null || _b === void 0 ? void 0 : _b.localBounds.translate(offset.add(g.pos)).draw(this._graphicsContext, this._engine.debug.graphics.boundsColor);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
/* istanbul ignore next */
|
|
107
|
+
graphic === null || graphic === void 0 ? void 0 : graphic.localBounds.translate(offset).draw(this._graphicsContext, this._engine.debug.graphics.boundsColor);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* This applies the current entity transform to the graphics context
|
|
116
|
+
* @param entity
|
|
117
|
+
*/
|
|
118
|
+
_applyTransform(entity) {
|
|
119
|
+
const ancestors = entity.getAncestors();
|
|
120
|
+
for (const ancestor of ancestors) {
|
|
121
|
+
const transform = ancestor === null || ancestor === void 0 ? void 0 : ancestor.get(TransformComponent);
|
|
122
|
+
if (transform) {
|
|
123
|
+
this._graphicsContext.translate(transform.pos.x, transform.pos.y);
|
|
124
|
+
this._graphicsContext.scale(transform.scale.x, transform.scale.y);
|
|
125
|
+
this._graphicsContext.rotate(transform.rotation);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Applies the current camera transform if in world coordinates
|
|
131
|
+
* @param transform
|
|
132
|
+
*/
|
|
133
|
+
_pushCameraTransform(transform) {
|
|
134
|
+
// Establish camera offset per entity
|
|
135
|
+
if (transform.coordPlane === CoordPlane.World) {
|
|
136
|
+
this._graphicsContext.save();
|
|
137
|
+
if (this._camera) {
|
|
138
|
+
this._camera.draw(this._graphicsContext);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Resets the current camera transform if in world coordinates
|
|
144
|
+
* @param transform
|
|
145
|
+
*/
|
|
146
|
+
_popCameraTransform(transform) {
|
|
147
|
+
if (transform.coordPlane === CoordPlane.World) {
|
|
148
|
+
// Apply camera world offset
|
|
149
|
+
this._graphicsContext.restore();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=GraphicsSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphicsSystem.js","sourceRoot":"","sources":["../../../src/engine/Graphics/GraphicsSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAGxG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,kBAAkB,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AAQ,IAAI,SAAS,EAAE;YAChC,MAAM,SAAS,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,CAAC,kBAAkB,CAAC,CAAC;YACpD,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAClE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAClE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;aAClD;SACF;IACH,CAAC;IAED;;;OAGG;IACK,oBAAoB,CAAC,SAA6B;QACxD,qCAAqC;QACrC,IAAI,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC,KAAK,EAAE;YAC7C,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;YAC7B,IAAI,IAAI,CAAC,OAAO,EAAE;gBAChB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aAC1C;SACF;IACH,CAAC;IAED;;;OAGG;IACK,mBAAmB,CAAC,SAA6B;QACvD,IAAI,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC,KAAK,EAAE;YAC7C,4BAA4B;YAC5B,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;SACjC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Resource } from '../Resources/Resource';
|
|
2
|
+
import { Sprite } from './Sprite';
|
|
3
|
+
import { Logger } from '../Util/Log';
|
|
4
|
+
import { TextureLoader } from '.';
|
|
5
|
+
export class ImageSource {
|
|
6
|
+
/**
|
|
7
|
+
* The path to the image, can also be a data url like 'data:image/'
|
|
8
|
+
* @param path {string} Path to the image resource relative from the HTML document hosting the game, or absolute
|
|
9
|
+
* @param bustCache {boolean} Should excalibur add a cache busting querystring?
|
|
10
|
+
* @param filtering {ImageFiltering} Optionally override the image filtering set by [[EngineOptions.antialiasing]]
|
|
11
|
+
*/
|
|
12
|
+
constructor(path, bustCache = false, filtering) {
|
|
13
|
+
this.path = path;
|
|
14
|
+
this._logger = Logger.getInstance();
|
|
15
|
+
/**
|
|
16
|
+
* Access to the underlying html image element
|
|
17
|
+
*/
|
|
18
|
+
this.data = new Image();
|
|
19
|
+
this._resource = new Resource(path, 'blob', bustCache);
|
|
20
|
+
this._filtering = filtering;
|
|
21
|
+
if (path.endsWith('.svg') || path.endsWith('.gif')) {
|
|
22
|
+
this._logger.warn(`Image type is not fully supported, you may have mixed results ${path}. Fully supported: jpg, bmp, and png`);
|
|
23
|
+
}
|
|
24
|
+
this.ready = new Promise((resolve) => {
|
|
25
|
+
this._loadedResolve = resolve;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The original size of the source image in pixels
|
|
30
|
+
*/
|
|
31
|
+
get width() {
|
|
32
|
+
return this.image.naturalWidth;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The original height of the source image in pixels
|
|
36
|
+
*/
|
|
37
|
+
get height() {
|
|
38
|
+
return this.image.naturalHeight;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns true if the Texture is completely loaded and is ready
|
|
42
|
+
* to be drawn.
|
|
43
|
+
*/
|
|
44
|
+
isLoaded() {
|
|
45
|
+
if (!this._src) {
|
|
46
|
+
// this boosts speed of access
|
|
47
|
+
this._src = this.data.src;
|
|
48
|
+
}
|
|
49
|
+
return !!this._src;
|
|
50
|
+
}
|
|
51
|
+
get image() {
|
|
52
|
+
return this.data;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Begins loading the image and returns a promise that resolves when the image is loaded
|
|
56
|
+
*/
|
|
57
|
+
async load() {
|
|
58
|
+
if (this.isLoaded()) {
|
|
59
|
+
return this.data;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
// Load base64 or blob if needed
|
|
63
|
+
let url;
|
|
64
|
+
if (!this.path.includes('data:image/')) {
|
|
65
|
+
const blob = await this._resource.load();
|
|
66
|
+
url = URL.createObjectURL(blob);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
url = this.path;
|
|
70
|
+
}
|
|
71
|
+
// Decode the image
|
|
72
|
+
const image = new Image();
|
|
73
|
+
image.src = url;
|
|
74
|
+
image.setAttribute('data-original-src', this.path);
|
|
75
|
+
await image.decode();
|
|
76
|
+
// Set results
|
|
77
|
+
this.data = image;
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
throw `Error loading ImageSource from path '${this.path}' with error [${error.message}]`;
|
|
81
|
+
}
|
|
82
|
+
TextureLoader.load(this.data, this._filtering);
|
|
83
|
+
// todo emit complete
|
|
84
|
+
this._loadedResolve(this.data);
|
|
85
|
+
return this.data;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Build a sprite from this ImageSource
|
|
89
|
+
*/
|
|
90
|
+
toSprite() {
|
|
91
|
+
return Sprite.from(this);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create a ImageSource from legacy texture
|
|
95
|
+
* @param tex
|
|
96
|
+
*/
|
|
97
|
+
static fromLegacyTexture(tex) {
|
|
98
|
+
const image = new ImageSource(tex.path);
|
|
99
|
+
if (tex.isLoaded()) {
|
|
100
|
+
image.data = tex.data;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
tex.loaded.then(() => {
|
|
104
|
+
image.data = tex.data;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return image;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Unload images from memory
|
|
111
|
+
*/
|
|
112
|
+
unload() {
|
|
113
|
+
this.data = new Image();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=ImageSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageSource.js","sourceRoot":"","sources":["../../../src/engine/Graphics/ImageSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAGlC,MAAM,OAAO,WAAW;IA8CtB;;;;;OAKG;IACH,YAA4B,IAAY,EAAE,YAAqB,KAAK,EAAE,SAA0B;QAApE,SAAI,GAAJ,IAAI,CAAQ;QAnDhC,YAAO,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QA+BvC;;WAEG;QACI,SAAI,GAAqB,IAAI,KAAK,EAAE,CAAC;QAkB1C,IAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YAClD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iEAAiE,IAAI,sCAAsC,CAAC,CAAC;SAChI;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,OAAO,CAAmB,CAAC,OAAO,EAAE,EAAE;YACrD,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;IAxDD;;OAEG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;IAClC,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c,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,iBAAiB,CAAC,GAAY;QAC1C,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,GAAG,CAAC,QAAQ,EAAE,EAAE;YAClB,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;SACvB;aAAM;YACL,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;gBACnB,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;YACxB,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ImageFiltering } from '.';
|
|
2
|
+
import { vec } from '../Math/vector';
|
|
3
|
+
import { Raster } from './Raster';
|
|
4
|
+
/**
|
|
5
|
+
* A polygon [[Graphic]] for drawing arbitrary polygons to the [[ExcaliburGraphicsContext]]
|
|
6
|
+
*
|
|
7
|
+
* Polygons default to [[ImageFiltering.Blended]]
|
|
8
|
+
*/
|
|
9
|
+
export class Polygon extends Raster {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
super(options);
|
|
12
|
+
this.points = options.points;
|
|
13
|
+
this.filtering = ImageFiltering.Blended;
|
|
14
|
+
this.rasterize();
|
|
15
|
+
}
|
|
16
|
+
get points() {
|
|
17
|
+
return this._points;
|
|
18
|
+
}
|
|
19
|
+
set points(points) {
|
|
20
|
+
this._points = points;
|
|
21
|
+
const min = this.minPoint;
|
|
22
|
+
this.width = this._points.reduce((max, p) => Math.max(p.x, max), 0) - min.x;
|
|
23
|
+
this.height = this._points.reduce((max, p) => Math.max(p.y, max), 0) - min.y;
|
|
24
|
+
this.flagDirty();
|
|
25
|
+
}
|
|
26
|
+
get minPoint() {
|
|
27
|
+
const minX = this._points.reduce((min, p) => Math.min(p.x, min), Infinity);
|
|
28
|
+
const minY = this._points.reduce((min, p) => Math.min(p.y, min), Infinity);
|
|
29
|
+
return vec(minX, minY);
|
|
30
|
+
}
|
|
31
|
+
clone() {
|
|
32
|
+
return new Polygon({
|
|
33
|
+
points: this.points.map((p) => p.clone()),
|
|
34
|
+
...this.cloneGraphicOptions(),
|
|
35
|
+
...this.cloneRasterOptions()
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
execute(ctx) {
|
|
39
|
+
if (this.points && this.points.length) {
|
|
40
|
+
ctx.beginPath();
|
|
41
|
+
// Iterate through the supplied points and construct a 'polygon'
|
|
42
|
+
const min = this.minPoint.negate();
|
|
43
|
+
const firstPoint = this.points[0].add(min);
|
|
44
|
+
ctx.moveTo(firstPoint.x, firstPoint.y);
|
|
45
|
+
this.points.forEach((point) => {
|
|
46
|
+
ctx.lineTo(point.x + min.x, point.y + min.y);
|
|
47
|
+
});
|
|
48
|
+
ctx.lineTo(firstPoint.x, firstPoint.y);
|
|
49
|
+
ctx.closePath();
|
|
50
|
+
if (this.color) {
|
|
51
|
+
ctx.fill();
|
|
52
|
+
}
|
|
53
|
+
if (this.strokeColor) {
|
|
54
|
+
ctx.stroke();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=Polygon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Polygon.js","sourceRoot":"","sources":["../../../src/engine/Graphics/Polygon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AACnC,OAAO,EAAU,GAAG,E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SAAS,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,GAAG,CAAC,IAAI,EAAE,CAAC;aACZ;YACD,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,GAAG,CAAC,MAAM,EAAE,CAAC;aACd;SACF;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var ColorBlindnessMode;
|
|
2
|
+
(function (ColorBlindnessMode) {
|
|
3
|
+
ColorBlindnessMode["Protanope"] = "Protanope";
|
|
4
|
+
ColorBlindnessMode["Deuteranope"] = "Deuteranope";
|
|
5
|
+
ColorBlindnessMode["Tritanope"] = "Tritanope";
|
|
6
|
+
})(ColorBlindnessMode || (ColorBlindnessMode = {}));
|
|
7
|
+
//# sourceMappingURL=ColorBlindnessMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorBlindnessMode.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/PostProcessor/ColorBlindnessMode.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,6CAAuB,CAAA;IACvB,iDAA2B,CAAA;IAC3B,6CAAuB,CAAA;AACzB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import colorBlindCorrectSource from './color-blind-fragment.glsl';
|
|
2
|
+
import { ColorBlindnessMode } from './ColorBlindnessMode';
|
|
3
|
+
import { ScreenShader } from './ScreenShader';
|
|
4
|
+
export class ColorBlindnessPostProcessor {
|
|
5
|
+
constructor(_colorBlindnessMode, simulate = false) {
|
|
6
|
+
this._colorBlindnessMode = _colorBlindnessMode;
|
|
7
|
+
this._simulate = false;
|
|
8
|
+
this._simulate = simulate;
|
|
9
|
+
}
|
|
10
|
+
initialize(_gl) {
|
|
11
|
+
this._shader = new ScreenShader(colorBlindCorrectSource);
|
|
12
|
+
this.simulate = this._simulate;
|
|
13
|
+
this.colorBlindnessMode = this._colorBlindnessMode;
|
|
14
|
+
}
|
|
15
|
+
getShader() {
|
|
16
|
+
return this._shader.getShader();
|
|
17
|
+
}
|
|
18
|
+
getLayout() {
|
|
19
|
+
return this._shader.getLayout();
|
|
20
|
+
}
|
|
21
|
+
set colorBlindnessMode(colorBlindMode) {
|
|
22
|
+
this._colorBlindnessMode = colorBlindMode;
|
|
23
|
+
if (this._shader) {
|
|
24
|
+
const shader = this._shader.getShader();
|
|
25
|
+
shader.use();
|
|
26
|
+
if (this._colorBlindnessMode === ColorBlindnessMode.Protanope) {
|
|
27
|
+
shader.setUniformInt('u_type', 0);
|
|
28
|
+
}
|
|
29
|
+
else if (this._colorBlindnessMode === ColorBlindnessMode.Deuteranope) {
|
|
30
|
+
shader.setUniformInt('u_type', 1);
|
|
31
|
+
}
|
|
32
|
+
else if (this._colorBlindnessMode === ColorBlindnessMode.Tritanope) {
|
|
33
|
+
shader.setUniformInt('u_type', 2);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
get colorBlindnessMode() {
|
|
38
|
+
return this._colorBlindnessMode;
|
|
39
|
+
}
|
|
40
|
+
set simulate(value) {
|
|
41
|
+
this._simulate = value;
|
|
42
|
+
if (this._shader) {
|
|
43
|
+
const shader = this._shader.getShader();
|
|
44
|
+
shader.use();
|
|
45
|
+
shader.setUniformBoolean('u_simulate', value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
get simulate() {
|
|
49
|
+
return this._simulate;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=ColorBlindnessPostProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorBlindnessPostProcessor.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/PostProcessor/ColorBlindnessPostProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,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Aa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;aACnC;SACF;IACH,CAAC;IAED,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,IAAI,QAAQ,CAAC,KAAc;QACzB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,IAAI,CAAC,OAAO,EAAE;YAEhB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YACxC,MAAM,CAAC,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,iBAAiB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;SAC/C;IACH,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostProcessor.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/PostProcessor/PostProcessor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Shader } from '../Context/shader';
|
|
2
|
+
import { VertexBuffer } from '../Context/vertex-buffer';
|
|
3
|
+
import { VertexLayout } from '../Context/vertex-layout';
|
|
4
|
+
/**
|
|
5
|
+
* Helper that defines a whole screen renderer, just provide a fragment source!
|
|
6
|
+
*
|
|
7
|
+
* Currently supports 1 varying
|
|
8
|
+
* - vec2 a_texcoord between 0-1 which corresponds to screen position
|
|
9
|
+
*/
|
|
10
|
+
export class ScreenShader {
|
|
11
|
+
constructor(fragmentSource) {
|
|
12
|
+
this._shader = new Shader({
|
|
13
|
+
vertexSource: `
|
|
14
|
+
attribute vec2 a_position;
|
|
15
|
+
attribute vec2 a_texcoord;
|
|
16
|
+
varying vec2 v_texcoord;
|
|
17
|
+
|
|
18
|
+
void main() {
|
|
19
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
20
|
+
// Pass the texcoord to the fragment shader.
|
|
21
|
+
v_texcoord = a_texcoord;
|
|
22
|
+
}`,
|
|
23
|
+
fragmentSource: fragmentSource
|
|
24
|
+
});
|
|
25
|
+
this._shader.compile();
|
|
26
|
+
// Setup memory layout
|
|
27
|
+
this._buffer = new VertexBuffer({
|
|
28
|
+
type: 'static',
|
|
29
|
+
// clip space quad + uv since we don't need a camera
|
|
30
|
+
data: new Float32Array([
|
|
31
|
+
-1, -1, 0, 0,
|
|
32
|
+
-1, 1, 0, 1,
|
|
33
|
+
1, -1, 1, 0,
|
|
34
|
+
1, -1, 1, 0,
|
|
35
|
+
-1, 1, 0, 1,
|
|
36
|
+
1, 1, 1, 1
|
|
37
|
+
])
|
|
38
|
+
});
|
|
39
|
+
this._layout = new VertexLayout({
|
|
40
|
+
shader: this._shader,
|
|
41
|
+
vertexBuffer: this._buffer,
|
|
42
|
+
attributes: [
|
|
43
|
+
['a_position', 2],
|
|
44
|
+
['a_texcoord', 2]
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
this._buffer.upload();
|
|
48
|
+
}
|
|
49
|
+
getShader() {
|
|
50
|
+
return this._shader;
|
|
51
|
+
}
|
|
52
|
+
getLayout() {
|
|
53
|
+
return this._layout;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=ScreenShader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenShader.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/PostProcessor/ScreenShader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IAIvB,YAAY,cAAsB;QAChC,IAAI,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC;YACxB,YAAY,EAAE;;;;;;;;;QASZ;YACF,cAAc,E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