melonjs 14.1.2 → 14.3.0
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/README.md +3 -4
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +7 -3
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/_virtual/index2.js +7 -3
- package/dist/melonjs.mjs/_virtual/make-built-in.js +10 -0
- package/dist/melonjs.mjs/_virtual/multimap.js +1 -1
- package/dist/melonjs.mjs/_virtual/object-define-property.js +10 -0
- package/dist/melonjs.mjs/_virtual/object-get-own-property-descriptor.js +10 -0
- package/dist/melonjs.mjs/_virtual/object-get-own-property-names.js +10 -0
- package/dist/melonjs.mjs/_virtual/object-get-own-property-symbols.js +10 -0
- package/dist/melonjs.mjs/_virtual/object-property-is-enumerable.js +10 -0
- package/dist/melonjs.mjs/_virtual/setmultimap.js +1 -1
- package/dist/melonjs.mjs/_virtual/shared.js +10 -0
- package/dist/melonjs.mjs/application/application.js +173 -22
- package/dist/melonjs.mjs/application/header.js +34 -0
- package/dist/melonjs.mjs/application/resize.js +119 -0
- package/dist/melonjs.mjs/application/settings.js +28 -0
- package/dist/melonjs.mjs/audio/audio.js +1 -1
- package/dist/melonjs.mjs/camera/camera2d.js +2 -2
- package/dist/melonjs.mjs/entity/entity.js +1 -1
- package/dist/melonjs.mjs/game.js +1 -1
- package/dist/melonjs.mjs/geometries/ellipse.js +1 -1
- package/dist/melonjs.mjs/geometries/line.js +1 -1
- package/dist/melonjs.mjs/geometries/path2d.js +3 -3
- package/dist/melonjs.mjs/geometries/point.js +1 -1
- package/dist/melonjs.mjs/geometries/poly.js +3 -3
- package/dist/melonjs.mjs/geometries/rectangle.js +1 -1
- package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
- package/dist/melonjs.mjs/index.js +41 -61
- package/dist/melonjs.mjs/input/gamepad.js +1 -1
- package/dist/melonjs.mjs/input/input.js +1 -1
- package/dist/melonjs.mjs/input/keyboard.js +1 -1
- package/dist/melonjs.mjs/input/pointer.js +2 -2
- package/dist/melonjs.mjs/input/pointerevent.js +7 -8
- package/dist/melonjs.mjs/lang/deprecated.js +1 -1
- package/dist/melonjs.mjs/level/level.js +2 -2
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +2 -2
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/dist/melonjs.mjs/loader/loader.js +1 -1
- package/dist/melonjs.mjs/loader/loadingscreen.js +2 -2
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/math/color.js +1 -1
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +1 -1
- package/dist/melonjs.mjs/math/matrix3.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector2.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector3.js +1 -1
- package/dist/melonjs.mjs/math/vector2.js +1 -1
- package/dist/melonjs.mjs/math/vector3.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +3 -2
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +3 -2
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +3 -2
- package/dist/melonjs.mjs/node_modules/core-js/es/string/trim-end.js +13 -0
- package/dist/melonjs.mjs/node_modules/core-js/es/string/trim-start.js +13 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/a-callable.js +22 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/an-object.js +21 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/array-includes.js +45 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/classof-raw.js +19 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/classof.js +43 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/copy-constructor-properties.js +32 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/create-non-enumerable-property.js +24 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/create-property-descriptor.js +17 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/define-built-in.js +43 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/define-global-property.js +23 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/descriptors.js +18 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/document-all.js +18 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/document-create-element.js +22 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/engine-user-agent.js +14 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/engine-v8-version.js +39 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/entry-unbind.js +18 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/enum-bug-keys.js +19 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/export.js +72 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/fails.js +16 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/function-bind-native.js +19 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/function-call.js +18 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/function-name.js +29 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/function-uncurry-this.js +22 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/get-built-in.js +22 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/get-method.js +21 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/global.js +25 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/has-own-property.js +23 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/hidden-keys.js +10 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/ie8-dom-define.js +24 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/indexed-object.js +28 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/inspect-source.js +27 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/internal-state.js +88 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/is-callable.js +22 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/is-forced.js +34 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/is-null-or-undefined.js +14 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/is-object.js +22 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/is-symbol.js +27 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/length-of-array-like.js +18 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/make-built-in.js +68 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/math-trunc.js +19 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-define-property.js +58 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-descriptor.js +41 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-names.js +23 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-symbols.js +12 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-is-prototype-of.js +14 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-keys-internal.js +35 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-property-is-enumerable.js +23 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/ordinary-to-primitive.js +28 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/own-keys.js +31 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/require-object-coercible.js +21 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/shared-key.js +21 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/shared-store.js +19 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/shared.js +24 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-end.js +22 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-forced.js +28 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-start.js +22 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim.js +45 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/symbol-constructor-detection.js +26 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-absolute-index.js +23 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-indexed-object.js +19 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-integer-or-infinity.js +20 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-length.js +20 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-object.js +20 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-primitive.js +41 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-property-key.js +21 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-string-tag-support.js +19 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-string.js +19 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/try-to-string.js +18 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/uid.js +20 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/use-symbol-as-uid.js +18 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/v8-prototype-define-bug.js +24 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/weak-map-basic-detection.js +18 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/well-known-symbol.js +41 -0
- package/dist/melonjs.mjs/node_modules/core-js/internals/whitespaces.js +12 -0
- package/dist/melonjs.mjs/node_modules/core-js/modules/es.global-this.js +18 -0
- package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-end.js +22 -0
- package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-left.js +19 -0
- package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-right.js +19 -0
- package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-start.js +22 -0
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +4 -5
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +3 -3
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.mjs.js +9 -0
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +5 -2
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +3 -2
- package/dist/melonjs.mjs/particles/emitter.js +1 -1
- package/dist/melonjs.mjs/particles/particle.js +1 -1
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +1 -1
- package/dist/melonjs.mjs/physics/bounds.js +1 -1
- package/dist/melonjs.mjs/physics/collision.js +3 -3
- package/dist/melonjs.mjs/physics/detector.js +174 -146
- package/dist/melonjs.mjs/physics/quadtree.js +1 -1
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +1 -1
- package/dist/melonjs.mjs/physics/world.js +10 -30
- package/dist/melonjs.mjs/plugin/plugin.js +4 -4
- package/dist/melonjs.mjs/polyfill/console.js +18 -0
- package/dist/melonjs.mjs/polyfill/performance.js +27 -0
- package/dist/melonjs.mjs/polyfill/requestAnimationFrame.js +46 -0
- package/dist/melonjs.mjs/polyfill/roundrect.js +242 -0
- package/dist/melonjs.mjs/renderable/collectable.js +1 -1
- package/dist/melonjs.mjs/renderable/colorlayer.js +1 -1
- package/dist/melonjs.mjs/renderable/container.js +3 -87
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +2 -2
- package/dist/melonjs.mjs/renderable/light2d.js +1 -1
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
- package/dist/melonjs.mjs/renderable/re_container.js +1016 -0
- package/dist/melonjs.mjs/renderable/renderable.js +1 -1
- package/dist/melonjs.mjs/renderable/sprite.js +1 -1
- package/dist/melonjs.mjs/renderable/trigger.js +2 -2
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +1 -1
- package/dist/melonjs.mjs/state/stage.js +2 -2
- package/dist/melonjs.mjs/state/state.js +2 -2
- package/dist/melonjs.mjs/system/device.js +9 -29
- package/dist/melonjs.mjs/system/dom.js +3 -2
- package/dist/melonjs.mjs/system/event.js +1 -1
- package/dist/melonjs.mjs/system/platform.js +1 -1
- package/dist/melonjs.mjs/system/pooling.js +1 -1
- package/dist/melonjs.mjs/system/save.js +1 -1
- package/dist/melonjs.mjs/system/timer.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptextdata.js +1 -1
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +1 -1
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +2 -2
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +1 -1
- package/dist/melonjs.mjs/utils/string.js +1 -1
- package/dist/melonjs.mjs/utils/utils.js +4 -29
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +4 -1
- package/dist/melonjs.mjs/video/renderer.js +26 -6
- package/dist/melonjs.mjs/video/texture/atlas.js +1 -1
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +21 -1
- package/dist/melonjs.mjs/video/utils/autodetect.js +27 -0
- package/dist/melonjs.mjs/video/utils/resize.js +116 -0
- package/dist/melonjs.mjs/video/video.js +20 -294
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
- package/dist/melonjs.mjs/video/webgl/glshader.js +2 -3
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +20 -2
- package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +4 -1
- package/dist/melonjs.module.js +28551 -26959
- package/dist/types/application/application.d.ts +144 -0
- package/dist/types/application/header.d.ts +5 -0
- package/dist/types/application/resize.d.ts +5 -0
- package/dist/types/application/settings.d.ts +18 -0
- package/dist/types/audio/audio.d.ts +267 -0
- package/dist/types/camera/camera2d.d.ts +289 -0
- package/dist/types/entity/entity.d.ts +98 -0
- package/{src/game.js → dist/types/game.d.ts} +3 -14
- package/dist/types/geometries/ellipse.d.ts +154 -0
- package/dist/types/geometries/line.d.ts +11 -0
- package/dist/types/geometries/path2d.d.ts +121 -0
- package/dist/types/geometries/point.d.ts +53 -0
- package/dist/types/geometries/poly.d.ts +222 -0
- package/dist/types/geometries/rectangle.d.ts +176 -0
- package/dist/types/geometries/roundrect.d.ts +52 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/input/gamepad.d.ts +95 -0
- package/dist/types/input/input.d.ts +15 -0
- package/dist/types/input/keyboard.d.ts +205 -0
- package/dist/types/input/pointer.d.ts +270 -0
- package/dist/types/input/pointerevent.d.ts +181 -0
- package/dist/types/lang/deprecated.d.ts +53 -0
- package/dist/types/level/level.d.ts +134 -0
- package/dist/types/level/tiled/TMXGroup.d.ts +82 -0
- package/dist/types/level/tiled/TMXLayer.d.ts +180 -0
- package/dist/types/level/tiled/TMXObject.d.ts +195 -0
- package/dist/types/level/tiled/TMXTile.d.ts +78 -0
- package/dist/types/level/tiled/TMXTileMap.d.ts +180 -0
- package/dist/types/level/tiled/TMXTileset.d.ts +94 -0
- package/dist/types/level/tiled/TMXTilesetGroup.d.ts +32 -0
- package/dist/types/level/tiled/TMXUtils.d.ts +47 -0
- package/dist/types/level/tiled/renderer/TMXHexagonalRenderer.d.ts +87 -0
- package/dist/types/level/tiled/renderer/TMXIsometricRenderer.d.ts +55 -0
- package/dist/types/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +43 -0
- package/dist/types/level/tiled/renderer/TMXRenderer.d.ts +75 -0
- package/dist/types/level/tiled/renderer/TMXStaggeredRenderer.d.ts +8 -0
- package/dist/types/loader/loader.d.ts +181 -0
- package/dist/types/loader/loadingscreen.d.ts +18 -0
- package/dist/types/math/color.d.ts +170 -0
- package/dist/types/math/math.d.ts +165 -0
- package/dist/types/math/matrix2.d.ts +209 -0
- package/dist/types/math/matrix3.d.ts +236 -0
- package/dist/types/math/observable_vector2.d.ts +278 -0
- package/dist/types/math/observable_vector3.d.ts +277 -0
- package/dist/types/math/vector2.d.ts +327 -0
- package/dist/types/math/vector3.d.ts +332 -0
- package/dist/types/particles/emitter.d.ts +188 -0
- package/dist/types/particles/particle.d.ts +32 -0
- package/dist/types/particles/settings.d.ts +32 -0
- package/dist/types/physics/body.d.ts +330 -0
- package/dist/types/physics/bounds.d.ts +250 -0
- package/dist/types/physics/collision.d.ts +44 -0
- package/dist/types/physics/detector.d.ts +64 -0
- package/dist/types/physics/quadtree.d.ts +79 -0
- package/dist/types/physics/response.d.ts +37 -0
- package/dist/types/physics/sat.d.ts +48 -0
- package/dist/types/physics/world.d.ts +83 -0
- package/dist/types/plugin/plugin.d.ts +10 -0
- package/dist/types/polyfill/console.d.ts +0 -0
- package/dist/types/polyfill/index.d.ts +1 -0
- package/dist/types/polyfill/performance.d.ts +0 -0
- package/dist/types/polyfill/requestAnimationFrame.d.ts +1 -0
- package/dist/types/polyfill/roundrect.d.ts +0 -0
- package/dist/types/renderable/collectable.d.ts +19 -0
- package/dist/types/renderable/colorlayer.d.ts +28 -0
- package/dist/types/renderable/container.d.ts +302 -0
- package/dist/types/renderable/dragndrop.d.ts +118 -0
- package/dist/types/renderable/imagelayer.d.ts +106 -0
- package/dist/types/renderable/light2d.d.ts +58 -0
- package/dist/types/renderable/nineslicesprite.d.ts +59 -0
- package/dist/types/renderable/renderable.d.ts +402 -0
- package/dist/types/renderable/sprite.d.ts +268 -0
- package/dist/types/renderable/trigger.d.ts +61 -0
- package/dist/types/renderable/ui/uibaseelement.d.ts +95 -0
- package/dist/types/renderable/ui/uispriteelement.d.ts +127 -0
- package/dist/types/renderable/ui/uitextbutton.d.ts +54 -0
- package/dist/types/state/stage.d.ts +116 -0
- package/dist/types/state/state.d.ts +170 -0
- package/dist/types/system/device.d.ts +579 -0
- package/dist/types/system/dom.d.ts +1 -0
- package/dist/types/system/event.d.ts +473 -0
- package/dist/types/system/platform.d.ts +31 -0
- package/dist/types/system/pooling.d.ts +101 -0
- package/dist/types/system/save.d.ts +25 -0
- package/dist/types/system/timer.d.ts +126 -0
- package/dist/types/text/bitmaptext.d.ts +151 -0
- package/dist/types/text/bitmaptextdata.d.ts +35 -0
- package/dist/types/text/glyph.d.ts +28 -0
- package/dist/types/text/text.d.ts +173 -0
- package/dist/types/text/textmetrics.d.ts +47 -0
- package/dist/types/text/textstyle.d.ts +5 -0
- package/dist/types/tweens/easing.d.ts +46 -0
- package/dist/types/tweens/interpolation.d.ts +18 -0
- package/dist/types/tweens/tween.d.ts +195 -0
- package/dist/types/utils/agent.d.ts +21 -0
- package/dist/types/utils/array.d.ts +39 -0
- package/dist/types/utils/file.d.ts +18 -0
- package/dist/types/utils/function.d.ts +32 -0
- package/dist/types/utils/string.d.ts +50 -0
- package/dist/types/utils/utils.d.ts +17 -0
- package/dist/types/video/canvas/canvas_renderer.d.ts +380 -0
- package/dist/types/video/renderer.d.ts +222 -0
- package/dist/types/video/texture/atlas.d.ts +201 -0
- package/dist/types/video/texture/cache.d.ts +45 -0
- package/dist/types/video/texture/canvas_texture.d.ts +78 -0
- package/dist/types/video/utils/autodetect.d.ts +7 -0
- package/dist/types/video/utils/resize.d.ts +4 -0
- package/dist/types/video/video.d.ts +92 -0
- package/dist/types/video/webgl/buffer/vertex.d.ts +56 -0
- package/dist/types/video/webgl/glshader.d.ts +93 -0
- package/dist/types/video/webgl/utils/attributes.d.ts +4 -0
- package/dist/types/video/webgl/utils/precision.d.ts +13 -0
- package/dist/types/video/webgl/utils/program.d.ts +5 -0
- package/dist/types/video/webgl/utils/string.d.ts +5 -0
- package/dist/types/video/webgl/utils/uniforms.d.ts +4 -0
- package/dist/types/video/webgl/webgl_compositor.d.ts +174 -0
- package/dist/types/video/webgl/webgl_renderer.d.ts +429 -0
- package/package.json +14 -14
- package/src/application/application.js +171 -20
- package/src/application/header.js +25 -0
- package/src/application/resize.js +110 -0
- package/src/application/settings.js +19 -0
- package/src/camera/camera2d.js +1 -1
- package/src/index.js +34 -23
- package/src/input/pointer.js +1 -1
- package/src/input/pointerevent.js +6 -7
- package/src/level/level.js +1 -1
- package/src/level/tiled/TMXLayer.js +1 -1
- package/src/level/tiled/TMXTileMap.js +2 -2
- package/src/loader/loadingscreen.js +1 -1
- package/src/physics/collision.js +2 -2
- package/src/physics/detector.js +172 -145
- package/src/physics/world.js +10 -30
- package/src/plugin/plugin.js +1 -1
- package/src/renderable/container.js +7 -91
- package/src/renderable/imagelayer.js +1 -1
- package/src/renderable/trigger.js +1 -1
- package/src/renderable/ui/uibaseelement.js +1 -1
- package/src/state/stage.js +1 -1
- package/src/state/state.js +1 -1
- package/src/system/device.js +7 -27
- package/src/system/dom.js +2 -1
- package/src/tweens/tween.js +1 -1
- package/src/utils/utils.js +3 -28
- package/src/video/canvas/canvas_renderer.js +3 -0
- package/src/video/renderer.js +27 -7
- package/src/video/texture/canvas_texture.js +20 -0
- package/src/video/utils/autodetect.js +18 -0
- package/src/video/video.js +17 -291
- package/src/video/webgl/glshader.js +3 -4
- package/src/video/webgl/utils/precision.js +18 -0
- package/src/video/webgl/webgl_renderer.js +3 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @classdesc
|
|
3
|
+
* A WebGL Compositor object. This class handles all of the WebGL state<br>
|
|
4
|
+
* Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU
|
|
5
|
+
*/
|
|
6
|
+
export default class WebGLCompositor {
|
|
7
|
+
/**
|
|
8
|
+
* @param {WebGLRenderer} renderer - the current WebGL renderer session
|
|
9
|
+
*/
|
|
10
|
+
constructor(renderer: WebGLRenderer);
|
|
11
|
+
/**
|
|
12
|
+
* Initialize the compositor
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
init(renderer: any): void;
|
|
16
|
+
currentTextureUnit: any;
|
|
17
|
+
boundTextures: any[] | undefined;
|
|
18
|
+
renderer: any;
|
|
19
|
+
gl: any;
|
|
20
|
+
color: any;
|
|
21
|
+
viewMatrix: any;
|
|
22
|
+
/**
|
|
23
|
+
* a reference to the active WebGL shader
|
|
24
|
+
* @type {GLShader}
|
|
25
|
+
*/
|
|
26
|
+
activeShader: GLShader | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
|
|
29
|
+
* @type {number}
|
|
30
|
+
* @default gl.TRIANGLES
|
|
31
|
+
*/
|
|
32
|
+
mode: number | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* an array of vertex attribute properties
|
|
35
|
+
* @see WebGLCompositor.addAttribute
|
|
36
|
+
* @type {Array}
|
|
37
|
+
*/
|
|
38
|
+
attributes: any[] | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* the size of a single vertex in bytes
|
|
41
|
+
* (will automatically be calculated as attributes definitions are added)
|
|
42
|
+
* @see WebGLCompositor.addAttribute
|
|
43
|
+
* @type {number}
|
|
44
|
+
*/
|
|
45
|
+
vertexByteSize: number | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* the size of a single vertex in floats
|
|
48
|
+
* (will automatically be calculated as attributes definitions are added)
|
|
49
|
+
* @see WebGLCompositor.addAttribute
|
|
50
|
+
* @type {number}
|
|
51
|
+
*/
|
|
52
|
+
vertexSize: number | undefined;
|
|
53
|
+
primitiveShader: GLShader | undefined;
|
|
54
|
+
quadShader: GLShader | undefined;
|
|
55
|
+
vertexBuffer: VertexArrayBuffer | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Reset compositor internal state
|
|
58
|
+
* @ignore
|
|
59
|
+
*/
|
|
60
|
+
reset(): void;
|
|
61
|
+
/**
|
|
62
|
+
* add vertex attribute property definition to the compositor
|
|
63
|
+
* @param {string} name - name of the attribute in the vertex shader
|
|
64
|
+
* @param {number} size - number of components per vertex attribute. Must be 1, 2, 3, or 4.
|
|
65
|
+
* @param {GLenum} type - data type of each component in the array
|
|
66
|
+
* @param {boolean} normalized - whether integer data values should be normalized into a certain range when being cast to a float
|
|
67
|
+
* @param {number} offset - offset in bytes of the first component in the vertex attribute array
|
|
68
|
+
*/
|
|
69
|
+
addAttribute(name: string, size: number, type: GLenum, normalized: boolean, offset: number): void;
|
|
70
|
+
/**
|
|
71
|
+
* Sets the viewport
|
|
72
|
+
* @param {number} x - x position of viewport
|
|
73
|
+
* @param {number} y - y position of viewport
|
|
74
|
+
* @param {number} w - width of viewport
|
|
75
|
+
* @param {number} h - height of viewport
|
|
76
|
+
*/
|
|
77
|
+
setViewport(x: number, y: number, w: number, h: number): void;
|
|
78
|
+
/**
|
|
79
|
+
* Create a WebGL texture from an image
|
|
80
|
+
* @param {number} unit - Destination texture unit
|
|
81
|
+
* @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image - Source image
|
|
82
|
+
* @param {number} filter - gl.LINEAR or gl.NEAREST
|
|
83
|
+
* @param {string} [repeat="no-repeat"] - Image repeat behavior (see {@link ImageLayer#repeat})
|
|
84
|
+
* @param {number} [w] - Source image width (Only use with UInt8Array[] or Float32Array[] source image)
|
|
85
|
+
* @param {number} [h] - Source image height (Only use with UInt8Array[] or Float32Array[] source image)
|
|
86
|
+
* @param {number} [b] - Source image border (Only use with UInt8Array[] or Float32Array[] source image)
|
|
87
|
+
* @param {boolean} [premultipliedAlpha=true] - Multiplies the alpha channel into the other color channels
|
|
88
|
+
* @param {boolean} [mipmap=true] - Whether mipmap levels should be generated for this texture
|
|
89
|
+
* @returns {WebGLTexture} a WebGL texture
|
|
90
|
+
*/
|
|
91
|
+
createTexture2D(unit: number, image: (new (width?: number | undefined, height?: number | undefined) => HTMLImageElement) | HTMLCanvasElement | ImageData | Uint8Array[] | Float32Array[], filter: number, repeat?: string | undefined, w?: number | undefined, h?: number | undefined, b?: number | undefined, premultipliedAlpha?: boolean | undefined, mipmap?: boolean | undefined): WebGLTexture;
|
|
92
|
+
/**
|
|
93
|
+
* delete the given WebGL texture
|
|
94
|
+
* @param {WebGLTexture} [texture] - a WebGL texture to delete
|
|
95
|
+
* @param {number} [unit] - Texture unit to delete
|
|
96
|
+
*/
|
|
97
|
+
deleteTexture2D(texture?: WebGLTexture | undefined): void;
|
|
98
|
+
/**
|
|
99
|
+
* returns the WebGL texture associated to the given texture unit
|
|
100
|
+
* @param {number} unit - Texture unit to which a texture is bound
|
|
101
|
+
* @returns {WebGLTexture} texture a WebGL texture
|
|
102
|
+
*/
|
|
103
|
+
getTexture2D(unit: number): WebGLTexture;
|
|
104
|
+
/**
|
|
105
|
+
* assign the given WebGL texture to the current batch
|
|
106
|
+
* @param {WebGLTexture} texture - a WebGL texture
|
|
107
|
+
* @param {number} unit - Texture unit to which the given texture is bound
|
|
108
|
+
*/
|
|
109
|
+
bindTexture2D(texture: WebGLTexture, unit: number): void;
|
|
110
|
+
/**
|
|
111
|
+
* unbind the given WebGL texture, forcing it to be reuploaded
|
|
112
|
+
* @param {WebGLTexture} [texture] - a WebGL texture
|
|
113
|
+
* @param {number} [unit] - a WebGL texture
|
|
114
|
+
* @returns {number} unit the unit number that was associated with the given texture
|
|
115
|
+
*/
|
|
116
|
+
unbindTexture2D(texture?: WebGLTexture | undefined, unit?: number | undefined): number;
|
|
117
|
+
/**
|
|
118
|
+
* @ignore
|
|
119
|
+
*/
|
|
120
|
+
uploadTexture(texture: any, w: any, h: any, b: any, force?: boolean): any;
|
|
121
|
+
/**
|
|
122
|
+
* set/change the current projection matrix
|
|
123
|
+
* @param {Matrix3d} matrix
|
|
124
|
+
*/
|
|
125
|
+
setProjection(matrix: Matrix3d): void;
|
|
126
|
+
/**
|
|
127
|
+
* Select the shader to use for compositing
|
|
128
|
+
* @see GLShader
|
|
129
|
+
* @param {GLShader} shader - a reference to a GLShader instance
|
|
130
|
+
*/
|
|
131
|
+
useShader(shader: GLShader): void;
|
|
132
|
+
/**
|
|
133
|
+
* Add a textured quad
|
|
134
|
+
* @param {TextureAtlas} texture - Source texture atlas
|
|
135
|
+
* @param {number} x - Destination x-coordinate
|
|
136
|
+
* @param {number} y - Destination y-coordinate
|
|
137
|
+
* @param {number} w - Destination width
|
|
138
|
+
* @param {number} h - Destination height
|
|
139
|
+
* @param {number} u0 - Texture UV (u0) value.
|
|
140
|
+
* @param {number} v0 - Texture UV (v0) value.
|
|
141
|
+
* @param {number} u1 - Texture UV (u1) value.
|
|
142
|
+
* @param {number} v1 - Texture UV (v1) value.
|
|
143
|
+
* @param {number} tint - tint color to be applied to the texture in UINT32 (argb) format
|
|
144
|
+
*/
|
|
145
|
+
addQuad(texture: TextureAtlas, x: number, y: number, w: number, h: number, u0: number, v0: number, u1: number, v1: number, tint: number): void;
|
|
146
|
+
/**
|
|
147
|
+
* Flush batched texture operations to the GPU
|
|
148
|
+
* @param {number} [mode=gl.TRIANGLES] - the GL drawing mode
|
|
149
|
+
*/
|
|
150
|
+
flush(mode?: number | undefined): void;
|
|
151
|
+
/**
|
|
152
|
+
* Draw an array of vertices
|
|
153
|
+
* @param {GLenum} mode - primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
|
|
154
|
+
* @param {Vector2d[]} verts - vertices
|
|
155
|
+
* @param {number} [vertexCount=verts.length] - amount of points defined in the points array
|
|
156
|
+
*/
|
|
157
|
+
drawVertices(mode: GLenum, verts: Vector2d[], vertexCount?: number | undefined): void;
|
|
158
|
+
/**
|
|
159
|
+
* Clear the frame buffer
|
|
160
|
+
* @param {number} [alpha = 0.0] - the alpha value used when clearing the framebuffer
|
|
161
|
+
*/
|
|
162
|
+
clear(alpha?: number | undefined): void;
|
|
163
|
+
/**
|
|
164
|
+
* Specify the color values used when clearing color buffers. The values are clamped between 0 and 1.
|
|
165
|
+
* @param {number} [r = 0] - the red color value used when the color buffers are cleared
|
|
166
|
+
* @param {number} [g = 0] - the green color value used when the color buffers are cleared
|
|
167
|
+
* @param {number} [b = 0] - the blue color value used when the color buffers are cleared
|
|
168
|
+
* @param {number} [a = 0] - the alpha color value used when the color buffers are cleared
|
|
169
|
+
*/
|
|
170
|
+
clearColor(r?: number | undefined, g?: number | undefined, b?: number | undefined, a?: number | undefined): void;
|
|
171
|
+
}
|
|
172
|
+
import GLShader from "./glshader.js";
|
|
173
|
+
import VertexArrayBuffer from "./buffer/vertex.js";
|
|
174
|
+
import Vector2d from "./../../math/vector2.js";
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @classdesc
|
|
3
|
+
* a WebGL renderer object
|
|
4
|
+
* @augments Renderer
|
|
5
|
+
*/
|
|
6
|
+
export default class WebGLRenderer extends Renderer {
|
|
7
|
+
/**
|
|
8
|
+
* @param {object} options - The renderer parameters
|
|
9
|
+
* @param {number} options.width - The width of the canvas without scaling
|
|
10
|
+
* @param {number} options.height - The height of the canvas without scaling
|
|
11
|
+
* @param {HTMLCanvasElement} [options.canvas] - The html canvas to draw to on screen
|
|
12
|
+
* @param {boolean} [options.antiAlias=false] - Whether to enable anti-aliasing
|
|
13
|
+
* @param {boolean} [options.failIfMajorPerformanceCaveat=true] - If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
|
|
14
|
+
* @param {boolean} [options.transparent=false] - Whether to enable transparency on the canvas
|
|
15
|
+
* @param {boolean} [options.premultipliedAlpha=true] - in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
|
|
16
|
+
* @param {boolean} [options.subPixel=false] - Whether to enable subpixel renderering (performance hit when enabled)
|
|
17
|
+
* @param {boolean} [options.preferWebGL1=false] - if true the renderer will only use WebGL 1
|
|
18
|
+
* @param {string} [options.powerPreference="default"] - a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context ("default", "high-performance", "low-power"). To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
|
|
19
|
+
* @param {number} [options.zoomX=width] - The actual width of the canvas with scaling applied
|
|
20
|
+
* @param {number} [options.zoomY=height] - The actual height of the canvas with scaling applied
|
|
21
|
+
* @param {WebGLCompositor} [options.compositor] - A class that implements the compositor API
|
|
22
|
+
*/
|
|
23
|
+
constructor(options: {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
canvas?: HTMLCanvasElement | undefined;
|
|
27
|
+
antiAlias?: boolean | undefined;
|
|
28
|
+
failIfMajorPerformanceCaveat?: boolean | undefined;
|
|
29
|
+
transparent?: boolean | undefined;
|
|
30
|
+
premultipliedAlpha?: boolean | undefined;
|
|
31
|
+
subPixel?: boolean | undefined;
|
|
32
|
+
preferWebGL1?: boolean | undefined;
|
|
33
|
+
powerPreference?: string | undefined;
|
|
34
|
+
zoomX?: number | undefined;
|
|
35
|
+
zoomY?: number | undefined;
|
|
36
|
+
compositor?: WebGLCompositor | undefined;
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* The WebGL version used by this renderer (1 or 2)
|
|
40
|
+
* @type {number}
|
|
41
|
+
* @default 1
|
|
42
|
+
* @readonly
|
|
43
|
+
*/
|
|
44
|
+
readonly WebGLVersion: number;
|
|
45
|
+
/**
|
|
46
|
+
* The vendor string of the underlying graphics driver.
|
|
47
|
+
* @type {string}
|
|
48
|
+
* @default null
|
|
49
|
+
* @readonly
|
|
50
|
+
*/
|
|
51
|
+
readonly GPUVendor: string;
|
|
52
|
+
/**
|
|
53
|
+
* The renderer string of the underlying graphics driver.
|
|
54
|
+
* @type {string}
|
|
55
|
+
* @default null
|
|
56
|
+
* @readonly
|
|
57
|
+
*/
|
|
58
|
+
readonly GPURenderer: string;
|
|
59
|
+
/**
|
|
60
|
+
* The WebGL context
|
|
61
|
+
* @name gl
|
|
62
|
+
* @type {WebGLRenderingContext}
|
|
63
|
+
*/
|
|
64
|
+
context: WebGLRenderingContext;
|
|
65
|
+
gl: WebGLRenderingContext;
|
|
66
|
+
/**
|
|
67
|
+
* Maximum number of texture unit supported under the current context
|
|
68
|
+
* @type {number}
|
|
69
|
+
* @readonly
|
|
70
|
+
*/
|
|
71
|
+
readonly maxTextures: number;
|
|
72
|
+
/**
|
|
73
|
+
* @ignore
|
|
74
|
+
*/
|
|
75
|
+
_colorStack: any[];
|
|
76
|
+
/**
|
|
77
|
+
* @ignore
|
|
78
|
+
*/
|
|
79
|
+
_matrixStack: any[];
|
|
80
|
+
/**
|
|
81
|
+
* @ignore
|
|
82
|
+
*/
|
|
83
|
+
_scissorStack: any[];
|
|
84
|
+
/**
|
|
85
|
+
* @ignore
|
|
86
|
+
*/
|
|
87
|
+
_blendStack: any[];
|
|
88
|
+
/**
|
|
89
|
+
* The current transformation matrix used for transformations on the overall scene
|
|
90
|
+
* @type {Matrix2d}
|
|
91
|
+
*/
|
|
92
|
+
currentTransform: Matrix2d;
|
|
93
|
+
/**
|
|
94
|
+
* The current compositor used by the renderer
|
|
95
|
+
* @type {WebGLCompositor}
|
|
96
|
+
*/
|
|
97
|
+
currentCompositor: WebGLCompositor;
|
|
98
|
+
/**
|
|
99
|
+
* The list of active compositors
|
|
100
|
+
* @type {Map<WebGLCompositor>}
|
|
101
|
+
*/
|
|
102
|
+
compositors: Map<WebGLCompositor, any>;
|
|
103
|
+
cache: TextureCache;
|
|
104
|
+
/**
|
|
105
|
+
* set the active compositor for this renderer
|
|
106
|
+
* @param {WebGLCompositor|string} compositor - a compositor name or instance
|
|
107
|
+
*/
|
|
108
|
+
setCompositor(compositor?: WebGLCompositor | string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Reset the gl transform to identity
|
|
111
|
+
*/
|
|
112
|
+
resetTransform(): void;
|
|
113
|
+
/**
|
|
114
|
+
* @ignore
|
|
115
|
+
*/
|
|
116
|
+
createFontTexture(cache: any): void;
|
|
117
|
+
/**
|
|
118
|
+
* @ignore
|
|
119
|
+
*/
|
|
120
|
+
fontContext2D: CanvasRenderingContext2D | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* @ignore
|
|
123
|
+
*/
|
|
124
|
+
fontTexture: TextureAtlas | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Create a pattern with the specified repetition
|
|
127
|
+
* @param {Image} image - Source image
|
|
128
|
+
* @param {string} repeat - Define how the pattern should be repeated
|
|
129
|
+
* @returns {TextureAtlas}
|
|
130
|
+
* @see ImageLayer#repeat
|
|
131
|
+
* @example
|
|
132
|
+
* var tileable = renderer.createPattern(image, "repeat");
|
|
133
|
+
* var horizontal = renderer.createPattern(image, "repeat-x");
|
|
134
|
+
* var vertical = renderer.createPattern(image, "repeat-y");
|
|
135
|
+
* var basic = renderer.createPattern(image, "no-repeat");
|
|
136
|
+
*/
|
|
137
|
+
createPattern(image: new (width?: number | undefined, height?: number | undefined) => HTMLImageElement, repeat: string): TextureAtlas;
|
|
138
|
+
/**
|
|
139
|
+
* set/change the current projection matrix (WebGL only)
|
|
140
|
+
* @param {Matrix3d} matrix
|
|
141
|
+
*/
|
|
142
|
+
setProjection(matrix: Matrix3d): void;
|
|
143
|
+
/**
|
|
144
|
+
* Clears the gl context with the given color.
|
|
145
|
+
* @param {Color|string} [color="#000000"] - CSS color.
|
|
146
|
+
* @param {boolean} [opaque=false] - Allow transparency [default] or clear the surface completely [true]
|
|
147
|
+
*/
|
|
148
|
+
clearColor(color?: string | Color | undefined, opaque?: boolean | undefined): void;
|
|
149
|
+
/**
|
|
150
|
+
* Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
|
|
151
|
+
* @param {number} x - x axis of the coordinate for the rectangle starting point.
|
|
152
|
+
* @param {number} y - y axis of the coordinate for the rectangle starting point.
|
|
153
|
+
* @param {number} width - The rectangle's width.
|
|
154
|
+
* @param {number} height - The rectangle's height.
|
|
155
|
+
*/
|
|
156
|
+
clearRect(x: number, y: number, width: number, height: number): void;
|
|
157
|
+
/**
|
|
158
|
+
* @ignore
|
|
159
|
+
*/
|
|
160
|
+
drawFont(bounds: any): void;
|
|
161
|
+
/**
|
|
162
|
+
* Draw an image to the gl context
|
|
163
|
+
* @param {Image} image - An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
|
|
164
|
+
* @param {number} sx - The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
165
|
+
* @param {number} sy - The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
166
|
+
* @param {number} sw - The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
|
|
167
|
+
* @param {number} sh - The height of the sub-rectangle of the source image to draw into the destination context.
|
|
168
|
+
* @param {number} dx - The X coordinate in the destination canvas at which to place the top-left corner of the source image.
|
|
169
|
+
* @param {number} dy - The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
|
|
170
|
+
* @param {number} dw - The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.
|
|
171
|
+
* @param {number} dh - The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.
|
|
172
|
+
* @example
|
|
173
|
+
* // Position the image on the canvas:
|
|
174
|
+
* renderer.drawImage(image, dx, dy);
|
|
175
|
+
* // Position the image on the canvas, and specify width and height of the image:
|
|
176
|
+
* renderer.drawImage(image, dx, dy, dWidth, dHeight);
|
|
177
|
+
* // Clip the image and position the clipped part on the canvas:
|
|
178
|
+
* renderer.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
|
|
179
|
+
*/
|
|
180
|
+
drawImage(image: new (width?: number | undefined, height?: number | undefined) => HTMLImageElement, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
|
|
181
|
+
/**
|
|
182
|
+
* Draw a pattern within the given rectangle.
|
|
183
|
+
* @param {TextureAtlas} pattern - Pattern object
|
|
184
|
+
* @param {number} x
|
|
185
|
+
* @param {number} y
|
|
186
|
+
* @param {number} width
|
|
187
|
+
* @param {number} height
|
|
188
|
+
* @see WebGLRenderer#createPattern
|
|
189
|
+
*/
|
|
190
|
+
drawPattern(pattern: TextureAtlas, x: number, y: number, width: number, height: number): void;
|
|
191
|
+
/**
|
|
192
|
+
* Returns the WebGL Context object of the given canvas element
|
|
193
|
+
* @param {HTMLCanvasElement} canvas
|
|
194
|
+
* @param {boolean} [transparent=false] - use true to enable transparency
|
|
195
|
+
* @returns {WebGLRenderingContext}
|
|
196
|
+
*/
|
|
197
|
+
getContextGL(canvas: HTMLCanvasElement, transparent?: boolean | undefined): WebGLRenderingContext;
|
|
198
|
+
/**
|
|
199
|
+
* Returns the WebGLContext instance for the renderer
|
|
200
|
+
* return a reference to the system 2d Context
|
|
201
|
+
* @returns {WebGLRenderingContext}
|
|
202
|
+
*/
|
|
203
|
+
getContext(): WebGLRenderingContext;
|
|
204
|
+
/**
|
|
205
|
+
* set a blend mode for the given context. <br>
|
|
206
|
+
* Supported blend mode between Canvas and WebGL remderer : <br>
|
|
207
|
+
* - "normal" : this is the default mode and draws new content on top of the existing content <br>
|
|
208
|
+
* <img src="images/normal-blendmode.png" width="510"/> <br>
|
|
209
|
+
* - "multiply" : the pixels of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. <br>
|
|
210
|
+
* <img src="images/multiply-blendmode.png" width="510"/> <br>
|
|
211
|
+
* - "additive or lighter" : where both content overlap the color is determined by adding color values. <br>
|
|
212
|
+
* <img src="images/lighter-blendmode.png" width="510"/> <br>
|
|
213
|
+
* - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
|
|
214
|
+
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
215
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
216
|
+
* @param {string} [mode="normal"] - blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
217
|
+
* @param {WebGLRenderingContext} [gl]
|
|
218
|
+
*/
|
|
219
|
+
setBlendMode(mode?: string | undefined, gl?: WebGLRenderingContext | undefined): void;
|
|
220
|
+
currentBlendMode: any;
|
|
221
|
+
/**
|
|
222
|
+
* return a reference to the font 2d Context
|
|
223
|
+
* @ignore
|
|
224
|
+
*/
|
|
225
|
+
getFontContext(): CanvasRenderingContext2D | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* restores the canvas context
|
|
228
|
+
*/
|
|
229
|
+
restore(): void;
|
|
230
|
+
/**
|
|
231
|
+
* saves the canvas context
|
|
232
|
+
*/
|
|
233
|
+
save(): void;
|
|
234
|
+
/**
|
|
235
|
+
* rotates the uniform matrix
|
|
236
|
+
* @param {number} angle - in radians
|
|
237
|
+
*/
|
|
238
|
+
rotate(angle: number): void;
|
|
239
|
+
/**
|
|
240
|
+
* scales the uniform matrix
|
|
241
|
+
* @param {number} x
|
|
242
|
+
* @param {number} y
|
|
243
|
+
*/
|
|
244
|
+
scale(x: number, y: number): void;
|
|
245
|
+
/**
|
|
246
|
+
* not used by this renderer?
|
|
247
|
+
* @ignore
|
|
248
|
+
*/
|
|
249
|
+
setAntiAlias(context: any, enable: any): void;
|
|
250
|
+
/**
|
|
251
|
+
* Set the global alpha
|
|
252
|
+
* @param {number} alpha - 0.0 to 1.0 values accepted.
|
|
253
|
+
*/
|
|
254
|
+
setGlobalAlpha(alpha: number): void;
|
|
255
|
+
/**
|
|
256
|
+
* Return the global alpha
|
|
257
|
+
* @returns {number} global alpha value
|
|
258
|
+
*/
|
|
259
|
+
getGlobalAlpha(): number;
|
|
260
|
+
/**
|
|
261
|
+
* Set the current fill & stroke style color.
|
|
262
|
+
* By default, or upon reset, the value is set to #000000.
|
|
263
|
+
* @param {Color|string} color - css color string.
|
|
264
|
+
*/
|
|
265
|
+
setColor(color: Color | string): void;
|
|
266
|
+
/**
|
|
267
|
+
* Set the line width
|
|
268
|
+
* @param {number} width - Line width
|
|
269
|
+
*/
|
|
270
|
+
setLineWidth(width: number): void;
|
|
271
|
+
/**
|
|
272
|
+
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
273
|
+
* @param {number} x - arc center point x-axis
|
|
274
|
+
* @param {number} y - arc center point y-axis
|
|
275
|
+
* @param {number} radius
|
|
276
|
+
* @param {number} start - start angle in radians
|
|
277
|
+
* @param {number} end - end angle in radians
|
|
278
|
+
* @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
|
|
279
|
+
* @param {boolean} [fill=false]
|
|
280
|
+
*/
|
|
281
|
+
strokeArc(x: number, y: number, radius: number, start: number, end: number, antiClockwise?: boolean | undefined, fill?: boolean | undefined): void;
|
|
282
|
+
/**
|
|
283
|
+
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
284
|
+
* @param {number} x - arc center point x-axis
|
|
285
|
+
* @param {number} y - arc center point y-axis
|
|
286
|
+
* @param {number} radius
|
|
287
|
+
* @param {number} start - start angle in radians
|
|
288
|
+
* @param {number} end - end angle in radians
|
|
289
|
+
* @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
|
|
290
|
+
*/
|
|
291
|
+
fillArc(x: number, y: number, radius: number, start: number, end: number, antiClockwise?: boolean | undefined): void;
|
|
292
|
+
/**
|
|
293
|
+
* Stroke an ellipse at the specified coordinates with given radius
|
|
294
|
+
* @param {number} x - ellipse center point x-axis
|
|
295
|
+
* @param {number} y - ellipse center point y-axis
|
|
296
|
+
* @param {number} w - horizontal radius of the ellipse
|
|
297
|
+
* @param {number} h - vertical radius of the ellipse
|
|
298
|
+
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
299
|
+
*/
|
|
300
|
+
strokeEllipse(x: number, y: number, w: number, h: number, fill?: boolean | undefined): void;
|
|
301
|
+
/**
|
|
302
|
+
* Fill an ellipse at the specified coordinates with given radius
|
|
303
|
+
* @param {number} x - ellipse center point x-axis
|
|
304
|
+
* @param {number} y - ellipse center point y-axis
|
|
305
|
+
* @param {number} w - horizontal radius of the ellipse
|
|
306
|
+
* @param {number} h - vertical radius of the ellipse
|
|
307
|
+
*/
|
|
308
|
+
fillEllipse(x: number, y: number, w: number, h: number): void;
|
|
309
|
+
/**
|
|
310
|
+
* Stroke a line of the given two points
|
|
311
|
+
* @param {number} startX - the start x coordinate
|
|
312
|
+
* @param {number} startY - the start y coordinate
|
|
313
|
+
* @param {number} endX - the end x coordinate
|
|
314
|
+
* @param {number} endY - the end y coordinate
|
|
315
|
+
*/
|
|
316
|
+
strokeLine(startX: number, startY: number, endX: number, endY: number): void;
|
|
317
|
+
/**
|
|
318
|
+
* Fill a line of the given two points
|
|
319
|
+
* @param {number} startX - the start x coordinate
|
|
320
|
+
* @param {number} startY - the start y coordinate
|
|
321
|
+
* @param {number} endX - the end x coordinate
|
|
322
|
+
* @param {number} endY - the end y coordinate
|
|
323
|
+
*/
|
|
324
|
+
fillLine(startX: number, startY: number, endX: number, endY: number): void;
|
|
325
|
+
/**
|
|
326
|
+
* Stroke a me.Polygon on the screen with a specified color
|
|
327
|
+
* @param {Polygon} poly - the shape to draw
|
|
328
|
+
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
329
|
+
*/
|
|
330
|
+
strokePolygon(poly: Polygon, fill?: boolean | undefined): void;
|
|
331
|
+
/**
|
|
332
|
+
* Fill a me.Polygon on the screen
|
|
333
|
+
* @param {Polygon} poly - the shape to draw
|
|
334
|
+
*/
|
|
335
|
+
fillPolygon(poly: Polygon): void;
|
|
336
|
+
/**
|
|
337
|
+
* Draw a stroke rectangle at the specified coordinates
|
|
338
|
+
* @param {number} x
|
|
339
|
+
* @param {number} y
|
|
340
|
+
* @param {number} width
|
|
341
|
+
* @param {number} height
|
|
342
|
+
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
343
|
+
*/
|
|
344
|
+
strokeRect(x: number, y: number, width: number, height: number, fill?: boolean | undefined): void;
|
|
345
|
+
/**
|
|
346
|
+
* Draw a filled rectangle at the specified coordinates
|
|
347
|
+
* @param {number} x
|
|
348
|
+
* @param {number} y
|
|
349
|
+
* @param {number} width
|
|
350
|
+
* @param {number} height
|
|
351
|
+
*/
|
|
352
|
+
fillRect(x: number, y: number, width: number, height: number): void;
|
|
353
|
+
/**
|
|
354
|
+
* Stroke a rounded rectangle at the specified coordinates
|
|
355
|
+
* @param {number} x
|
|
356
|
+
* @param {number} y
|
|
357
|
+
* @param {number} width
|
|
358
|
+
* @param {number} height
|
|
359
|
+
* @param {number} radius
|
|
360
|
+
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
361
|
+
*/
|
|
362
|
+
strokeRoundRect(x: number, y: number, width: number, height: number, radius: number, fill?: boolean | undefined): void;
|
|
363
|
+
/**
|
|
364
|
+
* Draw a rounded filled rectangle at the specified coordinates
|
|
365
|
+
* @param {number} x
|
|
366
|
+
* @param {number} y
|
|
367
|
+
* @param {number} width
|
|
368
|
+
* @param {number} height
|
|
369
|
+
* @param {number} radius
|
|
370
|
+
*/
|
|
371
|
+
fillRoundRect(x: number, y: number, width: number, height: number, radius: number): void;
|
|
372
|
+
/**
|
|
373
|
+
* Stroke a Point at the specified coordinates
|
|
374
|
+
* @param {number} x
|
|
375
|
+
* @param {number} y
|
|
376
|
+
*/
|
|
377
|
+
strokePoint(x: number, y: number): void;
|
|
378
|
+
/**
|
|
379
|
+
* Draw a a point at the specified coordinates
|
|
380
|
+
* @param {number} x
|
|
381
|
+
* @param {number} y
|
|
382
|
+
* @param {number} width
|
|
383
|
+
* @param {number} height
|
|
384
|
+
*/
|
|
385
|
+
fillPoint(x: number, y: number): void;
|
|
386
|
+
/**
|
|
387
|
+
* Reset (overrides) the renderer transformation matrix to the
|
|
388
|
+
* identity one, and then apply the given transformation matrix.
|
|
389
|
+
* @param {Matrix2d} mat2d - Matrix to transform by
|
|
390
|
+
*/
|
|
391
|
+
setTransform(mat2d: Matrix2d): void;
|
|
392
|
+
/**
|
|
393
|
+
* Multiply given matrix into the renderer tranformation matrix
|
|
394
|
+
* @param {Matrix2d} mat2d - Matrix to transform by
|
|
395
|
+
*/
|
|
396
|
+
transform(mat2d: Matrix2d): void;
|
|
397
|
+
/**
|
|
398
|
+
* Translates the uniform matrix by the given coordinates
|
|
399
|
+
* @param {number} x
|
|
400
|
+
* @param {number} y
|
|
401
|
+
*/
|
|
402
|
+
translate(x: number, y: number): void;
|
|
403
|
+
/**
|
|
404
|
+
* clip the given region from the original canvas. Once a region is clipped,
|
|
405
|
+
* all future drawing will be limited to the clipped region.
|
|
406
|
+
* You can however save the current region using the save(),
|
|
407
|
+
* and restore it (with the restore() method) any time in the future.
|
|
408
|
+
* (<u>this is an experimental feature !</u>)
|
|
409
|
+
* @param {number} x
|
|
410
|
+
* @param {number} y
|
|
411
|
+
* @param {number} width
|
|
412
|
+
* @param {number} height
|
|
413
|
+
*/
|
|
414
|
+
clipRect(x: number, y: number, width: number, height: number): void;
|
|
415
|
+
/**
|
|
416
|
+
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
417
|
+
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
418
|
+
* Mask are not preserved through renderer context save and restore.
|
|
419
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] - a shape defining the mask to be applied
|
|
420
|
+
* @param {boolean} [invert=false] - either the given shape should define what is visible (default) or the opposite
|
|
421
|
+
*/
|
|
422
|
+
setMask(mask?: Rect | RoundRect | Polygon | Line | Ellipse, invert?: boolean | undefined): void;
|
|
423
|
+
}
|
|
424
|
+
import Renderer from "./../renderer.js";
|
|
425
|
+
import Matrix2d from "./../../math/matrix2.js";
|
|
426
|
+
import WebGLCompositor from "./webgl_compositor.js";
|
|
427
|
+
import TextureCache from "./../texture/cache.js";
|
|
428
|
+
import { TextureAtlas } from "./../texture/atlas.js";
|
|
429
|
+
import Color from "./../../math/color.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "melonjs",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"description": "melonJS Game Engine",
|
|
5
5
|
"homepage": "http://www.melonjs.org/",
|
|
6
6
|
"type": "module",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"files": [
|
|
45
45
|
"dist/melonjs.mjs",
|
|
46
46
|
"dist/melonjs.module.js",
|
|
47
|
-
"dist/types
|
|
47
|
+
"dist/types",
|
|
48
48
|
"src/",
|
|
49
49
|
"package.json",
|
|
50
50
|
"README.md",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@teppeis/multimaps": "^2.0.0",
|
|
56
|
-
"core-js": "^3.
|
|
56
|
+
"core-js": "^3.27.1",
|
|
57
57
|
"earcut": "2.2.4",
|
|
58
58
|
"eventemitter3": "^5.0.0",
|
|
59
59
|
"howler": "2.2.3"
|
|
@@ -61,30 +61,30 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@babel/eslint-parser": "^7.19.1",
|
|
63
63
|
"@babel/plugin-syntax-import-assertions": "^7.20.0",
|
|
64
|
-
"@fastify/static": "^6.
|
|
64
|
+
"@fastify/static": "^6.6.0",
|
|
65
65
|
"@melonjs/webdoc-theme": "^1.1.1",
|
|
66
|
-
"@rollup/plugin-commonjs": "^
|
|
66
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
|
67
67
|
"@rollup/plugin-image": "^3.0.1",
|
|
68
68
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
69
|
-
"@rollup/plugin-replace": "^5.0.
|
|
69
|
+
"@rollup/plugin-replace": "^5.0.2",
|
|
70
70
|
"@types/offscreencanvas": "^2019.7.0",
|
|
71
71
|
"@webdoc/cli": "^2.2.0",
|
|
72
|
-
"chromedriver": "^
|
|
72
|
+
"chromedriver": "^108.0.0",
|
|
73
73
|
"cross-env": "^7.0.3",
|
|
74
74
|
"del-cli": "^5.0.0",
|
|
75
|
-
"eslint": "^8.
|
|
75
|
+
"eslint": "^8.30.0",
|
|
76
76
|
"eslint-plugin-jsdoc": "^39.6.4",
|
|
77
77
|
"expect": "^29.3.1",
|
|
78
78
|
"expect-mocha-image-snapshot": "^2.0.14",
|
|
79
79
|
"fastify": "^4.10.2",
|
|
80
|
-
"mocha": "^10.
|
|
80
|
+
"mocha": "^10.2.0",
|
|
81
81
|
"npm-self-link": "^1.1.7",
|
|
82
|
-
"puppeteer": "^19.
|
|
83
|
-
"rollup": "^3.
|
|
82
|
+
"puppeteer": "^19.4.1",
|
|
83
|
+
"rollup": "^3.9.0",
|
|
84
84
|
"rollup-plugin-bundle-size": "^1.0.3",
|
|
85
85
|
"rollup-plugin-string": "^3.0.0",
|
|
86
|
-
"terser": "^5.16.
|
|
87
|
-
"typescript": "^4.9.
|
|
86
|
+
"terser": "^5.16.1",
|
|
87
|
+
"typescript": "^4.9.4"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"build": "npm run lint && rollup -c --silent",
|
|
@@ -99,6 +99,6 @@
|
|
|
99
99
|
"serve": "python3 -m http.server",
|
|
100
100
|
"prepublishOnly": "npm run dist && npm run test",
|
|
101
101
|
"clean": "del-cli --force build/*.* dist/*.* docs",
|
|
102
|
-
"types": "tsc
|
|
102
|
+
"types": "tsc"
|
|
103
103
|
}
|
|
104
104
|
}
|