melonjs 17.3.0 → 17.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 +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/_virtual/re.js +1 -1
- package/dist/melonjs.mjs/application/application.js +7 -1
- package/dist/melonjs.mjs/application/header.js +6 -1
- package/dist/melonjs.mjs/application/resize.js +6 -1
- package/dist/melonjs.mjs/application/settings.js +6 -1
- package/dist/melonjs.mjs/audio/audio.js +7 -2
- package/dist/melonjs.mjs/camera/camera2d.js +9 -1
- package/dist/melonjs.mjs/const.js +1 -1
- package/dist/melonjs.mjs/geometries/ellipse.js +10 -2
- package/dist/melonjs.mjs/geometries/line.js +6 -1
- package/dist/melonjs.mjs/geometries/path2d.js +6 -1
- package/dist/melonjs.mjs/geometries/point.js +6 -1
- package/dist/melonjs.mjs/geometries/poly.js +9 -1
- package/dist/melonjs.mjs/geometries/rectangle.js +6 -1
- package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
- package/dist/melonjs.mjs/geometries/toarccanvas.js +1 -1
- package/dist/melonjs.mjs/index.js +2 -2
- 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 +1 -1
- package/dist/melonjs.mjs/input/pointerevent.js +5 -1
- package/dist/melonjs.mjs/lang/console.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +1 -1
- package/dist/melonjs.mjs/level/level.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +1 -1
- 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 +1 -1
- 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/constants.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/level/tiled/renderer/autodetect.js +1 -1
- package/dist/melonjs.mjs/loader/cache.js +1 -1
- package/dist/melonjs.mjs/loader/loader.js +8 -7
- package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/binary.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/compressed_image.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/parseDDS.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/parseKTX.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/parseKTX2.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/parsePKM.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/parsePVR.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/fetchdata.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/fontface.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/image.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/json.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/script.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/tmx.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/video.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 +9 -1
- package/dist/melonjs.mjs/math/matrix3.js +8 -1
- package/dist/melonjs.mjs/math/observable_vector2.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector3.js +7 -1
- package/dist/melonjs.mjs/math/vector2.js +3 -3
- package/dist/melonjs.mjs/math/vector3.js +9 -4
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/classes/comparator.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/classes/range.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/classes/semver.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/clean.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/cmp.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/coerce.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/compare-build.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/compare-loose.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/compare.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/diff.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/eq.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/gt.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/gte.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/inc.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/lt.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/lte.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/major.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/minor.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/neq.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/parse.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/patch.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/prerelease.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/rcompare.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/rsort.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/satisfies.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/sort.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/valid.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/constants.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/debug.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/identifiers.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/lrucache.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/parse-options.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/re.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/gtr.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/intersects.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/ltr.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/max-satisfying.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/min-satisfying.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/min-version.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/outside.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/simplify.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/subset.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/to-comparators.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/valid.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +1 -1
- package/dist/melonjs.mjs/particles/particle.js +5 -1
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +12 -1
- package/dist/melonjs.mjs/physics/bounds.js +7 -1
- package/dist/melonjs.mjs/physics/collision.js +6 -1
- package/dist/melonjs.mjs/physics/detector.js +10 -1
- package/dist/melonjs.mjs/physics/quadtree.js +7 -1
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +10 -1
- package/dist/melonjs.mjs/physics/world.js +5 -1
- package/dist/melonjs.mjs/plugin/plugin.js +8 -4
- package/dist/melonjs.mjs/renderable/collectable.js +1 -1
- package/dist/melonjs.mjs/renderable/colorlayer.js +9 -4
- package/dist/melonjs.mjs/renderable/container.js +26 -4
- package/dist/melonjs.mjs/renderable/draggable.js +1 -1
- package/dist/melonjs.mjs/renderable/dragndrop.js +6 -1
- package/dist/melonjs.mjs/renderable/entity/entity.js +11 -2
- package/dist/melonjs.mjs/renderable/imagelayer.js +6 -1
- package/dist/melonjs.mjs/renderable/light2d.js +10 -2
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +7 -1
- package/dist/melonjs.mjs/renderable/renderable.js +20 -2
- package/dist/melonjs.mjs/renderable/sprite.js +8 -2
- package/dist/melonjs.mjs/renderable/text/bitmaptext.js +1 -1
- package/dist/melonjs.mjs/renderable/text/bitmaptextdata.js +1 -1
- package/dist/melonjs.mjs/renderable/text/glyph.js +1 -1
- package/dist/melonjs.mjs/renderable/text/text.js +1 -1
- package/dist/melonjs.mjs/renderable/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/renderable/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/renderable/trigger.js +7 -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 +1 -1
- package/dist/melonjs.mjs/state/state.js +1 -1
- package/dist/melonjs.mjs/system/device.js +1 -1
- package/dist/melonjs.mjs/system/dom.js +1 -1
- 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/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +1 -1
- 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 +1 -1
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +32 -1
- package/dist/melonjs.mjs/video/renderer.js +11 -2
- package/dist/melonjs.mjs/video/rendertarget/canvasrendertarget.js +9 -3
- package/dist/melonjs.mjs/video/texture/atlas.js +6 -1
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/parser/aseprite.js +1 -1
- package/dist/melonjs.mjs/video/texture/parser/spritesheet.js +1 -1
- package/dist/melonjs.mjs/video/texture/parser/texturepacker.js +1 -1
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +1 -1
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +7 -1
- package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +6 -1
- package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +6 -1
- package/dist/melonjs.mjs/video/webgl/glshader.js +1 -1
- 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 +1 -1
- 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_renderer.js +78 -31
- package/dist/melonjs.module.js +424 -62
- package/dist/types/application/application.d.ts +7 -0
- package/dist/types/application/header.d.ts +5 -0
- package/dist/types/application/resize.d.ts +1 -0
- package/dist/types/application/settings.d.ts +2 -1
- package/dist/types/audio/audio.d.ts +3 -2
- package/dist/types/camera/camera2d.d.ts +8 -3
- package/dist/types/geometries/ellipse.d.ts +14 -3
- package/dist/types/geometries/line.d.ts +4 -0
- package/dist/types/geometries/path2d.d.ts +5 -0
- package/dist/types/geometries/point.d.ts +4 -0
- package/dist/types/geometries/poly.d.ts +12 -1
- package/dist/types/geometries/rectangle.d.ts +5 -0
- package/dist/types/input/pointerevent.d.ts +2 -1
- package/dist/types/level/tiled/TMXTileset.d.ts +1 -1
- package/dist/types/loader/loader.d.ts +13 -43
- package/dist/types/math/matrix2.d.ts +9 -0
- package/dist/types/math/matrix3.d.ts +9 -0
- package/dist/types/math/observable_vector3.d.ts +24 -1
- package/dist/types/math/vector2.d.ts +3 -3
- package/dist/types/math/vector3.d.ts +9 -4
- package/dist/types/particles/emitter.d.ts +9 -30
- package/dist/types/particles/particle.d.ts +4 -0
- package/dist/types/physics/body.d.ts +20 -2
- package/dist/types/physics/bounds.d.ts +8 -0
- package/dist/types/physics/collision.d.ts +3 -1
- package/dist/types/physics/detector.d.ts +6 -0
- package/dist/types/physics/quadtree.d.ts +4 -1
- package/dist/types/physics/sat.d.ts +7 -0
- package/dist/types/physics/world.d.ts +4 -0
- package/dist/types/plugin/plugin.d.ts +7 -3
- package/dist/types/renderable/colorlayer.d.ts +17 -0
- package/dist/types/renderable/container.d.ts +40 -8
- package/dist/types/renderable/dragndrop.d.ts +5 -0
- package/dist/types/renderable/entity/entity.d.ts +14 -7
- package/dist/types/renderable/imagelayer.d.ts +14 -2
- package/dist/types/renderable/light2d.d.ts +3 -1
- package/dist/types/renderable/nineslicesprite.d.ts +8 -1
- package/dist/types/renderable/renderable.d.ts +33 -9
- package/dist/types/renderable/sprite.d.ts +8 -1
- package/dist/types/renderable/text/bitmaptext.d.ts +1 -1
- package/dist/types/renderable/trigger.d.ts +4 -0
- package/dist/types/state/state.d.ts +1 -1
- package/dist/types/video/canvas/canvas_renderer.d.ts +32 -4
- package/dist/types/video/renderer.d.ts +15 -1
- package/dist/types/video/rendertarget/canvasrendertarget.d.ts +32 -4
- package/dist/types/video/texture/atlas.d.ts +6 -1
- package/dist/types/video/webgl/compositors/compositor.d.ts +7 -0
- package/dist/types/video/webgl/compositors/primitive_compositor.d.ts +5 -0
- package/dist/types/video/webgl/compositors/quad_compositor.d.ts +2 -1
- package/dist/types/video/webgl/webgl_renderer.d.ts +25 -21
- package/package.json +10 -11
- package/src/application/application.js +6 -0
- package/src/application/header.js +5 -0
- package/src/application/resize.js +5 -0
- package/src/application/settings.js +5 -0
- package/src/audio/audio.js +6 -1
- package/src/camera/camera2d.js +7 -0
- package/src/geometries/ellipse.js +9 -1
- package/src/geometries/line.js +5 -0
- package/src/geometries/path2d.js +6 -0
- package/src/geometries/point.js +5 -0
- package/src/geometries/poly.js +8 -0
- package/src/geometries/rectangle.js +5 -0
- package/src/input/pointerevent.js +4 -0
- package/src/loader/loader.js +7 -6
- package/src/math/matrix2.js +8 -0
- package/src/math/matrix3.js +7 -0
- package/src/math/observable_vector3.js +6 -0
- package/src/math/vector2.js +2 -2
- package/src/math/vector3.js +8 -3
- package/src/particles/particle.js +4 -0
- package/src/physics/body.js +11 -0
- package/src/physics/bounds.js +6 -0
- package/src/physics/collision.js +5 -0
- package/src/physics/detector.js +9 -0
- package/src/physics/quadtree.js +6 -0
- package/src/physics/sat.js +11 -1
- package/src/physics/world.js +4 -0
- package/src/plugin/plugin.js +5 -1
- package/src/renderable/colorlayer.js +7 -3
- package/src/renderable/container.js +26 -3
- package/src/renderable/dragndrop.js +4 -0
- package/src/renderable/entity/entity.js +9 -1
- package/src/renderable/imagelayer.js +4 -0
- package/src/renderable/light2d.js +9 -1
- package/src/renderable/nineslicesprite.js +6 -0
- package/src/renderable/renderable.js +18 -1
- package/src/renderable/sprite.js +7 -1
- package/src/renderable/trigger.js +6 -1
- package/src/video/canvas/canvas_renderer.js +31 -0
- package/src/video/renderer.js +10 -1
- package/src/video/rendertarget/canvasrendertarget.js +8 -2
- package/src/video/texture/atlas.js +5 -0
- package/src/video/webgl/compositors/compositor.js +6 -0
- package/src/video/webgl/compositors/primitive_compositor.js +5 -0
- package/src/video/webgl/compositors/quad_compositor.js +5 -0
- package/src/video/webgl/webgl_renderer.js +77 -30
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* additional import for TypeScript
|
|
3
|
+
* @import WebGLRenderer from "./../webgl_renderer.js";
|
|
4
|
+
* @import Matrix3d from "./../../../math/matrix3.js";
|
|
5
|
+
*/
|
|
1
6
|
/**
|
|
2
7
|
* @classdesc
|
|
3
8
|
* A base Compositor object.
|
|
@@ -116,3 +121,5 @@ export default class Compositor {
|
|
|
116
121
|
}
|
|
117
122
|
import GLShader from "../glshader.js";
|
|
118
123
|
import VertexArrayBuffer from "../buffer/vertex.js";
|
|
124
|
+
import type Matrix3d from "./../../../math/matrix3.js";
|
|
125
|
+
import type WebGLRenderer from "./../webgl_renderer.js";
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* additional import for TypeScript
|
|
3
|
+
* @import Point from "./../../../geometries/point.js";
|
|
4
|
+
*/
|
|
1
5
|
/**
|
|
2
6
|
* @classdesc
|
|
3
7
|
* A WebGL Compositor object. This class handles all of the WebGL state<br>
|
|
@@ -19,3 +23,4 @@ export default class PrimitiveCompositor extends Compositor {
|
|
|
19
23
|
drawVertices(mode: GLenum, verts: Point[], vertexCount?: number | undefined): void;
|
|
20
24
|
}
|
|
21
25
|
import Compositor from "./compositor.js";
|
|
26
|
+
import type Point from "./../../../geometries/point.js";
|
|
@@ -24,7 +24,7 @@ export default class QuadCompositor extends Compositor {
|
|
|
24
24
|
* @param {boolean} [mipmap=true] - Whether mipmap levels should be generated for this texture
|
|
25
25
|
* @returns {WebGLTexture} a WebGL texture
|
|
26
26
|
*/
|
|
27
|
-
createTexture2D(unit: number, pixels?: HTMLCanvasElement | ImageData | (new (width?: number
|
|
27
|
+
createTexture2D(unit: number, pixels?: HTMLCanvasElement | ImageData | (new (width?: number, height?: number) => HTMLImageElement) | Uint8Array[] | Float32Array[] | undefined, filter: number, repeat?: string | undefined, w?: number | undefined, h?: number | undefined, premultipliedAlpha?: boolean | undefined, mipmap?: boolean | undefined): WebGLTexture;
|
|
28
28
|
/**
|
|
29
29
|
* delete the given WebGL texture
|
|
30
30
|
* @param {WebGLTexture} [texture] - a WebGL texture to delete
|
|
@@ -70,3 +70,4 @@ export default class QuadCompositor extends Compositor {
|
|
|
70
70
|
addQuad(texture: TextureAtlas, x: number, y: number, w: number, h: number, u0: number, v0: number, u1: number, v1: number, tint: number, reupload?: boolean): void;
|
|
71
71
|
}
|
|
72
72
|
import Compositor from "./compositor.js";
|
|
73
|
+
import type { TextureAtlas } from "./../../texture/atlas.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @classdesc
|
|
3
|
-
* a WebGL renderer
|
|
3
|
+
* a WebGL renderer object
|
|
4
4
|
* @augments Renderer
|
|
5
5
|
*/
|
|
6
6
|
export default class WebGLRenderer extends Renderer {
|
|
@@ -25,12 +25,21 @@ export default class WebGLRenderer extends Renderer {
|
|
|
25
25
|
*/
|
|
26
26
|
gl: WebGLRenderingContext;
|
|
27
27
|
/**
|
|
28
|
-
* sets or returns the thickness of lines for shape drawing (limited to strokeLine)
|
|
28
|
+
* sets or returns the thickness of lines for shape drawing (limited to strokeLine, strokePolygon and strokeRect)
|
|
29
29
|
* @type {number}
|
|
30
30
|
* @default 1
|
|
31
31
|
* @see WebGLRenderer#strokeLine
|
|
32
|
+
* @see WebGLRenderer#strokePolygon
|
|
33
|
+
* @see WebGLRenderer#strokeRect
|
|
32
34
|
*/
|
|
33
35
|
lineWidth: number;
|
|
36
|
+
/**
|
|
37
|
+
* sets or returns the shape used to join two line segments where they meet.
|
|
38
|
+
* Out of the three possible values for this property: "round", "bevel", and "miter", only "round" is supported for now in WebGL
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @default "round"
|
|
41
|
+
*/
|
|
42
|
+
lineJoin: string;
|
|
34
43
|
/**
|
|
35
44
|
* the vertex buffer used by this WebGL Renderer
|
|
36
45
|
* @type {WebGLBuffer}
|
|
@@ -65,9 +74,9 @@ export default class WebGLRenderer extends Renderer {
|
|
|
65
74
|
currentTransform: Matrix2d;
|
|
66
75
|
/**
|
|
67
76
|
* The current compositor used by the renderer
|
|
68
|
-
* @type {
|
|
77
|
+
* @type {Compositor}
|
|
69
78
|
*/
|
|
70
|
-
currentCompositor:
|
|
79
|
+
currentCompositor: Compositor;
|
|
71
80
|
/**
|
|
72
81
|
* a reference to the current shader program used by the renderer
|
|
73
82
|
* @type {WebGLProgram}
|
|
@@ -75,9 +84,9 @@ export default class WebGLRenderer extends Renderer {
|
|
|
75
84
|
currentProgram: WebGLProgram;
|
|
76
85
|
/**
|
|
77
86
|
* The list of active compositors
|
|
78
|
-
* @type {Map<
|
|
87
|
+
* @type {Map<Compositor>}
|
|
79
88
|
*/
|
|
80
|
-
compositors: Map<
|
|
89
|
+
compositors: Map<Compositor, any>;
|
|
81
90
|
depthTest: any;
|
|
82
91
|
customShader: any;
|
|
83
92
|
cache: TextureCache;
|
|
@@ -85,9 +94,8 @@ export default class WebGLRenderer extends Renderer {
|
|
|
85
94
|
* The WebGL version used by this renderer (1 or 2)
|
|
86
95
|
* @type {number}
|
|
87
96
|
* @default 1
|
|
88
|
-
* @readonly
|
|
89
97
|
*/
|
|
90
|
-
|
|
98
|
+
get WebGLVersion(): number;
|
|
91
99
|
/**
|
|
92
100
|
* return the list of supported compressed texture formats
|
|
93
101
|
* @return {Object}
|
|
@@ -130,11 +138,6 @@ export default class WebGLRenderer extends Renderer {
|
|
|
130
138
|
* let basic = renderer.createPattern(image, "no-repeat");
|
|
131
139
|
*/
|
|
132
140
|
createPattern(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | VideoFrame, repeat: string): TextureAtlas;
|
|
133
|
-
/**
|
|
134
|
-
* set/change the current projection matrix (WebGL only)
|
|
135
|
-
* @param {Matrix3d} matrix - the new projection matrix
|
|
136
|
-
*/
|
|
137
|
-
setProjection(matrix: Matrix3d): void;
|
|
138
141
|
/**
|
|
139
142
|
* Sets the WebGL viewport, which specifies the affine transformation of x and y from normalized device coordinates to window coordinates
|
|
140
143
|
* @param {number} [x = 0] - x the horizontal coordinate for the lower left corner of the viewport origin
|
|
@@ -236,12 +239,12 @@ export default class WebGLRenderer extends Renderer {
|
|
|
236
239
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [shape] - a shape object to stroke
|
|
237
240
|
* @param {boolean} [fill=false] - fill the shape with the current color if true
|
|
238
241
|
*/
|
|
239
|
-
stroke(shape?: Rect |
|
|
242
|
+
stroke(shape?: Rect | Polygon | Line | Ellipse | RoundRect | undefined, fill?: boolean | undefined): void;
|
|
240
243
|
/**
|
|
241
244
|
* fill the given shape or the current defined path
|
|
242
245
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [shape] - a shape object to fill
|
|
243
246
|
*/
|
|
244
|
-
fill(shape?: Rect |
|
|
247
|
+
fill(shape?: Rect | Polygon | Line | Ellipse | RoundRect | undefined): void;
|
|
245
248
|
/**
|
|
246
249
|
* add a straight line from the current point to the start of the current sub-path. If the shape has already been closed or has only one point, this function does nothing
|
|
247
250
|
*/
|
|
@@ -315,11 +318,6 @@ export default class WebGLRenderer extends Renderer {
|
|
|
315
318
|
* @param {number} y - Scaling factor in the vertical direction. A negative value flips pixels across the horizontal axis. A value of 1 results in no vertical scaling
|
|
316
319
|
*/
|
|
317
320
|
scale(x: number, y: number): void;
|
|
318
|
-
/**
|
|
319
|
-
* not used by this renderer?
|
|
320
|
-
* @ignore
|
|
321
|
-
*/
|
|
322
|
-
setAntiAlias(context: any, enable: any): void;
|
|
323
321
|
/**
|
|
324
322
|
* Set the global alpha
|
|
325
323
|
* @param {number} alpha - 0.0 to 1.0 values accepted.
|
|
@@ -391,7 +389,7 @@ export default class WebGLRenderer extends Renderer {
|
|
|
391
389
|
*/
|
|
392
390
|
fillLine(startX: number, startY: number, endX: number, endY: number): void;
|
|
393
391
|
/**
|
|
394
|
-
* Stroke a
|
|
392
|
+
* Stroke a Polygon on the screen with a specified color
|
|
395
393
|
* @param {Polygon} poly - the shape to draw
|
|
396
394
|
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
397
395
|
*/
|
|
@@ -492,6 +490,12 @@ export default class WebGLRenderer extends Renderer {
|
|
|
492
490
|
}
|
|
493
491
|
import Renderer from "./../renderer.js";
|
|
494
492
|
import Matrix2d from "./../../math/matrix2.js";
|
|
493
|
+
import type Compositor from "./compositors/compositor.js";
|
|
495
494
|
import TextureCache from "./../texture/cache.js";
|
|
496
495
|
import { TextureAtlas } from "./../texture/atlas.js";
|
|
497
496
|
import Color from "./../../math/color.js";
|
|
497
|
+
import type Rect from "./../../geometries/rectangle.js";
|
|
498
|
+
import type Polygon from "./../../geometries/poly.js";
|
|
499
|
+
import type Line from "./../../geometries/line.js";
|
|
500
|
+
import type Ellipse from "./../../geometries/ellipse.js";
|
|
501
|
+
import type RoundRect from "./../../geometries/roundrect.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "melonjs",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.4.0",
|
|
4
4
|
"description": "melonJS Game Engine",
|
|
5
5
|
"homepage": "http://www.melonjs.org/",
|
|
6
6
|
"type": "module",
|
|
@@ -57,35 +57,34 @@
|
|
|
57
57
|
"earcut": "2.2.4",
|
|
58
58
|
"eventemitter3": "^5.0.1",
|
|
59
59
|
"howler": "2.2.4",
|
|
60
|
-
"save-dev": "^0.0.1-security",
|
|
61
60
|
"semver": "^7.6.2",
|
|
62
61
|
"whatwg-fetch": "^3.6.20"
|
|
63
62
|
},
|
|
64
63
|
"devDependencies": {
|
|
65
64
|
"@fastify/static": "^7.0.4",
|
|
66
65
|
"@melonjs/webdoc-theme": "^1.1.1",
|
|
67
|
-
"@rollup/plugin-commonjs": "^
|
|
66
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
68
67
|
"@rollup/plugin-image": "^3.0.3",
|
|
69
68
|
"@rollup/plugin-json": "^6.1.0",
|
|
70
69
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
71
|
-
"@rollup/plugin-replace": "^5.0.
|
|
70
|
+
"@rollup/plugin-replace": "^5.0.7",
|
|
72
71
|
"@webdoc/cli": "^2.2.0",
|
|
73
|
-
"chromedriver": "^
|
|
72
|
+
"chromedriver": "^126.0.2",
|
|
74
73
|
"cross-env": "^7.0.3",
|
|
75
74
|
"del-cli": "^5.1.0",
|
|
76
|
-
"eslint": "^9.
|
|
77
|
-
"eslint-plugin-jsdoc": "^48.2.
|
|
75
|
+
"eslint": "^9.5.0",
|
|
76
|
+
"eslint-plugin-jsdoc": "^48.2.12",
|
|
78
77
|
"expect": "^29.7.0",
|
|
79
78
|
"expect-mocha-image-snapshot": "^3.0.16",
|
|
80
|
-
"fastify": "^4.
|
|
79
|
+
"fastify": "^4.28.0",
|
|
81
80
|
"mocha": "^10.4.0",
|
|
82
81
|
"npm-self-link": "^1.1.7",
|
|
83
|
-
"puppeteer": "^22.
|
|
82
|
+
"puppeteer": "^22.11.2",
|
|
84
83
|
"rollup": "^4.18.0",
|
|
85
84
|
"rollup-plugin-bundle-size": "^1.0.3",
|
|
86
85
|
"rollup-plugin-string": "^3.0.0",
|
|
87
|
-
"terser": "^5.31.
|
|
88
|
-
"typescript": "^5.
|
|
86
|
+
"terser": "^5.31.1",
|
|
87
|
+
"typescript": "^5.5.2"
|
|
89
88
|
},
|
|
90
89
|
"scripts": {
|
|
91
90
|
"build": "npm run lint && rollup -c --silent",
|
|
@@ -11,6 +11,12 @@ import { ApplicationSettings } from "./settings.js";
|
|
|
11
11
|
import { consoleHeader } from "./header.js";
|
|
12
12
|
import { CANVAS, WEBGL, AUTO } from "../const.js";
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* additional import for TypeScript
|
|
16
|
+
* @import WebGLRenderer from "./../video/webgl/webgl_renderer.js";
|
|
17
|
+
* @import Camera2d from "./../camera/camera2d.js";
|
|
18
|
+
*/
|
|
19
|
+
|
|
14
20
|
/**
|
|
15
21
|
* @classdesc
|
|
16
22
|
* An Application represents a single melonJS game, and is responsible for updating (each frame) all the related object status and draw them.
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as device from "./../system/device";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* additional import for TypeScript
|
|
5
|
+
* @import Application from "./application.js";
|
|
6
|
+
*/
|
|
7
|
+
|
|
3
8
|
/**
|
|
4
9
|
* scale the "displayed" canvas by the given scalar.
|
|
5
10
|
* this will modify the size of canvas element directly.
|
package/src/audio/audio.js
CHANGED
|
@@ -3,6 +3,11 @@ import {Howl, Howler} from "howler";
|
|
|
3
3
|
import {clamp} from "./../math/math.js";
|
|
4
4
|
import { isDataUrl } from "./../utils/string.js";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* additional import for TypeScript
|
|
8
|
+
* @import { Asset } from "./../loader/loader.js";
|
|
9
|
+
*/
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* @namespace audio
|
|
8
13
|
*/
|
|
@@ -136,7 +141,7 @@ export function disable() {
|
|
|
136
141
|
/**
|
|
137
142
|
* Load an audio file
|
|
138
143
|
* @memberof audio
|
|
139
|
-
* @param {
|
|
144
|
+
* @param {Asset} sound
|
|
140
145
|
* @param {Function} [onloadcb] - function to be called when the resource is loaded
|
|
141
146
|
* @param {Function} [onerrorcb] - function to be called in case of error
|
|
142
147
|
* @param {Object} [settings] - custom settings to apply to the request (@link https://developer.mozilla.org/en-US/docs/Web/API/fetch#options)
|
package/src/camera/camera2d.js
CHANGED
|
@@ -12,6 +12,13 @@ import Renderable from "./../renderable/renderable.js";
|
|
|
12
12
|
import {clamp, toBeCloseTo} from "./../math/math.js";
|
|
13
13
|
import { game } from "../index.js";
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* @import Bounds from "./../physics/bounds.js";
|
|
17
|
+
* @import Color from "./../math/color.js";
|
|
18
|
+
* @import Entity from "./../renderable/entity/entity.js";
|
|
19
|
+
* @import Sprite from "./../renderable/sprite.js";
|
|
20
|
+
* @import NineSliceSprite from "./../renderable/nineslicesprite.js";
|
|
21
|
+
*/
|
|
15
22
|
|
|
16
23
|
// some ref shortcut
|
|
17
24
|
const MIN = Math.min, MAX = Math.max;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import pool from "./../system/pooling.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* additional import for TypeScript
|
|
5
|
+
* @import Vector2d from "./../math/vector2.js";
|
|
6
|
+
* @import ObservableVector2d from "./../math/observable_vector2.js";
|
|
7
|
+
* @import Matrix2d from "./../math/matrix2.js";
|
|
8
|
+
* @import Bounds from "./../physics/bounds.js";
|
|
9
|
+
*/
|
|
10
|
+
|
|
3
11
|
/**
|
|
4
12
|
* @classdesc
|
|
5
13
|
* an ellipse Object
|
|
@@ -138,7 +146,7 @@ export default class Ellipse {
|
|
|
138
146
|
/**
|
|
139
147
|
* apply the given transformation matrix to this ellipse
|
|
140
148
|
* @param {Matrix2d} matrix - the transformation matrix
|
|
141
|
-
* @returns {
|
|
149
|
+
* @returns {Ellipse} Reference to this object for method chaining
|
|
142
150
|
*/
|
|
143
151
|
transform(matrix) { // eslint-disable-line no-unused-vars
|
|
144
152
|
// TODO
|
package/src/geometries/line.js
CHANGED
package/src/geometries/path2d.js
CHANGED
|
@@ -2,6 +2,12 @@ import pool from "./../system/pooling.js";
|
|
|
2
2
|
import { TAU } from "./../math/math.js";
|
|
3
3
|
import earcut from "earcut";
|
|
4
4
|
import { endpointToCenterParameterization } from "./toarccanvas.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* additional import for TypeScript
|
|
8
|
+
* @import Point from "./point.js";
|
|
9
|
+
*/
|
|
10
|
+
|
|
5
11
|
/**
|
|
6
12
|
* @classdesc
|
|
7
13
|
* a simplified path2d implementation, supporting only one path
|
package/src/geometries/point.js
CHANGED
package/src/geometries/poly.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import earcut from "earcut";
|
|
2
2
|
import pool from "./../system/pooling.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* additional import for TypeScript
|
|
6
|
+
* @import Vector2d from "./../math/vector2.js";
|
|
7
|
+
* @import ObservableVector2d from "./../math/observable_vector2.js";
|
|
8
|
+
* @import Matrix2d from "./../math/matrix2.js";
|
|
9
|
+
* @import Bounds from "./../physics/bounds.js";
|
|
10
|
+
*/
|
|
11
|
+
|
|
4
12
|
/**
|
|
5
13
|
* @classdesc
|
|
6
14
|
* a polygon Object.<br>
|
|
@@ -11,6 +11,10 @@ import Pointer from "./pointer.js";
|
|
|
11
11
|
import Rect from "./../geometries/rectangle.js";
|
|
12
12
|
import { game } from "../index.js";
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @import Vector2d from "./../math/vector2.js";
|
|
16
|
+
*/
|
|
17
|
+
|
|
14
18
|
/**
|
|
15
19
|
* A pool of `Pointer` objects to cache pointer/touch event coordinates.
|
|
16
20
|
* @type {Array.<Vector2d>}
|
package/src/loader/loader.js
CHANGED
|
@@ -256,7 +256,7 @@ function onResourceLoaded(res) {
|
|
|
256
256
|
|
|
257
257
|
/**
|
|
258
258
|
* on error callback for image loading
|
|
259
|
-
* @param {
|
|
259
|
+
* @param {Asset} asset - asset that loaded with failure
|
|
260
260
|
* @ignore
|
|
261
261
|
*/
|
|
262
262
|
function onLoadingError(res) {
|
|
@@ -270,7 +270,8 @@ function onLoadingError(res) {
|
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
272
|
* an asset definition to be used with the loader
|
|
273
|
-
* @typedef {object}
|
|
273
|
+
* @typedef {object} Asset
|
|
274
|
+
* @memberof loader
|
|
274
275
|
* @property {string} name - name of the asset
|
|
275
276
|
* @property {string} type - the type of the asset ("audio"|"binary"|"image"|"json"|"js"|"tmx"|"tmj"|"tsx"|"tsj"|"fontface"|"video")
|
|
276
277
|
* @property {string} [src] - path and/or file name of the resource (for audio assets only the path is required)
|
|
@@ -316,7 +317,7 @@ function onLoadingError(res) {
|
|
|
316
317
|
* @memberof loader
|
|
317
318
|
* @param {string} type - asset type
|
|
318
319
|
* @param {function} parserFn - parser function
|
|
319
|
-
* @see
|
|
320
|
+
* @see Asset.type
|
|
320
321
|
* @example
|
|
321
322
|
* // specify a custom function for "abc" format
|
|
322
323
|
* function customAbcParser(data, onload, onerror) {
|
|
@@ -347,7 +348,7 @@ export function setParser(type, parserFn) {
|
|
|
347
348
|
/**
|
|
348
349
|
* set all the specified game assets to be preloaded.
|
|
349
350
|
* @memberof loader
|
|
350
|
-
* @param {
|
|
351
|
+
* @param {Asset[]} assets - list of assets to load
|
|
351
352
|
* @param {Function} [onloadcb=loader.onload] - function to be called when all resources are loaded
|
|
352
353
|
* @param {boolean} [switchToLoadState=true] - automatically switch to the loading screen
|
|
353
354
|
* @example
|
|
@@ -442,7 +443,7 @@ export function reload(src) {
|
|
|
442
443
|
/**
|
|
443
444
|
* Load a single asset (to be used if you need to load additional asset(s) during the game)
|
|
444
445
|
* @memberof loader
|
|
445
|
-
* @param {
|
|
446
|
+
* @param {Asset} asset
|
|
446
447
|
* @param {Function} [onload] - function to be called when the asset is loaded
|
|
447
448
|
* @param {Function} [onerror] - function to be called in case of error
|
|
448
449
|
* @returns {number} the amount of corresponding resource to be preloaded
|
|
@@ -495,7 +496,7 @@ export function load(asset, onload, onerror) {
|
|
|
495
496
|
/**
|
|
496
497
|
* unload the specified asset to free memory
|
|
497
498
|
* @memberof loader
|
|
498
|
-
* @param {
|
|
499
|
+
* @param {Asset} asset
|
|
499
500
|
* @returns {boolean} true if unloaded
|
|
500
501
|
* @example me.loader.unload({name: "avatar", type:"image"});
|
|
501
502
|
*/
|
package/src/math/matrix2.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import pool from "./../system/pooling.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* additional import for TypeScript
|
|
5
|
+
* @import Matrix3d from "./matrix3.js";
|
|
6
|
+
* @import Vector2d from "./vector2.js";
|
|
7
|
+
* @import Vector3d from "./vector3.js";
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
3
11
|
/**
|
|
4
12
|
* @classdesc
|
|
5
13
|
* a Matrix2d Object.<br>
|
package/src/math/matrix3.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import pool from "./../system/pooling.js";
|
|
2
2
|
import { EPSILON } from "./math.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* additional import for TypeScript
|
|
6
|
+
* @import Matrix2d from "./matrix2.js";
|
|
7
|
+
* @import Vector2d from "./vector2.js";
|
|
8
|
+
* @import Vector3d from "./vector3.js";
|
|
9
|
+
*/
|
|
10
|
+
|
|
4
11
|
/**
|
|
5
12
|
* @classdesc
|
|
6
13
|
* a 4x4 Matrix3d Object
|
|
@@ -2,6 +2,12 @@ import Vector3d from "./vector3.js";
|
|
|
2
2
|
import {clamp} from "./math.js";
|
|
3
3
|
import pool from "./../system/pooling.js";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* additional import for TypeScript
|
|
7
|
+
* @import ObservableVector2d from "./observable_vector2.js";
|
|
8
|
+
* @import Vector2d from "./vector2.js";
|
|
9
|
+
*/
|
|
10
|
+
|
|
5
11
|
/**
|
|
6
12
|
* @classdesc
|
|
7
13
|
* A Vector3d object that provide notification by executing the given callback when the vector is changed.
|
package/src/math/vector2.js
CHANGED
|
@@ -242,7 +242,7 @@ export default class Vector2d {
|
|
|
242
242
|
|
|
243
243
|
/**
|
|
244
244
|
* return true if this vector is equal to the given values or vector
|
|
245
|
-
* @param {number|Vector2d
|
|
245
|
+
* @param {number|Vector2d} x
|
|
246
246
|
* @param {number} [y]
|
|
247
247
|
* @returns {boolean}
|
|
248
248
|
*/
|
|
@@ -278,7 +278,7 @@ export default class Vector2d {
|
|
|
278
278
|
/**
|
|
279
279
|
* Rotate this vector (counter-clockwise) by the specified angle (in radians).
|
|
280
280
|
* @param {number} angle - The angle to rotate (in radians)
|
|
281
|
-
* @param {Vector2d
|
|
281
|
+
* @param {Vector2d} [v] - an optional point to rotate around
|
|
282
282
|
* @returns {Vector2d} Reference to this object for method chaining
|
|
283
283
|
*/
|
|
284
284
|
rotate(angle, v) {
|
package/src/math/vector3.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {clamp} from "./math.js";
|
|
2
2
|
import pool from "./../system/pooling.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* additional import for TypeScript
|
|
6
|
+
* @import Vector2d from "./vector2.js";
|
|
7
|
+
*/
|
|
8
|
+
|
|
4
9
|
/**
|
|
5
10
|
* @classdesc
|
|
6
11
|
* a generic 3D Vector Object
|
|
@@ -257,10 +262,10 @@ export default class Vector3d {
|
|
|
257
262
|
|
|
258
263
|
/**
|
|
259
264
|
* return true if this vector is equal to the given values or vector
|
|
260
|
-
* @param {number|Vector2d|
|
|
265
|
+
* @param {number|Vector2d|Vector3d} x
|
|
261
266
|
* @param {number} [y]
|
|
262
267
|
* @param {number} [z]
|
|
263
|
-
* @returns {boolean}
|
|
268
|
+
* @returns {boolean} true if both vectros are equals
|
|
264
269
|
*/
|
|
265
270
|
equals(...args) {
|
|
266
271
|
let _x, _y, _z;
|
|
@@ -299,7 +304,7 @@ export default class Vector3d {
|
|
|
299
304
|
/**
|
|
300
305
|
* Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis
|
|
301
306
|
* @param {number} angle - The angle to rotate (in radians)
|
|
302
|
-
* @param {Vector2d
|
|
307
|
+
* @param {Vector2d} [v] - an optional point to rotate around (on the same z axis)
|
|
303
308
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
304
309
|
*/
|
|
305
310
|
rotate(angle, v) {
|
|
@@ -3,6 +3,10 @@ import timer from "./../system/timer.js";
|
|
|
3
3
|
import { randomFloat, clamp } from "./../math/math.js";
|
|
4
4
|
import Renderable from "./../renderable/renderable.js";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @import ParticleEmitter from "./emitter.js";
|
|
8
|
+
*/
|
|
9
|
+
|
|
6
10
|
/**
|
|
7
11
|
* @classdesc
|
|
8
12
|
* Single Particle Object.
|
package/src/physics/body.js
CHANGED
|
@@ -9,6 +9,17 @@ import timer from "./../system/timer.js";
|
|
|
9
9
|
import { clamp } from "./../math/math.js";
|
|
10
10
|
import Point from "../geometries/point.js";
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @import Entity from "./../renderable/entity/entity.js";
|
|
14
|
+
* @import Container from "./../renderable/container.js";
|
|
15
|
+
* @import Renderable from "./../renderable/renderable.js";
|
|
16
|
+
* @import Sprite from "./../renderable/sprite.js";
|
|
17
|
+
* @import NineSliceSprite from "./../renderable/nineslicesprite.js";
|
|
18
|
+
* @import Line from "./../geometries/line.js";
|
|
19
|
+
* @import Vector2d from "./../math/vector2.js";
|
|
20
|
+
* @import ObservableVector2d from "./../math/observable_vector2.js";
|
|
21
|
+
**/
|
|
22
|
+
|
|
12
23
|
/**
|
|
13
24
|
* @classdesc
|
|
14
25
|
* a Generic Physic Body Object with some physic properties and behavior functionality, to add as a member of a Renderable.
|
package/src/physics/bounds.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import pool from "./../system/pooling.js";
|
|
2
2
|
import Vector2d from "./../math/vector2.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import Point from "./../geometries/point.js";
|
|
6
|
+
* @import Rect from "./../geometries/rectangle.js";
|
|
7
|
+
* @import Polygon from "./../geometries/poly.js";
|
|
8
|
+
**/
|
|
9
|
+
|
|
4
10
|
/**
|
|
5
11
|
* @classdesc
|
|
6
12
|
* a bound object contains methods for creating and manipulating axis-aligned bounding boxes (AABB).
|
package/src/physics/collision.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { game } from "../index.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @import Line from "./../geometries/line.js";
|
|
5
|
+
* @import Renderable from "./../renderable/renderable.js";
|
|
6
|
+
**/
|
|
7
|
+
|
|
3
8
|
/**
|
|
4
9
|
* Collision detection (and projection-based collision response) of 2D shapes.<br>
|
|
5
10
|
* Based on the Separating Axis Theorem and supports detecting collisions between simple Axis-Aligned Boxes, convex polygons and circles based shapes.
|
package/src/physics/detector.js
CHANGED
|
@@ -3,6 +3,15 @@ import ResponseObject from "./response.js";
|
|
|
3
3
|
import Vector2d from "./../math/vector2.js";
|
|
4
4
|
import Bounds from "./bounds.js";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @import Entity from "./../renderable/entity/entity.js";
|
|
8
|
+
* @import Container from "./../renderable/container.js";
|
|
9
|
+
* @import Renderable from "./../renderable/renderable.js";
|
|
10
|
+
* @import Sprite from "./../renderable/sprite.js";
|
|
11
|
+
* @import NineSliceSprite from "./../renderable/nineslicesprite.js";
|
|
12
|
+
* @import Line from "./../geometries/line.js";
|
|
13
|
+
*/
|
|
14
|
+
|
|
6
15
|
// a dummy object when using Line for raycasting
|
|
7
16
|
let dummyObj = {
|
|
8
17
|
pos : new Vector2d(0, 0),
|
package/src/physics/quadtree.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import Vector2d from "./../math/vector2.js";
|
|
2
2
|
import * as arrayUtil from "./../utils/array.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import World from "./world.js";
|
|
6
|
+
* @import Container from "./../renderable/container.js";
|
|
7
|
+
* @import Bounds from "./bounds.js";
|
|
8
|
+
*/
|
|
9
|
+
|
|
4
10
|
/*
|
|
5
11
|
* A QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
|
|
6
12
|
* Based on the QuadTree Library by Timo Hausmann and released under the MIT license
|