melonjs 14.2.0 → 14.4.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/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +2 -2
- package/dist/melonjs.mjs/_virtual/arraymultimap.js +2 -2
- package/dist/melonjs.mjs/_virtual/earcut.js +2 -2
- package/dist/melonjs.mjs/_virtual/howler.js +2 -2
- package/dist/melonjs.mjs/_virtual/index.js +2 -2
- package/dist/melonjs.mjs/_virtual/index2.js +2 -2
- package/dist/melonjs.mjs/_virtual/multimap.js +2 -2
- package/dist/melonjs.mjs/_virtual/setmultimap.js +2 -2
- package/dist/melonjs.mjs/application/application.js +141 -10
- package/dist/melonjs.mjs/application/header.js +34 -0
- package/dist/melonjs.mjs/application/resize.js +4 -2
- package/dist/melonjs.mjs/application/settings.js +28 -0
- package/dist/melonjs.mjs/audio/audio.js +2 -2
- package/dist/melonjs.mjs/camera/camera2d.js +3 -3
- package/dist/melonjs.mjs/const.js +32 -0
- package/dist/melonjs.mjs/entity/entity.js +2 -2
- package/dist/melonjs.mjs/game.js +1 -1
- package/dist/melonjs.mjs/geometries/ellipse.js +2 -2
- package/dist/melonjs.mjs/geometries/line.js +2 -2
- package/dist/melonjs.mjs/geometries/path2d.js +2 -2
- package/dist/melonjs.mjs/geometries/point.js +2 -2
- package/dist/melonjs.mjs/geometries/poly.js +2 -2
- package/dist/melonjs.mjs/geometries/rectangle.js +2 -2
- package/dist/melonjs.mjs/geometries/roundrect.js +2 -2
- package/dist/melonjs.mjs/index.js +44 -33
- package/dist/melonjs.mjs/input/gamepad.js +2 -2
- package/dist/melonjs.mjs/input/input.js +2 -2
- package/dist/melonjs.mjs/input/keyboard.js +2 -2
- package/dist/melonjs.mjs/input/pointer.js +3 -3
- package/dist/melonjs.mjs/input/pointerevent.js +3 -3
- package/dist/melonjs.mjs/lang/console.js +44 -0
- package/dist/melonjs.mjs/lang/deprecated.js +4 -40
- package/dist/melonjs.mjs/level/level.js +3 -3
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +2 -23
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +68 -58
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +2 -64
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +10 -26
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +18 -84
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +2 -16
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +3 -10
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +37 -14
- package/dist/melonjs.mjs/level/tiled/constants.js +17 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +7 -8
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +3 -6
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -14
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +38 -0
- package/dist/melonjs.mjs/loader/loader.js +5 -3
- package/dist/melonjs.mjs/loader/loadingscreen.js +3 -3
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +2 -2
- package/dist/melonjs.mjs/math/color.js +2 -2
- package/dist/melonjs.mjs/math/math.js +2 -2
- package/dist/melonjs.mjs/math/matrix2.js +2 -2
- package/dist/melonjs.mjs/math/matrix3.js +2 -2
- package/dist/melonjs.mjs/math/observable_vector2.js +2 -2
- package/dist/melonjs.mjs/math/observable_vector3.js +2 -2
- package/dist/melonjs.mjs/math/vector2.js +2 -2
- package/dist/melonjs.mjs/math/vector3.js +2 -2
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +2 -2
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +2 -2
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +2 -2
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +2 -2
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +2 -2
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +2 -2
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +2 -2
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +2 -2
- package/dist/melonjs.mjs/particles/emitter.js +2 -2
- package/dist/melonjs.mjs/particles/particle.js +2 -2
- package/dist/melonjs.mjs/particles/settings.js +2 -2
- package/dist/melonjs.mjs/physics/body.js +2 -2
- package/dist/melonjs.mjs/physics/bounds.js +2 -2
- package/dist/melonjs.mjs/physics/collision.js +4 -4
- package/dist/melonjs.mjs/physics/detector.js +175 -147
- package/dist/melonjs.mjs/physics/quadtree.js +2 -2
- package/dist/melonjs.mjs/physics/response.js +2 -2
- package/dist/melonjs.mjs/physics/sat.js +2 -2
- package/dist/melonjs.mjs/physics/world.js +11 -31
- package/dist/melonjs.mjs/plugin/plugin.js +4 -4
- package/dist/melonjs.mjs/renderable/collectable.js +2 -2
- package/dist/melonjs.mjs/renderable/colorlayer.js +2 -2
- package/dist/melonjs.mjs/renderable/container.js +4 -88
- package/dist/melonjs.mjs/renderable/dragndrop.js +2 -2
- package/dist/melonjs.mjs/renderable/imagelayer.js +3 -3
- package/dist/melonjs.mjs/renderable/light2d.js +2 -2
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +2 -2
- package/dist/melonjs.mjs/renderable/renderable.js +2 -2
- package/dist/melonjs.mjs/renderable/sprite.js +2 -2
- package/dist/melonjs.mjs/renderable/trigger.js +3 -3
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +2 -2
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +2 -2
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +2 -2
- package/dist/melonjs.mjs/state/stage.js +3 -3
- package/dist/melonjs.mjs/state/state.js +3 -3
- package/dist/melonjs.mjs/system/device.js +3 -23
- package/dist/melonjs.mjs/system/dom.js +2 -2
- package/dist/melonjs.mjs/system/event.js +2 -2
- package/dist/melonjs.mjs/system/platform.js +2 -2
- package/dist/melonjs.mjs/system/pooling.js +2 -2
- package/dist/melonjs.mjs/system/save.js +2 -2
- package/dist/melonjs.mjs/system/timer.js +2 -2
- package/dist/melonjs.mjs/text/bitmaptext.js +2 -2
- package/dist/melonjs.mjs/text/bitmaptextdata.js +2 -2
- package/dist/melonjs.mjs/text/glyph.js +2 -2
- package/dist/melonjs.mjs/text/text.js +2 -2
- package/dist/melonjs.mjs/text/textmetrics.js +2 -2
- package/dist/melonjs.mjs/text/textstyle.js +2 -2
- package/dist/melonjs.mjs/tweens/easing.js +2 -2
- package/dist/melonjs.mjs/tweens/interpolation.js +2 -2
- package/dist/melonjs.mjs/tweens/tween.js +3 -3
- package/dist/melonjs.mjs/utils/agent.js +2 -2
- package/dist/melonjs.mjs/utils/array.js +2 -2
- package/dist/melonjs.mjs/utils/file.js +2 -2
- package/dist/melonjs.mjs/utils/function.js +2 -2
- package/dist/melonjs.mjs/utils/string.js +2 -2
- package/dist/melonjs.mjs/utils/utils.js +2 -2
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +5 -2
- package/dist/melonjs.mjs/video/renderer.js +9 -2
- package/dist/melonjs.mjs/video/texture/atlas.js +2 -2
- package/dist/melonjs.mjs/video/texture/cache.js +2 -2
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +4 -3
- package/dist/melonjs.mjs/video/utils/autodetect.js +27 -0
- package/dist/melonjs.mjs/video/utils/resize.js +1 -1
- package/dist/melonjs.mjs/video/video.js +29 -158
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +2 -2
- package/dist/melonjs.mjs/video/webgl/glshader.js +3 -4
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +2 -2
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +2 -2
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +2 -2
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +2 -2
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +2 -2
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +21 -3
- package/dist/melonjs.mjs/video/webgl/utils/program.js +2 -2
- package/dist/melonjs.mjs/video/webgl/utils/string.js +2 -2
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +2 -2
- package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +2 -2
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +5 -2
- package/dist/melonjs.module.js +20845 -20968
- package/dist/types/application/application.d.ts +148 -0
- package/dist/types/application/header.d.ts +5 -0
- package/dist/types/application/resize.d.ts +6 -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/const.d.ts +21 -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 +4 -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/console.d.ts +7 -0
- package/dist/types/lang/deprecated.d.ts +45 -0
- package/dist/types/level/level.d.ts +134 -0
- package/dist/types/level/tiled/TMXGroup.d.ts +61 -0
- package/dist/types/level/tiled/TMXLayer.d.ts +158 -0
- package/dist/types/level/tiled/TMXObject.d.ts +133 -0
- package/dist/types/level/tiled/TMXTile.d.ts +64 -0
- package/dist/types/level/tiled/TMXTileMap.d.ts +142 -0
- package/dist/types/level/tiled/TMXTileset.d.ts +80 -0
- package/dist/types/level/tiled/TMXTilesetGroup.d.ts +26 -0
- package/dist/types/level/tiled/TMXUtils.d.ts +47 -0
- package/dist/types/level/tiled/constants.d.ts +5 -0
- package/dist/types/level/tiled/renderer/TMXHexagonalRenderer.d.ts +83 -0
- package/dist/types/level/tiled/renderer/TMXIsometricRenderer.d.ts +51 -0
- package/dist/types/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +43 -0
- package/dist/types/level/tiled/renderer/TMXRenderer.d.ts +63 -0
- package/dist/types/level/tiled/renderer/TMXStaggeredRenderer.d.ts +8 -0
- package/dist/types/level/tiled/renderer/autodetect.d.ts +9 -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 +93 -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 +8 -8
- package/src/application/application.js +138 -7
- package/src/application/header.js +25 -0
- package/src/{video/utils → application}/resize.js +11 -6
- package/src/application/settings.js +19 -0
- package/src/camera/camera2d.js +1 -1
- package/src/const.js +23 -0
- package/src/index.js +36 -23
- package/src/input/pointer.js +1 -1
- package/src/input/pointerevent.js +1 -1
- package/src/lang/console.js +36 -0
- package/src/lang/deprecated.js +2 -37
- package/src/level/level.js +1 -1
- package/src/level/tiled/TMXGroup.js +0 -21
- package/src/level/tiled/TMXLayer.js +66 -56
- package/src/level/tiled/TMXObject.js +0 -62
- package/src/level/tiled/TMXTile.js +8 -24
- package/src/level/tiled/TMXTileMap.js +17 -83
- package/src/level/tiled/TMXTileset.js +0 -14
- package/src/level/tiled/TMXTilesetGroup.js +1 -9
- package/src/level/tiled/TMXUtils.js +38 -15
- package/src/level/tiled/constants.js +8 -0
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +5 -6
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -4
- package/src/level/tiled/renderer/TMXRenderer.js +0 -12
- package/src/level/tiled/renderer/autodetect.js +29 -0
- package/src/loader/loader.js +3 -1
- 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/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 +0 -20
- package/src/tweens/tween.js +1 -1
- package/src/video/canvas/canvas_renderer.js +3 -0
- package/src/video/renderer.js +7 -0
- package/src/video/texture/canvas_texture.js +2 -1
- package/src/video/utils/autodetect.js +18 -0
- package/src/video/video.js +26 -155
- 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
- package/dist/melonjs.mjs/node_modules/core-js/es/string/trim-end.js +0 -13
- package/dist/melonjs.mjs/node_modules/core-js/es/string/trim-start.js +0 -13
- package/dist/melonjs.mjs/node_modules/core-js/internals/a-callable.js +0 -22
- package/dist/melonjs.mjs/node_modules/core-js/internals/an-object.js +0 -21
- package/dist/melonjs.mjs/node_modules/core-js/internals/array-includes.js +0 -45
- package/dist/melonjs.mjs/node_modules/core-js/internals/classof-raw.js +0 -19
- package/dist/melonjs.mjs/node_modules/core-js/internals/classof.js +0 -43
- package/dist/melonjs.mjs/node_modules/core-js/internals/copy-constructor-properties.js +0 -32
- package/dist/melonjs.mjs/node_modules/core-js/internals/create-non-enumerable-property.js +0 -24
- package/dist/melonjs.mjs/node_modules/core-js/internals/create-property-descriptor.js +0 -17
- package/dist/melonjs.mjs/node_modules/core-js/internals/define-built-in.js +0 -43
- package/dist/melonjs.mjs/node_modules/core-js/internals/define-global-property.js +0 -23
- package/dist/melonjs.mjs/node_modules/core-js/internals/descriptors.js +0 -18
- package/dist/melonjs.mjs/node_modules/core-js/internals/document-all.js +0 -18
- package/dist/melonjs.mjs/node_modules/core-js/internals/document-create-element.js +0 -22
- package/dist/melonjs.mjs/node_modules/core-js/internals/engine-user-agent.js +0 -14
- package/dist/melonjs.mjs/node_modules/core-js/internals/engine-v8-version.js +0 -39
- package/dist/melonjs.mjs/node_modules/core-js/internals/entry-unbind.js +0 -18
- package/dist/melonjs.mjs/node_modules/core-js/internals/enum-bug-keys.js +0 -19
- package/dist/melonjs.mjs/node_modules/core-js/internals/export.js +0 -72
- package/dist/melonjs.mjs/node_modules/core-js/internals/fails.js +0 -16
- package/dist/melonjs.mjs/node_modules/core-js/internals/function-bind-native.js +0 -19
- package/dist/melonjs.mjs/node_modules/core-js/internals/function-call.js +0 -18
- package/dist/melonjs.mjs/node_modules/core-js/internals/function-name.js +0 -29
- package/dist/melonjs.mjs/node_modules/core-js/internals/function-uncurry-this.js +0 -22
- package/dist/melonjs.mjs/node_modules/core-js/internals/get-built-in.js +0 -22
- package/dist/melonjs.mjs/node_modules/core-js/internals/get-method.js +0 -21
- package/dist/melonjs.mjs/node_modules/core-js/internals/global.js +0 -25
- package/dist/melonjs.mjs/node_modules/core-js/internals/has-own-property.js +0 -23
- package/dist/melonjs.mjs/node_modules/core-js/internals/hidden-keys.js +0 -10
- package/dist/melonjs.mjs/node_modules/core-js/internals/ie8-dom-define.js +0 -24
- package/dist/melonjs.mjs/node_modules/core-js/internals/indexed-object.js +0 -28
- package/dist/melonjs.mjs/node_modules/core-js/internals/inspect-source.js +0 -27
- package/dist/melonjs.mjs/node_modules/core-js/internals/internal-state.js +0 -88
- package/dist/melonjs.mjs/node_modules/core-js/internals/is-callable.js +0 -22
- package/dist/melonjs.mjs/node_modules/core-js/internals/is-forced.js +0 -34
- package/dist/melonjs.mjs/node_modules/core-js/internals/is-null-or-undefined.js +0 -14
- package/dist/melonjs.mjs/node_modules/core-js/internals/is-object.js +0 -22
- package/dist/melonjs.mjs/node_modules/core-js/internals/is-symbol.js +0 -27
- package/dist/melonjs.mjs/node_modules/core-js/internals/length-of-array-like.js +0 -18
- package/dist/melonjs.mjs/node_modules/core-js/internals/make-built-in.js +0 -68
- package/dist/melonjs.mjs/node_modules/core-js/internals/math-trunc.js +0 -19
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-define-property.js +0 -58
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-descriptor.js +0 -41
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-names.js +0 -23
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-get-own-property-symbols.js +0 -12
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-is-prototype-of.js +0 -14
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-keys-internal.js +0 -35
- package/dist/melonjs.mjs/node_modules/core-js/internals/object-property-is-enumerable.js +0 -23
- package/dist/melonjs.mjs/node_modules/core-js/internals/ordinary-to-primitive.js +0 -28
- package/dist/melonjs.mjs/node_modules/core-js/internals/own-keys.js +0 -31
- package/dist/melonjs.mjs/node_modules/core-js/internals/require-object-coercible.js +0 -21
- package/dist/melonjs.mjs/node_modules/core-js/internals/shared-key.js +0 -21
- package/dist/melonjs.mjs/node_modules/core-js/internals/shared-store.js +0 -19
- package/dist/melonjs.mjs/node_modules/core-js/internals/shared.js +0 -24
- package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-end.js +0 -22
- package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-forced.js +0 -28
- package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim-start.js +0 -22
- package/dist/melonjs.mjs/node_modules/core-js/internals/string-trim.js +0 -45
- package/dist/melonjs.mjs/node_modules/core-js/internals/symbol-constructor-detection.js +0 -26
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-absolute-index.js +0 -23
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-indexed-object.js +0 -19
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-integer-or-infinity.js +0 -20
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-length.js +0 -20
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-object.js +0 -20
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-primitive.js +0 -41
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-property-key.js +0 -21
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-string-tag-support.js +0 -19
- package/dist/melonjs.mjs/node_modules/core-js/internals/to-string.js +0 -19
- package/dist/melonjs.mjs/node_modules/core-js/internals/try-to-string.js +0 -18
- package/dist/melonjs.mjs/node_modules/core-js/internals/uid.js +0 -20
- package/dist/melonjs.mjs/node_modules/core-js/internals/use-symbol-as-uid.js +0 -18
- package/dist/melonjs.mjs/node_modules/core-js/internals/v8-prototype-define-bug.js +0 -24
- package/dist/melonjs.mjs/node_modules/core-js/internals/weak-map-basic-detection.js +0 -18
- package/dist/melonjs.mjs/node_modules/core-js/internals/well-known-symbol.js +0 -41
- package/dist/melonjs.mjs/node_modules/core-js/internals/whitespaces.js +0 -12
- package/dist/melonjs.mjs/node_modules/core-js/modules/es.global-this.js +0 -18
- package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-end.js +0 -22
- package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-left.js +0 -19
- package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-right.js +0 -19
- package/dist/melonjs.mjs/node_modules/core-js/modules/es.string.trim-start.js +0 -22
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.mjs.js +0 -9
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @classdesc
|
|
3
|
+
* a simplified path2d implementation, supporting only one path
|
|
4
|
+
*/
|
|
5
|
+
export default class Path2D {
|
|
6
|
+
/**
|
|
7
|
+
* the points defining the current path
|
|
8
|
+
* @public
|
|
9
|
+
* @type {Vector2d[]}
|
|
10
|
+
* @name points
|
|
11
|
+
* @memberof Path2D#
|
|
12
|
+
*/
|
|
13
|
+
public points: Vector2d[];
|
|
14
|
+
/**
|
|
15
|
+
* space between interpolated points for quadratic and bezier curve approx. in pixels.
|
|
16
|
+
* @public
|
|
17
|
+
* @type {number}
|
|
18
|
+
* @name arcResolution
|
|
19
|
+
* @default 5
|
|
20
|
+
* @memberof Path2D#
|
|
21
|
+
*/
|
|
22
|
+
public arcResolution: number;
|
|
23
|
+
vertices: any[];
|
|
24
|
+
/**
|
|
25
|
+
* begin a new path
|
|
26
|
+
* @name beginPath
|
|
27
|
+
* @memberof Path2D
|
|
28
|
+
*/
|
|
29
|
+
beginPath(): void;
|
|
30
|
+
/**
|
|
31
|
+
* causes the point of the pen to move back to the start of the current path.
|
|
32
|
+
* It tries to draw a straight line from the current point to the start.
|
|
33
|
+
* If the shape has already been closed or has only one point, this function does nothing.
|
|
34
|
+
* @name closePath
|
|
35
|
+
* @memberof Path2D
|
|
36
|
+
*/
|
|
37
|
+
closePath(): void;
|
|
38
|
+
/**
|
|
39
|
+
* triangulate the shape defined by this path into an array of triangles
|
|
40
|
+
* @name triangulatePath
|
|
41
|
+
* @memberof Path2D
|
|
42
|
+
* @returns {Vector2d[]}
|
|
43
|
+
*/
|
|
44
|
+
triangulatePath(): Vector2d[];
|
|
45
|
+
/**
|
|
46
|
+
* moves the starting point of the current path to the (x, y) coordinates.
|
|
47
|
+
* @name moveTo
|
|
48
|
+
* @memberof Path2D
|
|
49
|
+
* @param {number} x - the x-axis (horizontal) coordinate of the point.
|
|
50
|
+
* @param {number} y - the y-axis (vertical) coordinate of the point.
|
|
51
|
+
*/
|
|
52
|
+
moveTo(x: number, y: number): void;
|
|
53
|
+
/**
|
|
54
|
+
* connects the last point in the current patch to the (x, y) coordinates with a straight line.
|
|
55
|
+
* @name lineTo
|
|
56
|
+
* @memberof Path2D
|
|
57
|
+
* @param {number} x - the x-axis coordinate of the line's end point.
|
|
58
|
+
* @param {number} y - the y-axis coordinate of the line's end point.
|
|
59
|
+
*/
|
|
60
|
+
lineTo(x: number, y: number): void;
|
|
61
|
+
/**
|
|
62
|
+
* adds an arc to the current path which is centered at (x, y) position with the given radius,
|
|
63
|
+
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to clockwise).
|
|
64
|
+
* @name arc
|
|
65
|
+
* @memberof Path2D
|
|
66
|
+
* @param {number} x - the horizontal coordinate of the arc's center.
|
|
67
|
+
* @param {number} y - the vertical coordinate of the arc's center.
|
|
68
|
+
* @param {number} radius - the arc's radius. Must be positive.
|
|
69
|
+
* @param {number} startAngle - the angle at which the arc starts in radians, measured from the positive x-axis.
|
|
70
|
+
* @param {number} endAngle - the angle at which the arc ends in radians, measured from the positive x-axis.
|
|
71
|
+
* @param {boolean} [anticlockwise=false] - an optional boolean value. If true, draws the arc counter-clockwise between the start and end angles.
|
|
72
|
+
*/
|
|
73
|
+
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean | undefined): void;
|
|
74
|
+
/**
|
|
75
|
+
* adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
|
76
|
+
* @name arcTo
|
|
77
|
+
* @memberof Path2D
|
|
78
|
+
* @param {number} x1 - the x-axis coordinate of the first control point.
|
|
79
|
+
* @param {number} y1 - the y-axis coordinate of the first control point.
|
|
80
|
+
* @param {number} x2 - the x-axis coordinate of the second control point.
|
|
81
|
+
* @param {number} y2 - the y-axis coordinate of the second control point.
|
|
82
|
+
* @param {number} radius - the arc's radius. Must be positive.
|
|
83
|
+
*/
|
|
84
|
+
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
|
|
85
|
+
/**
|
|
86
|
+
* adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
|
|
87
|
+
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
|
|
88
|
+
* @name ellipse
|
|
89
|
+
* @memberof Path2D
|
|
90
|
+
* @param {number} x - the x-axis (horizontal) coordinate of the ellipse's center.
|
|
91
|
+
* @param {number} y - the y-axis (vertical) coordinate of the ellipse's center.
|
|
92
|
+
* @param {number} radiusX - the ellipse's major-axis radius. Must be non-negative.
|
|
93
|
+
* @param {number} radiusY - the ellipse's minor-axis radius. Must be non-negative.
|
|
94
|
+
* @param {number} rotation - the rotation of the ellipse, expressed in radians.
|
|
95
|
+
* @param {number} startAngle - the angle at which the ellipse starts, measured clockwise from the positive x-axis and expressed in radians.
|
|
96
|
+
* @param {number} endAngle - the angle at which the ellipse ends, measured clockwise from the positive x-axis and expressed in radians.
|
|
97
|
+
* @param {boolean} [anticlockwise=false] - an optional boolean value which, if true, draws the ellipse counterclockwise (anticlockwise).
|
|
98
|
+
*/
|
|
99
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean | undefined): void;
|
|
100
|
+
/**
|
|
101
|
+
* creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
|
|
102
|
+
* @name rect
|
|
103
|
+
* @memberof Path2D
|
|
104
|
+
* @param {number} x - the x-axis coordinate of the rectangle's starting point.
|
|
105
|
+
* @param {number} y - the y-axis coordinate of the rectangle's starting point.
|
|
106
|
+
* @param {number} width - the rectangle's width. Positive values are to the right, and negative to the left.
|
|
107
|
+
* @param {number} height - the rectangle's height. Positive values are down, and negative are up.
|
|
108
|
+
*/
|
|
109
|
+
rect(x: number, y: number, width: number, height: number): void;
|
|
110
|
+
/**
|
|
111
|
+
* adds an rounded rectangle to the current path.
|
|
112
|
+
* @name roundRect
|
|
113
|
+
* @memberof Path2D
|
|
114
|
+
* @param {number} x - the x-axis coordinate of the rectangle's starting point.
|
|
115
|
+
* @param {number} y - the y-axis coordinate of the rectangle's starting point.
|
|
116
|
+
* @param {number} width - the rectangle's width. Positive values are to the right, and negative to the left.
|
|
117
|
+
* @param {number} height - the rectangle's height. Positive values are down, and negative are up.
|
|
118
|
+
* @param {number} radius - the arc's radius to draw the borders. Must be positive.
|
|
119
|
+
*/
|
|
120
|
+
roundRect(x: number, y: number, width: number, height: number, radius: number): void;
|
|
121
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @classdesc
|
|
3
|
+
* represents a point in a 2d space
|
|
4
|
+
*/
|
|
5
|
+
export default class Point {
|
|
6
|
+
constructor(x?: number, y?: number);
|
|
7
|
+
/**
|
|
8
|
+
* the position of the point on the horizontal axis
|
|
9
|
+
* @public
|
|
10
|
+
* @type {Number}
|
|
11
|
+
* @default 0
|
|
12
|
+
*/
|
|
13
|
+
public x: number;
|
|
14
|
+
/**
|
|
15
|
+
* the position of the point on the vertical axis
|
|
16
|
+
* @public
|
|
17
|
+
* @type {Number}
|
|
18
|
+
* @default 0
|
|
19
|
+
*/
|
|
20
|
+
public y: number;
|
|
21
|
+
/** @ignore */
|
|
22
|
+
onResetEvent(x?: number, y?: number): void;
|
|
23
|
+
/**
|
|
24
|
+
* set the Point x and y properties to the given values
|
|
25
|
+
* @param {number} x
|
|
26
|
+
* @param {number} y
|
|
27
|
+
* @returns {Point} Reference to this object for method chaining
|
|
28
|
+
*/
|
|
29
|
+
set(x?: number, y?: number): Point;
|
|
30
|
+
/**
|
|
31
|
+
* return true if the two points are the same
|
|
32
|
+
* @name equals
|
|
33
|
+
* @memberof Point
|
|
34
|
+
* @method
|
|
35
|
+
* @param {Point} point
|
|
36
|
+
* @returns {boolean}
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* return true if this point is equal to the given values
|
|
40
|
+
* @name equals
|
|
41
|
+
* @memberof Point
|
|
42
|
+
* @param {number} x
|
|
43
|
+
* @param {number} y
|
|
44
|
+
* @returns {boolean}
|
|
45
|
+
*/
|
|
46
|
+
equals(...args: any[]): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* clone this Point
|
|
49
|
+
* @name clone
|
|
50
|
+
* @returns {Point} new Point
|
|
51
|
+
*/
|
|
52
|
+
clone(): Point;
|
|
53
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @classdesc
|
|
3
|
+
* a polygon Object.<br>
|
|
4
|
+
* Please do note that melonJS implements a simple Axis-Aligned Boxes collision algorithm, which requires all polygons used for collision to be convex with all vertices defined with clockwise winding.
|
|
5
|
+
* A polygon is convex when all line segments connecting two points in the interior do not cross any edge of the polygon
|
|
6
|
+
* (which means that all angles are less than 180 degrees), as described here below : <br>
|
|
7
|
+
* <center><img src="images/convex_polygon.png"/></center><br>
|
|
8
|
+
*
|
|
9
|
+
* A polygon's `winding` is clockwise if its vertices (points) are declared turning to the right. The image above shows COUNTERCLOCKWISE winding.
|
|
10
|
+
*/
|
|
11
|
+
export default class Polygon {
|
|
12
|
+
/**
|
|
13
|
+
* @param {number} x - origin point of the Polygon
|
|
14
|
+
* @param {number} y - origin point of the Polygon
|
|
15
|
+
* @param {Vector2d[]} points - array of vector defining the Polygon
|
|
16
|
+
*/
|
|
17
|
+
constructor(x: number, y: number, points: Vector2d[]);
|
|
18
|
+
/**
|
|
19
|
+
* origin point of the Polygon
|
|
20
|
+
* @public
|
|
21
|
+
* @type {Vector2d}
|
|
22
|
+
* @name pos
|
|
23
|
+
* @memberof Polygon
|
|
24
|
+
*/
|
|
25
|
+
public pos: Vector2d;
|
|
26
|
+
/**
|
|
27
|
+
* Array of points defining the Polygon <br>
|
|
28
|
+
* Note: If you manually change `points`, you **must** call `recalc`afterwards so that the changes get applied correctly.
|
|
29
|
+
* @public
|
|
30
|
+
* @type {Vector2d[]}
|
|
31
|
+
* @name points
|
|
32
|
+
* @memberof Polygon
|
|
33
|
+
*/
|
|
34
|
+
public points: Vector2d[];
|
|
35
|
+
/**
|
|
36
|
+
* The edges here are the direction of the `n`th edge of the polygon, relative to
|
|
37
|
+
* the `n`th point. If you want to draw a given edge from the edge value, you must
|
|
38
|
+
* first translate to the position of the starting point.
|
|
39
|
+
* @ignore
|
|
40
|
+
*/
|
|
41
|
+
edges: any[];
|
|
42
|
+
/**
|
|
43
|
+
* a list of indices for all vertices composing this polygon (@see earcut)
|
|
44
|
+
* @ignore
|
|
45
|
+
*/
|
|
46
|
+
indices: any[];
|
|
47
|
+
/**
|
|
48
|
+
* The normals here are the direction of the normal for the `n`th edge of the polygon, relative
|
|
49
|
+
* to the position of the `n`th point. If you want to draw an edge normal, you must first
|
|
50
|
+
* translate to the position of the starting point.
|
|
51
|
+
* @ignore
|
|
52
|
+
*/
|
|
53
|
+
normals: any[];
|
|
54
|
+
shapeType: string;
|
|
55
|
+
/** @ignore */
|
|
56
|
+
onResetEvent(x: any, y: any, points: any): void;
|
|
57
|
+
/**
|
|
58
|
+
* set new value to the Polygon
|
|
59
|
+
* @name setShape
|
|
60
|
+
* @memberof Polygon
|
|
61
|
+
* @param {number} x - position of the Polygon
|
|
62
|
+
* @param {number} y - position of the Polygon
|
|
63
|
+
* @param {Vector2d[]|number[]} points - array of vector or vertice defining the Polygon
|
|
64
|
+
* @returns {Polygon} this instance for objecf chaining
|
|
65
|
+
*/
|
|
66
|
+
setShape(x: number, y: number, points: Vector2d[] | number[]): Polygon;
|
|
67
|
+
/**
|
|
68
|
+
* set the vertices defining this Polygon
|
|
69
|
+
* @name setVertices
|
|
70
|
+
* @memberof Polygon
|
|
71
|
+
* @param {Vector2d[]} vertices - array of vector or vertice defining the Polygon
|
|
72
|
+
* @returns {Polygon} this instance for objecf chaining
|
|
73
|
+
*/
|
|
74
|
+
setVertices(vertices: Vector2d[]): Polygon;
|
|
75
|
+
/**
|
|
76
|
+
* apply the given transformation matrix to this Polygon
|
|
77
|
+
* @name transform
|
|
78
|
+
* @memberof Polygon
|
|
79
|
+
* @param {Matrix2d} m - the transformation matrix
|
|
80
|
+
* @returns {Polygon} Reference to this object for method chaining
|
|
81
|
+
*/
|
|
82
|
+
transform(m: Matrix2d): Polygon;
|
|
83
|
+
/**
|
|
84
|
+
* apply an isometric projection to this shape
|
|
85
|
+
* @name toIso
|
|
86
|
+
* @memberof Polygon
|
|
87
|
+
* @returns {Polygon} Reference to this object for method chaining
|
|
88
|
+
*/
|
|
89
|
+
toIso(): Polygon;
|
|
90
|
+
/**
|
|
91
|
+
* apply a 2d projection to this shape
|
|
92
|
+
* @name to2d
|
|
93
|
+
* @memberof Polygon
|
|
94
|
+
* @returns {Polygon} Reference to this object for method chaining
|
|
95
|
+
*/
|
|
96
|
+
to2d(): Polygon;
|
|
97
|
+
/**
|
|
98
|
+
* Rotate this Polygon (counter-clockwise) by the specified angle (in radians).
|
|
99
|
+
* @name rotate
|
|
100
|
+
* @memberof Polygon
|
|
101
|
+
* @param {number} angle - The angle to rotate (in radians)
|
|
102
|
+
* @param {Vector2d|ObservableVector2d} [v] - an optional point to rotate around
|
|
103
|
+
* @returns {Polygon} Reference to this object for method chaining
|
|
104
|
+
*/
|
|
105
|
+
rotate(angle: number, v?: Vector2d | ObservableVector2d): Polygon;
|
|
106
|
+
/**
|
|
107
|
+
* Scale this Polygon by the given scalar.
|
|
108
|
+
* @name scale
|
|
109
|
+
* @memberof Polygon
|
|
110
|
+
* @param {number} x
|
|
111
|
+
* @param {number} [y=x]
|
|
112
|
+
* @returns {Polygon} Reference to this object for method chaining
|
|
113
|
+
*/
|
|
114
|
+
scale(x: number, y?: number | undefined): Polygon;
|
|
115
|
+
/**
|
|
116
|
+
* Scale this Polygon by the given vector
|
|
117
|
+
* @name scaleV
|
|
118
|
+
* @memberof Polygon
|
|
119
|
+
* @param {Vector2d} v
|
|
120
|
+
* @returns {Polygon} Reference to this object for method chaining
|
|
121
|
+
*/
|
|
122
|
+
scaleV(v: Vector2d): Polygon;
|
|
123
|
+
/**
|
|
124
|
+
* Computes the calculated collision polygon.
|
|
125
|
+
* This **must** be called if the `points` array, `angle`, or `offset` is modified manually.
|
|
126
|
+
* @name recalc
|
|
127
|
+
* @memberof Polygon
|
|
128
|
+
* @returns {Polygon} Reference to this object for method chaining
|
|
129
|
+
*/
|
|
130
|
+
recalc(): Polygon;
|
|
131
|
+
/**
|
|
132
|
+
* returns a list of indices for all triangles defined in this polygon
|
|
133
|
+
* @name getIndices
|
|
134
|
+
* @memberof Polygon
|
|
135
|
+
* @returns {Array} an array of vertex indices for all triangles forming this polygon.
|
|
136
|
+
*/
|
|
137
|
+
getIndices(): any[];
|
|
138
|
+
/**
|
|
139
|
+
* Returns true if the vertices composing this polygon form a convex shape (vertices must be in clockwise order).
|
|
140
|
+
* @name isConvex
|
|
141
|
+
* @memberof Polygon
|
|
142
|
+
* @returns {boolean} true if the vertices are convex, false if not, null if not computable
|
|
143
|
+
*/
|
|
144
|
+
isConvex(): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* translate the Polygon by the specified offset
|
|
147
|
+
* @name translate
|
|
148
|
+
* @memberof Polygon
|
|
149
|
+
* @method
|
|
150
|
+
* @param {number} x - x offset
|
|
151
|
+
* @param {number} y - y offset
|
|
152
|
+
* @returns {Polygon} this Polygon
|
|
153
|
+
*/
|
|
154
|
+
/**
|
|
155
|
+
* translate the Polygon by the specified vector
|
|
156
|
+
* @name translate
|
|
157
|
+
* @memberof Polygon
|
|
158
|
+
* @param {Vector2d} v - vector offset
|
|
159
|
+
* @returns {Polygon} Reference to this object for method chaining
|
|
160
|
+
*/
|
|
161
|
+
translate(...args: any[]): Polygon;
|
|
162
|
+
/**
|
|
163
|
+
* Shifts the Polygon to the given position vector.
|
|
164
|
+
* @name shift
|
|
165
|
+
* @memberof Polygon
|
|
166
|
+
* @method
|
|
167
|
+
* @param {Vector2d} position
|
|
168
|
+
*/
|
|
169
|
+
/**
|
|
170
|
+
* Shifts the Polygon to the given x, y position.
|
|
171
|
+
* @name shift
|
|
172
|
+
* @memberof Polygon
|
|
173
|
+
* @param {number} x
|
|
174
|
+
* @param {number} y
|
|
175
|
+
*/
|
|
176
|
+
shift(...args: any[]): void;
|
|
177
|
+
/**
|
|
178
|
+
* Returns true if the polygon contains the given point.
|
|
179
|
+
* (Note: it is highly recommended to first do a hit test on the corresponding <br>
|
|
180
|
+
* bounding rect, as the function can be highly consuming with complex shapes)
|
|
181
|
+
* @name contains
|
|
182
|
+
* @memberof Polygon
|
|
183
|
+
* @method
|
|
184
|
+
* @param {Vector2d} point
|
|
185
|
+
* @returns {boolean} true if contains
|
|
186
|
+
*/
|
|
187
|
+
/**
|
|
188
|
+
* Returns true if the polygon contains the given point. <br>
|
|
189
|
+
* (Note: it is highly recommended to first do a hit test on the corresponding <br>
|
|
190
|
+
* bounding rect, as the function can be highly consuming with complex shapes)
|
|
191
|
+
* @name contains
|
|
192
|
+
* @memberof Polygon
|
|
193
|
+
* @param {number} x - x coordinate
|
|
194
|
+
* @param {number} y - y coordinate
|
|
195
|
+
* @returns {boolean} true if contains
|
|
196
|
+
*/
|
|
197
|
+
contains(...args: any[]): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
|
|
200
|
+
* @name getBounds
|
|
201
|
+
* @memberof Polygon
|
|
202
|
+
* @returns {Bounds} this shape bounding box Rectangle object
|
|
203
|
+
*/
|
|
204
|
+
getBounds(): Bounds;
|
|
205
|
+
_bounds: object | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* update the bounding box for this shape.
|
|
208
|
+
* @ignore
|
|
209
|
+
* @name updateBounds
|
|
210
|
+
* @memberof Polygon
|
|
211
|
+
* @returns {Bounds} this shape bounding box Rectangle object
|
|
212
|
+
*/
|
|
213
|
+
updateBounds(): Bounds;
|
|
214
|
+
/**
|
|
215
|
+
* clone this Polygon
|
|
216
|
+
* @name clone
|
|
217
|
+
* @memberof Polygon
|
|
218
|
+
* @returns {Polygon} new Polygon
|
|
219
|
+
*/
|
|
220
|
+
clone(): Polygon;
|
|
221
|
+
}
|
|
222
|
+
import Vector2d from "./../math/vector2.js";
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @classdesc
|
|
3
|
+
* a rectangle Object
|
|
4
|
+
* @augments Polygon
|
|
5
|
+
*/
|
|
6
|
+
export default class Rect extends Polygon {
|
|
7
|
+
/**
|
|
8
|
+
* @param {number} x - position of the Rectangle
|
|
9
|
+
* @param {number} y - position of the Rectangle
|
|
10
|
+
* @param {number} w - width of the rectangle
|
|
11
|
+
* @param {number} h - height of the rectangle
|
|
12
|
+
*/
|
|
13
|
+
constructor(x: number, y: number, w: number, h: number);
|
|
14
|
+
/** @ignore */
|
|
15
|
+
onResetEvent(x: any, y: any, w: any, h: any): void;
|
|
16
|
+
/**
|
|
17
|
+
* set new value to the rectangle shape
|
|
18
|
+
* @name setShape
|
|
19
|
+
* @memberof Rect
|
|
20
|
+
* @param {number} x - position of the Rectangle
|
|
21
|
+
* @param {number} y - position of the Rectangle
|
|
22
|
+
* @param {number|Vector2d[]} w - width of the rectangle, or an array of vector defining the rectangle
|
|
23
|
+
* @param {number} [h] - height of the rectangle, if a numeral width parameter is specified
|
|
24
|
+
* @returns {Rect} this rectangle
|
|
25
|
+
*/
|
|
26
|
+
setShape(x: number, y: number, w: number | Vector2d[], h?: number | undefined, ...args: any[]): Rect;
|
|
27
|
+
/**
|
|
28
|
+
* left coordinate of the Rectangle
|
|
29
|
+
* @public
|
|
30
|
+
* @type {number}
|
|
31
|
+
* @name left
|
|
32
|
+
* @memberof Rect
|
|
33
|
+
*/
|
|
34
|
+
public get left(): number;
|
|
35
|
+
/**
|
|
36
|
+
* right coordinate of the Rectangle
|
|
37
|
+
* @public
|
|
38
|
+
* @type {number}
|
|
39
|
+
* @name right
|
|
40
|
+
* @memberof Rect
|
|
41
|
+
*/
|
|
42
|
+
public get right(): number;
|
|
43
|
+
/**
|
|
44
|
+
* top coordinate of the Rectangle
|
|
45
|
+
* @public
|
|
46
|
+
* @type {number}
|
|
47
|
+
* @name top
|
|
48
|
+
* @memberof Rect
|
|
49
|
+
*/
|
|
50
|
+
public get top(): number;
|
|
51
|
+
/**
|
|
52
|
+
* bottom coordinate of the Rectangle
|
|
53
|
+
* @public
|
|
54
|
+
* @type {number}
|
|
55
|
+
* @name bottom
|
|
56
|
+
* @memberof Rect
|
|
57
|
+
*/
|
|
58
|
+
public get bottom(): number;
|
|
59
|
+
public set width(arg: number);
|
|
60
|
+
/**
|
|
61
|
+
* width of the Rectangle
|
|
62
|
+
* @public
|
|
63
|
+
* @type {number}
|
|
64
|
+
* @name width
|
|
65
|
+
* @memberof Rect
|
|
66
|
+
*/
|
|
67
|
+
public get width(): number;
|
|
68
|
+
public set height(arg: number);
|
|
69
|
+
/**
|
|
70
|
+
* height of the Rectangle
|
|
71
|
+
* @public
|
|
72
|
+
* @type {number}
|
|
73
|
+
* @name height
|
|
74
|
+
* @memberof Rect
|
|
75
|
+
*/
|
|
76
|
+
public get height(): number;
|
|
77
|
+
public set centerX(arg: number);
|
|
78
|
+
/**
|
|
79
|
+
* absolute center of this rectangle on the horizontal axis
|
|
80
|
+
* @public
|
|
81
|
+
* @type {number}
|
|
82
|
+
* @name centerX
|
|
83
|
+
* @memberof Rect
|
|
84
|
+
*/
|
|
85
|
+
public get centerX(): number;
|
|
86
|
+
public set centerY(arg: number);
|
|
87
|
+
/**
|
|
88
|
+
* absolute center of this rectangle on the vertical axis
|
|
89
|
+
* @public
|
|
90
|
+
* @type {number}
|
|
91
|
+
* @name centerY
|
|
92
|
+
* @memberof Rect
|
|
93
|
+
*/
|
|
94
|
+
public get centerY(): number;
|
|
95
|
+
/**
|
|
96
|
+
* center the rectangle position around the given coordinates
|
|
97
|
+
* @name centerOn
|
|
98
|
+
* @memberof Rect
|
|
99
|
+
* @param {number} x - the x coordinate around which to center this rectangle
|
|
100
|
+
* @param {number} y - the y coordinate around which to center this rectangle
|
|
101
|
+
* @returns {Rect} this rectangle
|
|
102
|
+
*/
|
|
103
|
+
centerOn(x: number, y: number): Rect;
|
|
104
|
+
/**
|
|
105
|
+
* resize the rectangle
|
|
106
|
+
* @name resize
|
|
107
|
+
* @memberof Rect
|
|
108
|
+
* @param {number} w - new width of the rectangle
|
|
109
|
+
* @param {number} h - new height of the rectangle
|
|
110
|
+
* @returns {Rect} this rectangle
|
|
111
|
+
*/
|
|
112
|
+
resize(w: number, h: number): Rect;
|
|
113
|
+
/**
|
|
114
|
+
* scale the rectangle
|
|
115
|
+
* @name scale
|
|
116
|
+
* @memberof Rect
|
|
117
|
+
* @param {number} x - a number representing the abscissa of the scaling vector.
|
|
118
|
+
* @param {number} [y=x] - a number representing the ordinate of the scaling vector.
|
|
119
|
+
* @returns {Rect} this rectangle
|
|
120
|
+
*/
|
|
121
|
+
scale(x: number, y?: number | undefined): Rect;
|
|
122
|
+
/**
|
|
123
|
+
* clone this rectangle
|
|
124
|
+
* @name clone
|
|
125
|
+
* @memberof Rect
|
|
126
|
+
* @returns {Rect} new rectangle
|
|
127
|
+
*/
|
|
128
|
+
clone(): Rect;
|
|
129
|
+
/**
|
|
130
|
+
* copy the position and size of the given rectangle into this one
|
|
131
|
+
* @name copy
|
|
132
|
+
* @memberof Rect
|
|
133
|
+
* @param {Rect} rect - Source rectangle
|
|
134
|
+
* @returns {Rect} new rectangle
|
|
135
|
+
*/
|
|
136
|
+
copy(rect: Rect): Rect;
|
|
137
|
+
/**
|
|
138
|
+
* merge this rectangle with another one
|
|
139
|
+
* @name union
|
|
140
|
+
* @memberof Rect
|
|
141
|
+
* @param {Rect} rect - other rectangle to union with
|
|
142
|
+
* @returns {Rect} the union(ed) rectangle
|
|
143
|
+
*/
|
|
144
|
+
union(rect: Rect): Rect;
|
|
145
|
+
/**
|
|
146
|
+
* check if this rectangle is intersecting with the specified one
|
|
147
|
+
* @name overlaps
|
|
148
|
+
* @memberof Rect
|
|
149
|
+
* @param {Rect} rect
|
|
150
|
+
* @returns {boolean} true if overlaps
|
|
151
|
+
*/
|
|
152
|
+
overlaps(rect: Rect): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* check if this rectangle is identical to the specified one
|
|
155
|
+
* @name equals
|
|
156
|
+
* @memberof Rect
|
|
157
|
+
* @param {Rect} rect
|
|
158
|
+
* @returns {boolean} true if equals
|
|
159
|
+
*/
|
|
160
|
+
equals(rect: Rect): boolean;
|
|
161
|
+
/**
|
|
162
|
+
* determines whether all coordinates of this rectangle are finite numbers.
|
|
163
|
+
* @name isFinite
|
|
164
|
+
* @memberof Rect
|
|
165
|
+
* @returns {boolean} false if all coordinates are positive or negative Infinity or NaN; otherwise, true.
|
|
166
|
+
*/
|
|
167
|
+
isFinite(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Returns a polygon whose edges are the same as this box.
|
|
170
|
+
* @name toPolygon
|
|
171
|
+
* @memberof Rect
|
|
172
|
+
* @returns {Polygon} a new Polygon that represents this rectangle.
|
|
173
|
+
*/
|
|
174
|
+
toPolygon(): Polygon;
|
|
175
|
+
}
|
|
176
|
+
import Polygon from "./poly.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @classdesc
|
|
3
|
+
* a rectangle object with rounded corners
|
|
4
|
+
* @augments Rect
|
|
5
|
+
*/
|
|
6
|
+
export default class RoundRect extends Rect {
|
|
7
|
+
/**
|
|
8
|
+
* @param {number} x - position of the rounded rectangle
|
|
9
|
+
* @param {number} y - position of the rounded rectangle
|
|
10
|
+
* @param {number} width - the rectangle width
|
|
11
|
+
* @param {number} height - the rectangle height
|
|
12
|
+
* @param {number} [radius=20] - the radius of the rounded corner
|
|
13
|
+
*/
|
|
14
|
+
constructor(x: number, y: number, width: number, height: number, radius?: number | undefined);
|
|
15
|
+
public set radius(arg: number);
|
|
16
|
+
/**
|
|
17
|
+
* the radius of the rounded corner
|
|
18
|
+
* @public
|
|
19
|
+
* @type {number}
|
|
20
|
+
* @default 20
|
|
21
|
+
* @name radius
|
|
22
|
+
* @memberof RoundRect
|
|
23
|
+
*/
|
|
24
|
+
public get radius(): number;
|
|
25
|
+
/** @ignore */
|
|
26
|
+
onResetEvent(x: any, y: any, w: any, h: any, radius: any): void;
|
|
27
|
+
_radius: number | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* copy the position, size and radius of the given rounded rectangle into this one
|
|
30
|
+
* @name copy
|
|
31
|
+
* @memberof RoundRect
|
|
32
|
+
* @param {RoundRect} rrect - source rounded rectangle
|
|
33
|
+
* @returns {RoundRect} new rectangle
|
|
34
|
+
*/
|
|
35
|
+
copy(rrect: RoundRect): RoundRect;
|
|
36
|
+
/**
|
|
37
|
+
* check if this RoundRect is identical to the specified one
|
|
38
|
+
* @name equals
|
|
39
|
+
* @memberof RoundRect
|
|
40
|
+
* @param {RoundRect} rrect
|
|
41
|
+
* @returns {boolean} true if equals
|
|
42
|
+
*/
|
|
43
|
+
equals(rrect: RoundRect): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* clone this RoundRect
|
|
46
|
+
* @name clone
|
|
47
|
+
* @memberof RoundRect
|
|
48
|
+
* @returns {RoundRect} new RoundRect
|
|
49
|
+
*/
|
|
50
|
+
clone(): RoundRect;
|
|
51
|
+
}
|
|
52
|
+
import Rect from "./rectangle.js";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export function boot(): void;
|
|
|
16
16
|
*/
|
|
17
17
|
export const version: string;
|
|
18
18
|
export * from "./lang/deprecated.js";
|
|
19
|
+
export * from "./const.js";
|
|
19
20
|
/**
|
|
20
21
|
* a flag indicating that melonJS is fully initialized
|
|
21
22
|
* @type {boolean}
|
|
@@ -30,11 +31,11 @@ export const initialized: boolean;
|
|
|
30
31
|
* @see boot
|
|
31
32
|
*/
|
|
32
33
|
export const skipAutoInit: boolean;
|
|
34
|
+
export const game: Application;
|
|
33
35
|
import * as audio from "./audio/audio.js";
|
|
34
36
|
import collision from "./physics/collision.js";
|
|
35
37
|
import * as device from "./system/device.js";
|
|
36
38
|
import * as event from "./system/event.js";
|
|
37
|
-
import game from "./game.js";
|
|
38
39
|
import loader from "./loader/loader.js";
|
|
39
40
|
import level from "./level/level.js";
|
|
40
41
|
import * as input from "./input/input.js";
|
|
@@ -105,4 +106,5 @@ import ParticleEmitter from "./particles/emitter.js";
|
|
|
105
106
|
import ParticleEmitterSettings from "./particles/settings.js";
|
|
106
107
|
import Particle from "./particles/particle.js";
|
|
107
108
|
import Entity from "./entity/entity.js";
|
|
108
|
-
|
|
109
|
+
import Application from "./application/application.js";
|
|
110
|
+
export { audio, collision, device, event, loader, level, input, Math, plugin, plugins, utils, save, timer, pool, state, video, Color, Vector2d, Vector3d, ObservableVector2d, ObservableVector3d, Matrix2d, Matrix3d, Polygon, Line, Ellipse, Point, Rect, RoundRect, Tween, QuadTree, GLShader, WebGLCompositor, Renderer, WebGLRenderer, CanvasRenderer, TextureAtlas, Renderable, Body, Bounds, Text, BitmapText, BitmapTextData, ColorLayer, ImageLayer, Sprite, NineSliceSprite, UIBaseElement, UITextButton, UISpriteElement, Collectable, Trigger, Light2d, Draggable, DropTarget, TMXRenderer, TMXOrthogonalRenderer, TMXIsometricRenderer, TMXHexagonalRenderer, TMXStaggeredRenderer, Tile, TMXTileset, TMXTilesetGroup, TMXTileMap, TMXLayer, Pointer, Stage, Camera2d, Container, World, ParticleEmitter, ParticleEmitterSettings, Particle, Entity, Application };
|