excalibur 0.28.3 → 0.28.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +63 -63
- package/CHANGELOG.md +2003 -1955
- package/LICENSE.md +25 -25
- package/README.md +134 -134
- package/STYLEGUIDE.md +136 -136
- package/build/dist/Actions/Action/ActionSequence.js +31 -0
- package/build/dist/Actions/Action/ActionSequence.js.map +1 -0
- package/build/dist/Actions/Action/Blink.js +54 -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 +26 -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/EaseBy.js +70 -0
- package/build/dist/Actions/Action/EaseBy.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 +48 -0
- package/build/dist/Actions/Action/Fade.js.map +1 -0
- package/build/dist/Actions/Action/Follow.js +56 -0
- package/build/dist/Actions/Action/Follow.js.map +1 -0
- package/build/dist/Actions/Action/Meet.js +54 -0
- package/build/dist/Actions/Action/Meet.js.map +1 -0
- package/build/dist/Actions/Action/MoveBy.js +48 -0
- package/build/dist/Actions/Action/MoveBy.js.map +1 -0
- package/build/dist/Actions/Action/MoveTo.js +41 -0
- package/build/dist/Actions/Action/MoveTo.js.map +1 -0
- package/build/dist/Actions/Action/ParallelActions.js +23 -0
- package/build/dist/Actions/Action/ParallelActions.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 +95 -0
- package/build/dist/Actions/Action/RotateBy.js.map +1 -0
- package/build/dist/Actions/Action/RotateTo.js +91 -0
- package/build/dist/Actions/Action/RotateTo.js.map +1 -0
- package/build/dist/Actions/Action/ScaleBy.js +46 -0
- package/build/dist/Actions/Action/ScaleBy.js.map +1 -0
- package/build/dist/Actions/Action/ScaleTo.js +58 -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 +322 -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 +195 -0
- package/build/dist/Actions/ActionsComponent.js.map +1 -0
- package/build/dist/Actions/ActionsSystem.js +30 -0
- package/build/dist/Actions/ActionsSystem.js.map +1 -0
- package/build/dist/Actions/Index.js +26 -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 +629 -0
- package/build/dist/Actor.js.map +1 -0
- package/build/dist/Camera.js +660 -0
- package/build/dist/Camera.js.map +1 -0
- package/build/dist/Collision/BoundingBox.js +415 -0
- package/build/dist/Collision/BoundingBox.js.map +1 -0
- package/build/dist/Collision/ColliderComponent.js +202 -0
- package/build/dist/Collision/ColliderComponent.js.map +1 -0
- package/build/dist/Collision/Colliders/CircleCollider.js +226 -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 +32 -0
- package/build/dist/Collision/Colliders/Collider.js.map +1 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js +300 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js +229 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js +556 -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 +99 -0
- package/build/dist/Collision/Colliders/Shape.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 +51 -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/Pair.js +92 -0
- package/build/dist/Collision/Detection/Pair.js.map +1 -0
- package/build/dist/Collision/Detection/QuadTree.js +193 -0
- package/build/dist/Collision/Detection/QuadTree.js.map +1 -0
- package/build/dist/Collision/Group/CollisionGroup.js +3 -3
- package/build/dist/Collision/Integrator.js +25 -0
- package/build/dist/Collision/Integrator.js.map +1 -0
- package/build/dist/Collision/MotionSystem.js +35 -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/PhysicsWorld.js +10 -0
- package/build/dist/Collision/PhysicsWorld.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 +154 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js.map +1 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js +87 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js.map +1 -0
- package/build/dist/Collision/Solver/RealisticSolver.js +293 -0
- package/build/dist/Collision/Solver/RealisticSolver.js.map +1 -0
- package/build/dist/Collision/Solver/Solver.js +2 -0
- package/build/dist/Collision/Solver/Solver.js.map +1 -0
- package/build/dist/Color.js +417 -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.d.ts +11 -0
- package/build/dist/Debug/Debug.js +385 -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 +263 -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/Engine.js +986 -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 +107 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Entity.js +487 -0
- package/build/dist/EntityComponentSystem/Entity.js.map +1 -0
- package/build/dist/EntityComponentSystem/EntityManager.js +137 -0
- package/build/dist/EntityComponentSystem/EntityManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Query.js +90 -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 +104 -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 +122 -0
- package/build/dist/EventDispatcher.js.map +1 -0
- package/build/dist/EventEmitter.js +86 -0
- package/build/dist/EventEmitter.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 +473 -0
- package/build/dist/Events.js.map +1 -0
- package/build/dist/Flags.js +67 -0
- package/build/dist/Flags.js.map +1 -0
- package/build/dist/Graphics/Animation.js +344 -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 +48 -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 +237 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js +481 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js.map +1 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.frag.glsl +52 -52
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js +174 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.vert.glsl +37 -37
- 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/draw-call.js +16 -0
- package/build/dist/Graphics/Context/draw-call.js.map +1 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.frag.glsl +32 -32
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js +246 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.vert.glsl +32 -32
- package/build/dist/Graphics/Context/line-renderer/line-fragment.glsl +10 -10
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js +90 -0
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/line-renderer/line-vertex.glsl +14 -14
- package/build/dist/Graphics/Context/material-renderer/material-renderer.js +23 -2
- package/build/dist/Graphics/Context/material-renderer/material-renderer.js.map +1 -1
- package/build/dist/Graphics/Context/material.d.ts +2 -0
- package/build/dist/Graphics/Context/material.js +72 -0
- package/build/dist/Graphics/Context/material.js.map +1 -0
- package/build/dist/Graphics/Context/point-renderer/point-fragment.glsl +19 -19
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js +91 -0
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/point-renderer/point-vertex.glsl +11 -11
- package/build/dist/Graphics/Context/quad-index-buffer.js +67 -0
- package/build/dist/Graphics/Context/quad-index-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.frag.glsl +85 -85
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js +305 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.vert.glsl +42 -42
- 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-fragment.glsl +13 -13
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js +56 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js.map +1 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-vertex.glsl +11 -11
- package/build/dist/Graphics/Context/state-stack.js +37 -0
- package/build/dist/Graphics/Context/state-stack.js.map +1 -0
- package/build/dist/Graphics/Context/texture-loader.js +109 -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 +53 -0
- package/build/dist/Graphics/Context/vertex-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/webgl-util.js +79 -0
- package/build/dist/Graphics/Context/webgl-util.js.map +1 -0
- package/build/dist/Graphics/DebugGraphicsComponent.d.ts +3 -2
- package/build/dist/Graphics/DebugGraphicsComponent.js +16 -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 +148 -0
- package/build/dist/Graphics/Font.js.map +1 -0
- package/build/dist/Graphics/FontCache.d.ts +1 -0
- package/build/dist/Graphics/FontCache.js +80 -0
- package/build/dist/Graphics/FontCache.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/FontTextInstance.js +230 -0
- package/build/dist/Graphics/FontTextInstance.js.map +1 -0
- package/build/dist/Graphics/Graphic.js +208 -0
- package/build/dist/Graphics/Graphic.js.map +1 -0
- package/build/dist/Graphics/GraphicsComponent.js +336 -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 +210 -0
- package/build/dist/Graphics/GraphicsSystem.js.map +1 -0
- package/build/dist/Graphics/ImageSource.js +124 -0
- package/build/dist/Graphics/ImageSource.js.map +1 -0
- package/build/dist/Graphics/Line.js +45 -0
- package/build/dist/Graphics/Line.js.map +1 -0
- package/build/dist/Graphics/OffscreenSystem.js +64 -0
- package/build/dist/Graphics/OffscreenSystem.js.map +1 -0
- package/build/dist/Graphics/ParallaxComponent.js +11 -0
- package/build/dist/Graphics/ParallaxComponent.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 +59 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/color-blind-fragment.glsl +64 -64
- package/build/dist/Graphics/Raster.js +215 -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 +82 -0
- package/build/dist/Graphics/Sprite.js.map +1 -0
- package/build/dist/Graphics/SpriteFont.js +139 -0
- package/build/dist/Graphics/SpriteFont.js.map +1 -0
- package/build/dist/Graphics/SpriteSheet.js +116 -0
- package/build/dist/Graphics/SpriteSheet.js.map +1 -0
- package/build/dist/Graphics/Text.js +103 -0
- package/build/dist/Graphics/Text.js.map +1 -0
- package/build/dist/Graphics/index.js +46 -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 +422 -0
- package/build/dist/Input/Gamepad.js.map +1 -0
- package/build/dist/Input/Index.js +88 -0
- package/build/dist/Input/Index.js.map +1 -0
- package/build/dist/Input/InputMapper.js +45 -0
- package/build/dist/Input/InputMapper.js.map +1 -0
- package/build/dist/Input/Keyboard.js +348 -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 +44 -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 +456 -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 +249 -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/Evented.js +2 -0
- package/build/dist/Interfaces/Evented.js.map +1 -0
- package/build/dist/Interfaces/Index.js +8 -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/Label.js +81 -0
- package/build/dist/Label.js.map +1 -0
- package/build/dist/Loader.js +416 -0
- package/build/dist/Loader.js.map +1 -0
- package/build/dist/Math/Index.js +13 -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/affine-matrix.js +331 -0
- package/build/dist/Math/affine-matrix.js.map +1 -0
- package/build/dist/Math/coord-plane.js +17 -0
- package/build/dist/Math/coord-plane.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-segment.js +205 -0
- package/build/dist/Math/line-segment.js.map +1 -0
- package/build/dist/Math/matrix.js +457 -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/transform.js +219 -0
- package/build/dist/Math/transform.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 +340 -0
- package/build/dist/Math/vector.js.map +1 -0
- package/build/dist/Math/watch-vector.js +26 -0
- package/build/dist/Math/watch-vector.js.map +1 -0
- package/build/dist/Particles.js +430 -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/Resources/Gif.js +464 -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 +81 -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 +326 -0
- package/build/dist/Resources/Sound/Sound.js.map +1 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js +190 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js.map +1 -0
- package/build/dist/Scene.js +444 -0
- package/build/dist/Scene.js.map +1 -0
- package/build/dist/Screen.js +782 -0
- package/build/dist/Screen.js.map +1 -0
- package/build/dist/ScreenElement.js +43 -0
- package/build/dist/ScreenElement.js.map +1 -0
- package/build/dist/TileMap/IsometricEntityComponent.js +17 -0
- package/build/dist/TileMap/IsometricEntityComponent.js.map +1 -0
- package/build/dist/TileMap/IsometricEntitySystem.js +23 -0
- package/build/dist/TileMap/IsometricEntitySystem.js.map +1 -0
- package/build/dist/TileMap/IsometricMap.js +311 -0
- package/build/dist/TileMap/IsometricMap.js.map +1 -0
- package/build/dist/TileMap/TileMap.d.ts +2 -1
- package/build/dist/TileMap/TileMap.js +630 -0
- package/build/dist/TileMap/TileMap.js.map +1 -0
- package/build/dist/TileMap/index.js +5 -0
- package/build/dist/TileMap/index.js.map +1 -0
- package/build/dist/Timer.js +202 -0
- package/build/dist/Timer.js.map +1 -0
- package/build/dist/Trigger.js +94 -0
- package/build/dist/Trigger.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/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 +115 -0
- package/build/dist/Util/DrawUtil.js.map +1 -0
- package/build/dist/Util/EasingFunctions.js +102 -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/Future.js +30 -0
- package/build/dist/Util/Future.js.map +1 -0
- package/build/dist/Util/IFrame.js +23 -0
- package/build/dist/Util/IFrame.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 +66 -0
- package/build/dist/Util/Observable.js.map +1 -0
- package/build/dist/Util/Pool.js +74 -0
- package/build/dist/Util/Pool.js.map +1 -0
- package/build/dist/Util/Semaphore.js +55 -0
- package/build/dist/Util/Semaphore.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/StateMachine.js +79 -0
- package/build/dist/Util/StateMachine.js.map +1 -0
- package/build/dist/Util/Toaster.css +28 -28
- package/build/dist/Util/Toaster.js +84 -0
- package/build/dist/Util/Toaster.js.map +1 -0
- package/build/dist/Util/Util.d.ts +6 -0
- package/build/dist/Util/Util.js +95 -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.d.ts +2 -2
- package/build/dist/excalibur.js +389 -258
- 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 +81 -0
- package/build/dist/index.js.map +1 -0
- package/build/esm/Debug/Debug.d.ts +11 -0
- package/build/esm/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +1 -0
- package/build/esm/Graphics/Context/material.d.ts +2 -0
- package/build/esm/Graphics/DebugGraphicsComponent.d.ts +3 -2
- package/build/esm/Graphics/FontCache.d.ts +1 -0
- package/build/esm/TileMap/TileMap.d.ts +2 -1
- package/build/esm/Util/Util.d.ts +6 -0
- package/build/esm/excalibur.d.ts +2 -2
- package/build/esm/excalibur.js +389 -258
- 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/docker-compose.yml +11 -11
- package/package.json +131 -131
- package/build/dist/Loader.css +0 -122
- package/build/nuget/Excalibur.0.28.3.nupkg +0 -0
- package/build/v0.28.3.zip +0 -0
- package/excalibur-0.28.3.tgz +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Graphic } from './Graphic';
|
|
2
|
+
import { Animation } from './Animation';
|
|
3
|
+
import { BoundingBox } from '../Collision/Index';
|
|
4
|
+
export class GraphicsGroup extends Graphic {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super(options);
|
|
7
|
+
this.members = [];
|
|
8
|
+
this.members = options.members;
|
|
9
|
+
this._updateDimensions();
|
|
10
|
+
}
|
|
11
|
+
clone() {
|
|
12
|
+
return new GraphicsGroup({
|
|
13
|
+
members: [...this.members],
|
|
14
|
+
...this.cloneGraphicOptions()
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
_updateDimensions() {
|
|
18
|
+
let bb = new BoundingBox();
|
|
19
|
+
for (const { graphic, pos } of this.members) {
|
|
20
|
+
bb = graphic.localBounds.translate(pos).combine(bb);
|
|
21
|
+
}
|
|
22
|
+
this.width = bb.width;
|
|
23
|
+
this.height = bb.height;
|
|
24
|
+
return bb;
|
|
25
|
+
}
|
|
26
|
+
get localBounds() {
|
|
27
|
+
let bb = new BoundingBox();
|
|
28
|
+
for (const { graphic, pos } of this.members) {
|
|
29
|
+
bb = graphic.localBounds.translate(pos).combine(bb);
|
|
30
|
+
}
|
|
31
|
+
return bb;
|
|
32
|
+
}
|
|
33
|
+
_isAnimationOrGroup(graphic) {
|
|
34
|
+
return graphic instanceof Animation || graphic instanceof GraphicsGroup;
|
|
35
|
+
}
|
|
36
|
+
tick(elapsedMilliseconds, idempotencyToken) {
|
|
37
|
+
for (const member of this.members) {
|
|
38
|
+
const maybeAnimation = member.graphic;
|
|
39
|
+
if (this._isAnimationOrGroup(maybeAnimation)) {
|
|
40
|
+
maybeAnimation.tick(elapsedMilliseconds, idempotencyToken);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
reset() {
|
|
45
|
+
for (const member of this.members) {
|
|
46
|
+
const maybeAnimation = member.graphic;
|
|
47
|
+
if (this._isAnimationOrGroup(maybeAnimation)) {
|
|
48
|
+
maybeAnimation.reset();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
_preDraw(ex, x, y) {
|
|
53
|
+
this._updateDimensions();
|
|
54
|
+
super._preDraw(ex, x, y);
|
|
55
|
+
}
|
|
56
|
+
_drawImage(ex, x, y) {
|
|
57
|
+
for (const member of this.members) {
|
|
58
|
+
ex.save();
|
|
59
|
+
ex.translate(x, y);
|
|
60
|
+
member.graphic.draw(ex, member.pos.x, member.pos.y);
|
|
61
|
+
if (this.showDebug) {
|
|
62
|
+
/* istanbul ignore next */
|
|
63
|
+
ex.debug.drawRect(0, 0, this.width, this.height);
|
|
64
|
+
}
|
|
65
|
+
ex.restore();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=GraphicsGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphicsGroup.js","sourceRoot":"","sources":["../../../src/engine/Graphics/GraphicsGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,SAAS,EAAW,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAWjD,MAAM,OAAO,aAAc,SAAQ,OAAO;IAGxC,YAAY,OAAiD;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC;QAHV,YAAO,GAAuB,EAAE,CAAC;QAItC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAEM,KAAK;QACV,OAAO,IAAI,aAAa,CAAC;YACvB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;YAC1B,GAAG,IAAI,CAAC,mBAAmB,EAAE;SAC9B,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB;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C,IAAI,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,EAAE,CAAC;gBAC7C,cAAc,CAAC,KAAK,EAAE,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAES,QAAQ,CAAC,EAA4B,EAAE,CAAS,EAAE,CAAS;QACnE,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B,CAAC;IAES,UAAU,CAAC,EAA4B,EAAE,CAAS,EAAE,CAAS;QACrE,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,EAAE,CAAC,IAAI,EAAE,CAAC;YACV,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACnB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACpD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACnB,0BAA0B;gBAC1B,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACnD,CAAC;YACD,EAAE,CAAC,OAAO,EAAE,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { GraphicsComponent } from './GraphicsComponent';
|
|
2
|
+
import { vec, Vector } from '../Math/vector';
|
|
3
|
+
import { TransformComponent } from '../EntityComponentSystem/Components/TransformComponent';
|
|
4
|
+
import { isAddedSystemEntity, System, SystemType } from '../EntityComponentSystem';
|
|
5
|
+
import { GraphicsGroup } from '.';
|
|
6
|
+
import { Particle } from '../Particles';
|
|
7
|
+
import { ParallaxComponent } from './ParallaxComponent';
|
|
8
|
+
import { CoordPlane } from '../Math/coord-plane';
|
|
9
|
+
import { BodyComponent } from '../Collision/BodyComponent';
|
|
10
|
+
import { FontCache } from './FontCache';
|
|
11
|
+
export class GraphicsSystem extends System {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.types = ['ex.transform', 'ex.graphics'];
|
|
15
|
+
this.systemType = SystemType.Draw;
|
|
16
|
+
this.priority = 0;
|
|
17
|
+
this._token = 0;
|
|
18
|
+
this._sortedTransforms = [];
|
|
19
|
+
this._zHasChanged = false;
|
|
20
|
+
this._zIndexUpdate = () => {
|
|
21
|
+
this._zHasChanged = true;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
get sortedTransforms() {
|
|
25
|
+
return this._sortedTransforms;
|
|
26
|
+
}
|
|
27
|
+
initialize(scene) {
|
|
28
|
+
this._camera = scene.camera;
|
|
29
|
+
this._engine = scene.engine;
|
|
30
|
+
}
|
|
31
|
+
preupdate() {
|
|
32
|
+
// Graphics context could be switched to fallback in a new frame
|
|
33
|
+
this._graphicsContext = this._engine.graphicsContext;
|
|
34
|
+
if (this._zHasChanged) {
|
|
35
|
+
this._sortedTransforms.sort((a, b) => {
|
|
36
|
+
return a.z - b.z;
|
|
37
|
+
});
|
|
38
|
+
this._zHasChanged = false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
notify(entityAddedOrRemoved) {
|
|
42
|
+
if (isAddedSystemEntity(entityAddedOrRemoved)) {
|
|
43
|
+
const tx = entityAddedOrRemoved.data.get(TransformComponent);
|
|
44
|
+
this._sortedTransforms.push(tx);
|
|
45
|
+
tx.zIndexChanged$.subscribe(this._zIndexUpdate);
|
|
46
|
+
this._zHasChanged = true;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const tx = entityAddedOrRemoved.data.get(TransformComponent);
|
|
50
|
+
tx.zIndexChanged$.unsubscribe(this._zIndexUpdate);
|
|
51
|
+
const index = this._sortedTransforms.indexOf(tx);
|
|
52
|
+
if (index > -1) {
|
|
53
|
+
this._sortedTransforms.splice(index, 1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
update(_entities, delta) {
|
|
58
|
+
this._token++;
|
|
59
|
+
let graphics;
|
|
60
|
+
FontCache.checkAndClearCache();
|
|
61
|
+
// This is a performance enhancement, most things are in world space
|
|
62
|
+
// so if we can only do this once saves a ton of transform updates
|
|
63
|
+
this._graphicsContext.save();
|
|
64
|
+
if (this._camera) {
|
|
65
|
+
this._camera.draw(this._graphicsContext);
|
|
66
|
+
}
|
|
67
|
+
for (const transform of this._sortedTransforms) {
|
|
68
|
+
const entity = transform.owner;
|
|
69
|
+
// If the entity is offscreen skip
|
|
70
|
+
if (entity.hasTag('ex.offscreen')) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
graphics = entity.get(GraphicsComponent);
|
|
74
|
+
// Exit if graphics set to not visible
|
|
75
|
+
if (!graphics.visible) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
// This optionally sets our camera based on the entity coord plan (world vs. screen)
|
|
79
|
+
if (transform.coordPlane === CoordPlane.Screen) {
|
|
80
|
+
this._graphicsContext.restore();
|
|
81
|
+
}
|
|
82
|
+
this._graphicsContext.save();
|
|
83
|
+
if (transform.coordPlane === CoordPlane.Screen) {
|
|
84
|
+
this._graphicsContext.translate(this._engine.screen.contentArea.left, this._engine.screen.contentArea.top);
|
|
85
|
+
}
|
|
86
|
+
// Tick any graphics state (but only once) for animations and graphics groups
|
|
87
|
+
graphics.update(delta, this._token);
|
|
88
|
+
// Apply parallax
|
|
89
|
+
const parallax = entity.get(ParallaxComponent);
|
|
90
|
+
if (parallax) {
|
|
91
|
+
// We use the Tiled formula
|
|
92
|
+
// https://doc.mapeditor.org/en/latest/manual/layers/#parallax-scrolling-factor
|
|
93
|
+
// cameraPos * (1 - parallaxFactor)
|
|
94
|
+
const oneMinusFactor = Vector.One.sub(parallax.parallaxFactor);
|
|
95
|
+
const parallaxOffset = this._camera.pos.scale(oneMinusFactor);
|
|
96
|
+
this._graphicsContext.translate(parallaxOffset.x, parallaxOffset.y);
|
|
97
|
+
}
|
|
98
|
+
// Position the entity + estimate lag
|
|
99
|
+
this._applyTransform(entity);
|
|
100
|
+
// If there is a material enable it on the context
|
|
101
|
+
if (graphics.material) {
|
|
102
|
+
this._graphicsContext.material = graphics.material;
|
|
103
|
+
}
|
|
104
|
+
// Optionally run the onPreDraw graphics lifecycle draw
|
|
105
|
+
if (graphics.onPreDraw) {
|
|
106
|
+
graphics.onPreDraw(this._graphicsContext, delta);
|
|
107
|
+
}
|
|
108
|
+
// TODO remove this hack on the particle redo
|
|
109
|
+
const particleOpacity = (entity instanceof Particle) ? entity.opacity : 1;
|
|
110
|
+
this._graphicsContext.opacity *= graphics.opacity * particleOpacity;
|
|
111
|
+
// Draw the graphics component
|
|
112
|
+
this._drawGraphicsComponent(graphics);
|
|
113
|
+
// Optionally run the onPostDraw graphics lifecycle draw
|
|
114
|
+
if (graphics.onPostDraw) {
|
|
115
|
+
graphics.onPostDraw(this._graphicsContext, delta);
|
|
116
|
+
}
|
|
117
|
+
this._graphicsContext.restore();
|
|
118
|
+
// Reset the transform back to the original world space
|
|
119
|
+
if (transform.coordPlane === CoordPlane.Screen) {
|
|
120
|
+
this._graphicsContext.save();
|
|
121
|
+
if (this._camera) {
|
|
122
|
+
this._camera.draw(this._graphicsContext);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
this._graphicsContext.restore();
|
|
127
|
+
}
|
|
128
|
+
_drawGraphicsComponent(graphicsComponent) {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
if (graphicsComponent.visible) {
|
|
131
|
+
const flipHorizontal = graphicsComponent.flipHorizontal;
|
|
132
|
+
const flipVertical = graphicsComponent.flipVertical;
|
|
133
|
+
for (const layer of graphicsComponent.layers.get()) {
|
|
134
|
+
for (const { graphic, options } of layer.graphics) {
|
|
135
|
+
let anchor = graphicsComponent.anchor;
|
|
136
|
+
let offset = graphicsComponent.offset;
|
|
137
|
+
// handle layer specific overrides
|
|
138
|
+
if (options === null || options === void 0 ? void 0 : options.anchor) {
|
|
139
|
+
anchor = options.anchor;
|
|
140
|
+
}
|
|
141
|
+
if (options === null || options === void 0 ? void 0 : options.offset) {
|
|
142
|
+
offset = options.offset;
|
|
143
|
+
}
|
|
144
|
+
// See https://github.com/excaliburjs/Excalibur/pull/619 for discussion on this formula
|
|
145
|
+
const offsetX = -graphic.width * anchor.x + offset.x;
|
|
146
|
+
const offsetY = -graphic.height * anchor.y + offset.y;
|
|
147
|
+
const oldFlipHorizontal = graphic.flipHorizontal;
|
|
148
|
+
const oldFlipVertical = graphic.flipVertical;
|
|
149
|
+
if (flipHorizontal || flipVertical) {
|
|
150
|
+
// flip any currently flipped graphics
|
|
151
|
+
graphic.flipHorizontal = flipHorizontal ? !oldFlipHorizontal : oldFlipHorizontal;
|
|
152
|
+
graphic.flipVertical = flipVertical ? !oldFlipVertical : oldFlipVertical;
|
|
153
|
+
}
|
|
154
|
+
graphic === null || graphic === void 0 ? void 0 : graphic.draw(this._graphicsContext, offsetX + layer.offset.x, offsetY + layer.offset.y);
|
|
155
|
+
if (flipHorizontal || flipVertical) {
|
|
156
|
+
graphic.flipHorizontal = oldFlipHorizontal;
|
|
157
|
+
graphic.flipVertical = oldFlipVertical;
|
|
158
|
+
}
|
|
159
|
+
if (((_a = this._engine) === null || _a === void 0 ? void 0 : _a.isDebug) && this._engine.debug.graphics.showBounds) {
|
|
160
|
+
const offset = vec(offsetX + layer.offset.x, offsetY + layer.offset.y);
|
|
161
|
+
if (graphic instanceof GraphicsGroup) {
|
|
162
|
+
for (const g of graphic.members) {
|
|
163
|
+
(_b = g.graphic) === null || _b === void 0 ? void 0 : _b.localBounds.translate(offset.add(g.pos)).draw(this._graphicsContext, this._engine.debug.graphics.boundsColor);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
/* istanbul ignore next */
|
|
168
|
+
graphic === null || graphic === void 0 ? void 0 : graphic.localBounds.translate(offset).draw(this._graphicsContext, this._engine.debug.graphics.boundsColor);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* This applies the current entity transform to the graphics context
|
|
177
|
+
* @param entity
|
|
178
|
+
*/
|
|
179
|
+
_applyTransform(entity) {
|
|
180
|
+
const ancestors = entity.getAncestors();
|
|
181
|
+
for (const ancestor of ancestors) {
|
|
182
|
+
const transform = ancestor === null || ancestor === void 0 ? void 0 : ancestor.get(TransformComponent);
|
|
183
|
+
const optionalBody = ancestor === null || ancestor === void 0 ? void 0 : ancestor.get(BodyComponent);
|
|
184
|
+
let interpolatedPos = transform.pos;
|
|
185
|
+
let interpolatedScale = transform.scale;
|
|
186
|
+
let interpolatedRotation = transform.rotation;
|
|
187
|
+
if (optionalBody) {
|
|
188
|
+
if (this._engine.fixedUpdateFps &&
|
|
189
|
+
optionalBody.__oldTransformCaptured &&
|
|
190
|
+
optionalBody.enableFixedUpdateInterpolate) {
|
|
191
|
+
// Interpolate graphics if needed
|
|
192
|
+
const blend = this._engine.currentFrameLagMs / (1000 / this._engine.fixedUpdateFps);
|
|
193
|
+
interpolatedPos = transform.pos.scale(blend).add(optionalBody.oldPos.scale(1.0 - blend));
|
|
194
|
+
interpolatedScale = transform.scale.scale(blend).add(optionalBody.oldScale.scale(1.0 - blend));
|
|
195
|
+
// Rotational lerp https://stackoverflow.com/a/30129248
|
|
196
|
+
const cosine = (1.0 - blend) * Math.cos(optionalBody.oldRotation) + blend * Math.cos(transform.rotation);
|
|
197
|
+
const sine = (1.0 - blend) * Math.sin(optionalBody.oldRotation) + blend * Math.sin(transform.rotation);
|
|
198
|
+
interpolatedRotation = Math.atan2(sine, cosine);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (transform) {
|
|
202
|
+
this._graphicsContext.z = transform.z;
|
|
203
|
+
this._graphicsContext.translate(interpolatedPos.x, interpolatedPos.y);
|
|
204
|
+
this._graphicsContext.scale(interpolatedScale.x, interpolatedScale.y);
|
|
205
|
+
this._graphicsContext.rotate(interpolatedRotation);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//# 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,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAG5F,OAAO,EAAe,mBAAmB,EAAiB,MAAM,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE/G,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,OAAO,cAAe,SAAQ,MAA8C;IAAlF;;QACkB,UAAK,GAAG,CAAC,cAAc,EAAE,aAAa,CAAU,CAAC;QACjD,eAAU,GAAG,UAAU,CAAC,IAAI,CAAC;QACtC,aAAQ,GAAG,CAAC,CAAC;QACZ,WAAM,GAAG,CAAC,CAAC;QAKX,sBAAiB,GAAyB,EAAE,CAAC;QAU7C,iBAAY,GAAG,KAAK,CAAC;QACrB,kBAAa,GAAG,GAAG,EAAE;YAC3B,IAAI,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CAAC;gBACtE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;gBACtE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;YACrD,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Resource } from '../Resources/Resource';
|
|
2
|
+
import { Sprite } from './Sprite';
|
|
3
|
+
import { Logger } from '../Util/Log';
|
|
4
|
+
import { Future } from '../Util/Future';
|
|
5
|
+
import { TextureLoader } from '../Graphics/Context/texture-loader';
|
|
6
|
+
export class ImageSource {
|
|
7
|
+
/**
|
|
8
|
+
* The original size of the source image in pixels
|
|
9
|
+
*/
|
|
10
|
+
get width() {
|
|
11
|
+
return this.image.naturalWidth;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The original height of the source image in pixels
|
|
15
|
+
*/
|
|
16
|
+
get height() {
|
|
17
|
+
return this.image.naturalHeight;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns true if the Texture is completely loaded and is ready
|
|
21
|
+
* to be drawn.
|
|
22
|
+
*/
|
|
23
|
+
isLoaded() {
|
|
24
|
+
if (!this._src) {
|
|
25
|
+
// this boosts speed of access
|
|
26
|
+
this._src = this.data.src;
|
|
27
|
+
}
|
|
28
|
+
return !!this._src;
|
|
29
|
+
}
|
|
30
|
+
get image() {
|
|
31
|
+
return this.data;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The path to the image, can also be a data url like 'data:image/'
|
|
35
|
+
* @param path {string} Path to the image resource relative from the HTML document hosting the game, or absolute
|
|
36
|
+
* @param bustCache {boolean} Should excalibur add a cache busting querystring?
|
|
37
|
+
* @param filtering {ImageFiltering} Optionally override the image filtering set by [[EngineOptions.antialiasing]]
|
|
38
|
+
*/
|
|
39
|
+
constructor(path, bustCache = false, filtering) {
|
|
40
|
+
this.path = path;
|
|
41
|
+
this._logger = Logger.getInstance();
|
|
42
|
+
/**
|
|
43
|
+
* Access to the underlying html image element
|
|
44
|
+
*/
|
|
45
|
+
this.data = new Image();
|
|
46
|
+
this._readyFuture = new Future();
|
|
47
|
+
/**
|
|
48
|
+
* Promise the resolves when the image is loaded and ready for use, does not initiate loading
|
|
49
|
+
*/
|
|
50
|
+
this.ready = this._readyFuture.promise;
|
|
51
|
+
this._resource = new Resource(path, 'blob', bustCache);
|
|
52
|
+
this.filtering = filtering;
|
|
53
|
+
if (path.endsWith('.svg') || path.endsWith('.gif')) {
|
|
54
|
+
this._logger.warn(`Image type is not fully supported, you may have mixed results ${path}. Fully supported: jpg, bmp, and png`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Should excalibur add a cache busting querystring? By default false.
|
|
59
|
+
* Must be set before loading
|
|
60
|
+
*/
|
|
61
|
+
get bustCache() {
|
|
62
|
+
return this._resource.bustCache;
|
|
63
|
+
}
|
|
64
|
+
set bustCache(val) {
|
|
65
|
+
this._resource.bustCache = val;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Begins loading the image and returns a promise that resolves when the image is loaded
|
|
69
|
+
*/
|
|
70
|
+
async load() {
|
|
71
|
+
if (this.isLoaded()) {
|
|
72
|
+
return this.data;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
// Load base64 or blob if needed
|
|
76
|
+
let url;
|
|
77
|
+
if (!this.path.includes('data:image/')) {
|
|
78
|
+
const blob = await this._resource.load();
|
|
79
|
+
url = URL.createObjectURL(blob);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
url = this.path;
|
|
83
|
+
}
|
|
84
|
+
// Decode the image
|
|
85
|
+
const image = new Image();
|
|
86
|
+
// Use Image.onload over Image.decode()
|
|
87
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1055828#c7
|
|
88
|
+
// Otherwise chrome will throw still Image.decode() failures for large textures
|
|
89
|
+
const loadedFuture = new Future();
|
|
90
|
+
image.onload = () => loadedFuture.resolve();
|
|
91
|
+
image.src = url;
|
|
92
|
+
image.setAttribute('data-original-src', this.path);
|
|
93
|
+
await loadedFuture.promise;
|
|
94
|
+
// Set results
|
|
95
|
+
// We defer loading the texture into webgl until the first draw that way we avoid a singleton
|
|
96
|
+
// and for the multi-engine case the texture needs to be created in EACH webgl context to work
|
|
97
|
+
// See image-renderer.ts draw()
|
|
98
|
+
this.data = image;
|
|
99
|
+
// emit warning if potentially too big
|
|
100
|
+
TextureLoader.checkImageSizeSupportedAndLog(this.data);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
throw `Error loading ImageSource from path '${this.path}' with error [${error.message}]`;
|
|
104
|
+
}
|
|
105
|
+
// Do a bad thing to pass the filtering as an attribute
|
|
106
|
+
this.data.setAttribute('filtering', this.filtering);
|
|
107
|
+
// todo emit complete
|
|
108
|
+
this._readyFuture.resolve(this.data);
|
|
109
|
+
return this.data;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Build a sprite from this ImageSource
|
|
113
|
+
*/
|
|
114
|
+
toSprite() {
|
|
115
|
+
return Sprite.from(this);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Unload images from memory
|
|
119
|
+
*/
|
|
120
|
+
unload() {
|
|
121
|
+
this.data = new Image();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# 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;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,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;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,wCAAwC,IAAI,CAAC,IAAI,iBAAiB,KAAK,CAAC,OAAO,GAAG,CAAC;QAC3F,CAAC;QACD,uDAAuD;QACvD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAEpD,qBAAqB;QACrB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BoundingBox } from '../Collision/BoundingBox';
|
|
2
|
+
import { Color } from '../Color';
|
|
3
|
+
import { Graphic } from './Graphic';
|
|
4
|
+
export class Line extends Graphic {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super();
|
|
7
|
+
this.color = Color.Black;
|
|
8
|
+
this.thickness = 1;
|
|
9
|
+
const { start, end, color, thickness } = options;
|
|
10
|
+
this.start = start;
|
|
11
|
+
this.end = end;
|
|
12
|
+
this.color = color !== null && color !== void 0 ? color : this.color;
|
|
13
|
+
this.thickness = thickness !== null && thickness !== void 0 ? thickness : this.thickness;
|
|
14
|
+
this._localBounds = this._calculateBounds();
|
|
15
|
+
const { width, height } = this._localBounds;
|
|
16
|
+
this.width = width;
|
|
17
|
+
this.height = height;
|
|
18
|
+
}
|
|
19
|
+
get localBounds() {
|
|
20
|
+
return this._localBounds;
|
|
21
|
+
}
|
|
22
|
+
_calculateBounds() {
|
|
23
|
+
const lineNormal = this.end.sub(this.start).normal();
|
|
24
|
+
const halfThickness = this.thickness / 2;
|
|
25
|
+
const points = [
|
|
26
|
+
this.start.add(lineNormal.scale(halfThickness)),
|
|
27
|
+
this.end.add(lineNormal.scale(halfThickness)),
|
|
28
|
+
this.end.add(lineNormal.scale(-halfThickness)),
|
|
29
|
+
this.start.add(lineNormal.scale(-halfThickness))
|
|
30
|
+
];
|
|
31
|
+
return BoundingBox.fromPoints(points);
|
|
32
|
+
}
|
|
33
|
+
_drawImage(ctx, _x, _y) {
|
|
34
|
+
ctx.drawLine(this.start, this.end, this.color, this.thickness);
|
|
35
|
+
}
|
|
36
|
+
clone() {
|
|
37
|
+
return new Line({
|
|
38
|
+
start: this.start,
|
|
39
|
+
end: this.end,
|
|
40
|
+
color: this.color,
|
|
41
|
+
thickness: this.thickness
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=Line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Line.js","sourceRoot":"","sources":["../../../src/engine/Graphics/Line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,MAAM,OAAO,IAAK,SAAQ,OAAO;IAM/B,YAAY,OAAoB;QAC9B,KAAK,EAAE,CAAC;QAJV,UAAK,GAAU,KAAK,CAAC,KAAK,CAAC;QAC3B,cAAS,GAAW,CAAC,CAAC;QAIpB,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,aAAT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EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { GraphicsComponent } from './GraphicsComponent';
|
|
2
|
+
import { EnterViewPortEvent, ExitViewPortEvent } from '../Events';
|
|
3
|
+
import { TransformComponent } from '../EntityComponentSystem/Components/TransformComponent';
|
|
4
|
+
import { System, SystemType } from '../EntityComponentSystem/System';
|
|
5
|
+
import { ParallaxComponent } from './ParallaxComponent';
|
|
6
|
+
import { Vector } from '../Math/vector';
|
|
7
|
+
import { CoordPlane } from '../Math/coord-plane';
|
|
8
|
+
export class OffscreenSystem extends System {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.types = ['ex.transform', 'ex.graphics'];
|
|
12
|
+
this.systemType = SystemType.Draw;
|
|
13
|
+
this.priority = -1;
|
|
14
|
+
}
|
|
15
|
+
initialize(scene) {
|
|
16
|
+
this._camera = scene.camera;
|
|
17
|
+
this._screen = scene.engine.screen;
|
|
18
|
+
}
|
|
19
|
+
update(entities) {
|
|
20
|
+
this._worldBounds = this._screen.getWorldBounds();
|
|
21
|
+
let transform;
|
|
22
|
+
let graphics;
|
|
23
|
+
let maybeParallax;
|
|
24
|
+
for (const entity of entities) {
|
|
25
|
+
graphics = entity.get(GraphicsComponent);
|
|
26
|
+
transform = entity.get(TransformComponent);
|
|
27
|
+
maybeParallax = entity.get(ParallaxComponent);
|
|
28
|
+
let parallaxOffset;
|
|
29
|
+
if (maybeParallax) {
|
|
30
|
+
// We use the Tiled formula
|
|
31
|
+
// https://doc.mapeditor.org/en/latest/manual/layers/#parallax-scrolling-factor
|
|
32
|
+
// cameraPos * (1 - parallaxFactor)
|
|
33
|
+
const oneMinusFactor = Vector.One.sub(maybeParallax.parallaxFactor);
|
|
34
|
+
parallaxOffset = this._camera.pos.scale(oneMinusFactor);
|
|
35
|
+
}
|
|
36
|
+
// Figure out if entities are offscreen
|
|
37
|
+
const entityOffscreen = this._isOffscreen(transform, graphics, parallaxOffset);
|
|
38
|
+
if (entityOffscreen && !entity.hasTag('ex.offscreen')) {
|
|
39
|
+
entity.events.emit('exitviewport', new ExitViewPortEvent(entity));
|
|
40
|
+
entity.addTag('ex.offscreen');
|
|
41
|
+
}
|
|
42
|
+
if (!entityOffscreen && entity.hasTag('ex.offscreen')) {
|
|
43
|
+
entity.events.emit('enterviewport', new EnterViewPortEvent(entity));
|
|
44
|
+
entity.removeTag('ex.offscreen');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
_isOffscreen(transform, graphics, parallaxOffset) {
|
|
49
|
+
if (transform.coordPlane === CoordPlane.World) {
|
|
50
|
+
let bounds = graphics.localBounds;
|
|
51
|
+
if (parallaxOffset) {
|
|
52
|
+
bounds = bounds.translate(parallaxOffset);
|
|
53
|
+
}
|
|
54
|
+
const transformedBounds = bounds.transform(transform.get().matrix);
|
|
55
|
+
const graphicsOffscreen = !this._worldBounds.overlaps(transformedBounds);
|
|
56
|
+
return graphicsOffscreen;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// TODO screen coordinates
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=OffscreenSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OffscreenSystem.js","sourceRoot":"","sources":["../../../src/engine/Graphics/OffscreenSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAIlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAE5F,OAAO,EAA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 -0,0 +1,11 @@
|
|
|
1
|
+
import { Component } from '../EntityComponentSystem/Component';
|
|
2
|
+
import { vec } from '../Math/vector';
|
|
3
|
+
export class ParallaxComponent extends Component {
|
|
4
|
+
constructor(parallaxFactor) {
|
|
5
|
+
super();
|
|
6
|
+
this.type = 'ex.parallax';
|
|
7
|
+
this.parallaxFactor = vec(1.0, 1.0);
|
|
8
|
+
this.parallaxFactor = parallaxFactor !== null && parallaxFactor !== void 0 ? parallaxFactor : this.parallaxFactor;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ParallaxComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParallaxComponent.js","sourceRoot":"","sources":["../../../src/engine/Graphics/ParallaxComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAU,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,iBAAkB,SAAQ,SAAwB;IAK7D,YAAY,cAAuB;QACjC,KAAK,EAAE,CAAC;QALD,SAAI,GAAG,aAAa,CAAC;QAE9B,mBAAc,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAI7B,IAAI,CAAC,cAAc,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,CAAC,cAAc,CAAC;IAC9D,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
|
+
get points() {
|
|
11
|
+
return this._points;
|
|
12
|
+
}
|
|
13
|
+
set points(points) {
|
|
14
|
+
this._points = points;
|
|
15
|
+
const min = this.minPoint;
|
|
16
|
+
this.width = this._points.reduce((max, p) => Math.max(p.x, max), 0) - min.x;
|
|
17
|
+
this.height = this._points.reduce((max, p) => Math.max(p.y, max), 0) - min.y;
|
|
18
|
+
this.flagDirty();
|
|
19
|
+
}
|
|
20
|
+
get minPoint() {
|
|
21
|
+
const minX = this._points.reduce((min, p) => Math.min(p.x, min), Infinity);
|
|
22
|
+
const minY = this._points.reduce((min, p) => Math.min(p.y, min), Infinity);
|
|
23
|
+
return vec(minX, minY);
|
|
24
|
+
}
|
|
25
|
+
constructor(options) {
|
|
26
|
+
super(options);
|
|
27
|
+
this.points = options.points;
|
|
28
|
+
this.filtering = ImageFiltering.Blended;
|
|
29
|
+
this.rasterize();
|
|
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
|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CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;YACvC,GAAG,CAAC,SAAS,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,GAAG,CAAC,IAAI,EAAE,CAAC;YACb,CAAC;YACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,CAAC;QACH,CAAC;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"}
|