melonjs 15.3.0 → 15.4.1
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/application/application.js +53 -5
- package/dist/melonjs.mjs/application/header.js +2 -2
- package/dist/melonjs.mjs/application/resize.js +4 -8
- package/dist/melonjs.mjs/application/settings.js +5 -5
- package/dist/melonjs.mjs/audio/audio.js +4 -6
- package/dist/melonjs.mjs/camera/camera2d.js +12 -14
- package/dist/melonjs.mjs/const.js +1 -1
- package/dist/melonjs.mjs/entity/entity.js +3 -4
- package/dist/melonjs.mjs/geometries/ellipse.js +26 -59
- package/dist/melonjs.mjs/geometries/line.js +18 -25
- package/dist/melonjs.mjs/geometries/path2d.js +16 -13
- package/dist/melonjs.mjs/geometries/point.js +8 -16
- package/dist/melonjs.mjs/geometries/poly.js +40 -97
- package/dist/melonjs.mjs/geometries/rectangle.js +37 -91
- package/dist/melonjs.mjs/geometries/roundrect.js +26 -35
- package/dist/melonjs.mjs/index.js +6 -6
- 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 +3 -3
- package/dist/melonjs.mjs/input/pointer.js +4 -4
- package/dist/melonjs.mjs/input/pointerevent.js +6 -7
- package/dist/melonjs.mjs/lang/console.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +2 -2
- 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 +16 -33
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +3 -4
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +4 -4
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +3 -3
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +4 -7
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +2 -2
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +26 -29
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +3 -3
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +2 -2
- 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 +1 -1
- 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/parser.js +4 -5
- package/dist/melonjs.mjs/loader/settings.js +1 -1
- package/dist/melonjs.mjs/math/color.js +2 -2
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +5 -59
- package/dist/melonjs.mjs/math/matrix3.js +82 -141
- package/dist/melonjs.mjs/math/observable_vector2.js +7 -7
- package/dist/melonjs.mjs/math/observable_vector3.js +5 -5
- package/dist/melonjs.mjs/math/vector2.js +7 -91
- package/dist/melonjs.mjs/math/vector3.js +6 -90
- 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/particles/emitter.js +2 -2
- package/dist/melonjs.mjs/particles/particle.js +2 -2
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +22 -20
- package/dist/melonjs.mjs/physics/bounds.js +27 -33
- package/dist/melonjs.mjs/physics/collision.js +5 -5
- package/dist/melonjs.mjs/physics/detector.js +10 -10
- package/dist/melonjs.mjs/physics/quadtree.js +5 -5
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +3 -4
- package/dist/melonjs.mjs/physics/world.js +6 -9
- package/dist/melonjs.mjs/plugin/plugin.js +3 -3
- package/dist/melonjs.mjs/renderable/collectable.js +2 -2
- package/dist/melonjs.mjs/renderable/colorlayer.js +4 -4
- package/dist/melonjs.mjs/renderable/container.js +25 -25
- package/dist/melonjs.mjs/renderable/draggable.js +1 -1
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +4 -4
- package/dist/melonjs.mjs/renderable/light2d.js +3 -3
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +2 -2
- package/dist/melonjs.mjs/renderable/renderable.js +26 -26
- package/dist/melonjs.mjs/renderable/sprite.js +3 -3
- package/dist/melonjs.mjs/renderable/text/bitmaptext.js +421 -0
- package/dist/melonjs.mjs/renderable/text/bitmaptextdata.js +195 -0
- package/dist/melonjs.mjs/renderable/text/glyph.js +65 -0
- package/dist/melonjs.mjs/renderable/text/text.js +422 -0
- package/dist/melonjs.mjs/renderable/text/textmetrics.js +175 -0
- package/dist/melonjs.mjs/renderable/text/textstyle.js +21 -0
- package/dist/melonjs.mjs/renderable/trigger.js +10 -10
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +7 -7
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +7 -7
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +3 -3
- package/dist/melonjs.mjs/state/stage.js +2 -2
- package/dist/melonjs.mjs/state/state.js +1 -38
- package/dist/melonjs.mjs/system/device.js +49 -10
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +24 -2
- package/dist/melonjs.mjs/system/platform.js +18 -18
- package/dist/melonjs.mjs/system/pooling.js +10 -10
- package/dist/melonjs.mjs/system/save.js +1 -1
- package/dist/melonjs.mjs/system/timer.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptextdata.js +3 -6
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +1 -1
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +2 -2
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +2 -3
- 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 +3 -7
- package/dist/melonjs.mjs/video/renderer.js +16 -16
- package/dist/melonjs.mjs/video/texture/atlas.js +13 -13
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +15 -15
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +4 -4
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +3 -3
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +13 -14
- package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +5 -5
- package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +2 -3
- package/dist/melonjs.mjs/video/webgl/glshader.js +2 -2
- 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 +4 -4
- 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 +50 -52
- package/dist/melonjs.module.js +1137 -1576
- package/dist/types/application/application.d.ts +28 -4
- package/dist/types/application/header.d.ts +2 -2
- package/dist/types/application/settings.d.ts +23 -23
- package/dist/types/audio/audio.d.ts +3 -5
- package/dist/types/camera/camera2d.d.ts +13 -16
- package/dist/types/entity/entity.d.ts +0 -1
- package/dist/types/geometries/ellipse.d.ts +18 -50
- package/dist/types/geometries/path2d.d.ts +1 -1
- package/dist/types/geometries/point.d.ts +5 -13
- package/dist/types/geometries/poly.d.ts +26 -75
- package/dist/types/geometries/rectangle.d.ts +12 -58
- package/dist/types/geometries/roundrect.d.ts +2 -11
- package/dist/types/index.d.ts +3 -3
- package/dist/types/input/gamepad.d.ts +31 -31
- package/dist/types/input/keyboard.d.ts +105 -105
- package/dist/types/input/pointer.d.ts +21 -21
- package/dist/types/input/pointerevent.d.ts +6 -6
- package/dist/types/level/tiled/TMXLayer.d.ts +1 -1
- package/dist/types/math/matrix2.d.ts +9 -63
- package/dist/types/math/matrix3.d.ts +9 -68
- package/dist/types/math/observable_vector2.d.ts +2 -2
- package/dist/types/math/observable_vector3.d.ts +2 -2
- package/dist/types/math/vector2.d.ts +8 -92
- package/dist/types/math/vector3.d.ts +8 -92
- package/dist/types/particles/settings.d.ts +29 -29
- package/dist/types/physics/body.d.ts +10 -8
- package/dist/types/physics/bounds.d.ts +24 -30
- package/dist/types/physics/collision.d.ts +12 -12
- package/dist/types/physics/detector.d.ts +1 -1
- package/dist/types/physics/world.d.ts +4 -7
- package/dist/types/renderable/container.d.ts +19 -19
- package/dist/types/renderable/imagelayer.d.ts +6 -6
- package/dist/types/renderable/light2d.d.ts +7 -7
- package/dist/types/renderable/renderable.d.ts +9 -16
- package/dist/types/renderable/text/bitmaptext.d.ts +151 -0
- package/dist/types/renderable/text/bitmaptextdata.d.ts +35 -0
- package/dist/types/renderable/text/glyph.d.ts +28 -0
- package/dist/types/renderable/text/text.d.ts +159 -0
- package/dist/types/renderable/text/textmetrics.d.ts +47 -0
- package/dist/types/renderable/text/textstyle.d.ts +5 -0
- package/dist/types/renderable/ui/uibaseelement.d.ts +0 -1
- package/dist/types/renderable/ui/uispriteelement.d.ts +0 -1
- package/dist/types/renderable/ui/uitextbutton.d.ts +2 -7
- package/dist/types/state/state.d.ts +11 -11
- package/dist/types/system/device.d.ts +15 -9
- package/dist/types/system/event.d.ts +20 -0
- package/dist/types/system/platform.d.ts +17 -17
- package/dist/types/utils/function.d.ts +1 -2
- package/dist/types/video/renderer.d.ts +13 -13
- package/dist/types/video/texture/canvas_texture.d.ts +14 -14
- package/dist/types/video/video.d.ts +2 -2
- package/dist/types/video/webgl/buffer/vertex.d.ts +2 -2
- package/dist/types/video/webgl/compositors/compositor.d.ts +24 -13
- package/dist/types/video/webgl/compositors/primitive_compositor.d.ts +0 -1
- package/dist/types/video/webgl/compositors/quad_compositor.d.ts +0 -1
- package/dist/types/video/webgl/utils/precision.d.ts +1 -1
- package/dist/types/video/webgl/webgl_renderer.d.ts +47 -50
- package/package.json +15 -15
- package/src/application/application.js +51 -3
- package/src/application/header.js +1 -1
- package/src/application/resize.js +3 -7
- package/src/application/settings.js +4 -4
- package/src/audio/audio.js +3 -5
- package/src/camera/camera2d.js +11 -13
- package/src/entity/entity.js +2 -3
- package/src/geometries/ellipse.js +25 -58
- package/src/geometries/line.js +17 -24
- package/src/geometries/path2d.js +15 -12
- package/src/geometries/point.js +7 -15
- package/src/geometries/poly.js +39 -96
- package/src/geometries/rectangle.js +36 -90
- package/src/geometries/roundrect.js +25 -34
- package/src/index.js +4 -4
- package/src/input/keyboard.js +2 -2
- package/src/input/pointer.js +3 -3
- package/src/input/pointerevent.js +5 -6
- package/src/lang/deprecated.js +1 -1
- package/src/level/tiled/TMXLayer.js +15 -32
- package/src/level/tiled/TMXObject.js +2 -3
- package/src/level/tiled/TMXTile.js +3 -3
- package/src/level/tiled/TMXTileMap.js +2 -2
- package/src/level/tiled/TMXTileset.js +3 -6
- package/src/level/tiled/TMXTilesetGroup.js +1 -1
- package/src/level/tiled/TMXUtils.js +25 -28
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/src/loader/parser.js +3 -4
- package/src/math/color.js +1 -1
- package/src/math/matrix2.js +4 -58
- package/src/math/matrix3.js +81 -140
- package/src/math/observable_vector2.js +6 -6
- package/src/math/observable_vector3.js +4 -4
- package/src/math/vector2.js +6 -90
- package/src/math/vector3.js +5 -89
- package/src/particles/emitter.js +1 -1
- package/src/particles/particle.js +1 -1
- package/src/physics/body.js +21 -19
- package/src/physics/bounds.js +26 -32
- package/src/physics/collision.js +4 -4
- package/src/physics/detector.js +9 -9
- package/src/physics/quadtree.js +4 -4
- package/src/physics/sat.js +2 -3
- package/src/physics/world.js +5 -8
- package/src/polyfill/roundrect.js +163 -163
- package/src/renderable/collectable.js +1 -1
- package/src/renderable/colorlayer.js +3 -3
- package/src/renderable/container.js +24 -24
- package/src/renderable/imagelayer.js +3 -3
- package/src/renderable/light2d.js +2 -2
- package/src/renderable/nineslicesprite.js +1 -1
- package/src/renderable/renderable.js +25 -25
- package/src/renderable/sprite.js +2 -2
- package/src/{text → renderable/text}/bitmaptext.js +8 -8
- package/src/{text → renderable/text}/bitmaptextdata.js +4 -7
- package/src/{text → renderable/text}/glyph.js +1 -1
- package/src/{text → renderable/text}/text.js +16 -17
- package/src/{text → renderable/text}/textmetrics.js +2 -2
- package/src/renderable/trigger.js +9 -9
- package/src/renderable/ui/uibaseelement.js +6 -6
- package/src/renderable/ui/uispriteelement.js +6 -6
- package/src/renderable/ui/uitextbutton.js +2 -2
- package/src/state/stage.js +1 -1
- package/src/state/state.js +0 -49
- package/src/system/device.js +48 -9
- package/src/system/event.js +22 -0
- package/src/system/platform.js +18 -18
- package/src/system/pooling.js +9 -9
- package/src/tweens/tween.js +1 -1
- package/src/utils/function.js +1 -2
- package/src/video/canvas/canvas_renderer.js +2 -6
- package/src/video/renderer.js +15 -15
- package/src/video/texture/atlas.js +12 -12
- package/src/video/texture/canvas_texture.js +14 -14
- package/src/video/video.js +3 -3
- package/src/video/webgl/buffer/vertex.js +2 -2
- package/src/video/webgl/compositors/compositor.js +12 -13
- package/src/video/webgl/compositors/primitive_compositor.js +4 -4
- package/src/video/webgl/compositors/quad_compositor.js +1 -2
- package/src/video/webgl/glshader.js +1 -1
- package/src/video/webgl/utils/precision.js +3 -3
- package/src/video/webgl/webgl_renderer.js +49 -51
- /package/src/{text → renderable/text}/textstyle.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -13,7 +13,7 @@ import Polygon from './poly.js';
|
|
|
13
13
|
* a rectangle Object
|
|
14
14
|
* @augments Polygon
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
class Rect extends Polygon {
|
|
17
17
|
/**
|
|
18
18
|
* @param {number} x - position of the Rectangle
|
|
19
19
|
* @param {number} y - position of the Rectangle
|
|
@@ -38,8 +38,6 @@ import Polygon from './poly.js';
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* set new value to the rectangle shape
|
|
41
|
-
* @name setShape
|
|
42
|
-
* @memberof Rect
|
|
43
41
|
* @param {number} x - position of the Rectangle
|
|
44
42
|
* @param {number} y - position of the Rectangle
|
|
45
43
|
* @param {number|Vector2d[]} w - width of the rectangle, or an array of vector defining the rectangle
|
|
@@ -66,10 +64,7 @@ import Polygon from './poly.js';
|
|
|
66
64
|
|
|
67
65
|
/**
|
|
68
66
|
* left coordinate of the Rectangle
|
|
69
|
-
* @public
|
|
70
67
|
* @type {number}
|
|
71
|
-
* @name left
|
|
72
|
-
* @memberof Rect
|
|
73
68
|
*/
|
|
74
69
|
get left() {
|
|
75
70
|
return this.pos.x;
|
|
@@ -77,10 +72,7 @@ import Polygon from './poly.js';
|
|
|
77
72
|
|
|
78
73
|
/**
|
|
79
74
|
* right coordinate of the Rectangle
|
|
80
|
-
* @public
|
|
81
75
|
* @type {number}
|
|
82
|
-
* @name right
|
|
83
|
-
* @memberof Rect
|
|
84
76
|
*/
|
|
85
77
|
get right() {
|
|
86
78
|
let w = this.width;
|
|
@@ -89,10 +81,7 @@ import Polygon from './poly.js';
|
|
|
89
81
|
|
|
90
82
|
/**
|
|
91
83
|
* top coordinate of the Rectangle
|
|
92
|
-
* @public
|
|
93
84
|
* @type {number}
|
|
94
|
-
* @name top
|
|
95
|
-
* @memberof Rect
|
|
96
85
|
*/
|
|
97
86
|
get top() {
|
|
98
87
|
return this.pos.y;
|
|
@@ -100,10 +89,7 @@ import Polygon from './poly.js';
|
|
|
100
89
|
|
|
101
90
|
/**
|
|
102
91
|
* bottom coordinate of the Rectangle
|
|
103
|
-
* @public
|
|
104
92
|
* @type {number}
|
|
105
|
-
* @name bottom
|
|
106
|
-
* @memberof Rect
|
|
107
93
|
*/
|
|
108
94
|
get bottom() {
|
|
109
95
|
let h = this.height;
|
|
@@ -112,10 +98,7 @@ import Polygon from './poly.js';
|
|
|
112
98
|
|
|
113
99
|
/**
|
|
114
100
|
* width of the Rectangle
|
|
115
|
-
* @public
|
|
116
101
|
* @type {number}
|
|
117
|
-
* @name width
|
|
118
|
-
* @memberof Rect
|
|
119
102
|
*/
|
|
120
103
|
get width() {
|
|
121
104
|
return this.points[2].x;
|
|
@@ -128,10 +111,7 @@ import Polygon from './poly.js';
|
|
|
128
111
|
|
|
129
112
|
/**
|
|
130
113
|
* height of the Rectangle
|
|
131
|
-
* @public
|
|
132
114
|
* @type {number}
|
|
133
|
-
* @name height
|
|
134
|
-
* @memberof Rect
|
|
135
115
|
*/
|
|
136
116
|
get height() {
|
|
137
117
|
return this.points[2].y;
|
|
@@ -144,10 +124,7 @@ import Polygon from './poly.js';
|
|
|
144
124
|
|
|
145
125
|
/**
|
|
146
126
|
* absolute center of this rectangle on the horizontal axis
|
|
147
|
-
* @public
|
|
148
127
|
* @type {number}
|
|
149
|
-
* @name centerX
|
|
150
|
-
* @memberof Rect
|
|
151
128
|
*/
|
|
152
129
|
get centerX() {
|
|
153
130
|
if (isFinite(this.width)) {
|
|
@@ -164,10 +141,7 @@ import Polygon from './poly.js';
|
|
|
164
141
|
|
|
165
142
|
/**
|
|
166
143
|
* absolute center of this rectangle on the vertical axis
|
|
167
|
-
* @public
|
|
168
144
|
* @type {number}
|
|
169
|
-
* @name centerY
|
|
170
|
-
* @memberof Rect
|
|
171
145
|
*/
|
|
172
146
|
get centerY() {
|
|
173
147
|
if (isFinite(this.height)) {
|
|
@@ -184,8 +158,6 @@ import Polygon from './poly.js';
|
|
|
184
158
|
|
|
185
159
|
/**
|
|
186
160
|
* center the rectangle position around the given coordinates
|
|
187
|
-
* @name centerOn
|
|
188
|
-
* @memberof Rect
|
|
189
161
|
* @param {number} x - the x coordinate around which to center this rectangle
|
|
190
162
|
* @param {number} y - the y coordinate around which to center this rectangle
|
|
191
163
|
* @returns {Rect} this rectangle
|
|
@@ -198,8 +170,6 @@ import Polygon from './poly.js';
|
|
|
198
170
|
|
|
199
171
|
/**
|
|
200
172
|
* resize the rectangle
|
|
201
|
-
* @name resize
|
|
202
|
-
* @memberof Rect
|
|
203
173
|
* @param {number} w - new width of the rectangle
|
|
204
174
|
* @param {number} h - new height of the rectangle
|
|
205
175
|
* @returns {Rect} this rectangle
|
|
@@ -212,8 +182,6 @@ import Polygon from './poly.js';
|
|
|
212
182
|
|
|
213
183
|
/**
|
|
214
184
|
* scale the rectangle
|
|
215
|
-
* @name scale
|
|
216
|
-
* @memberof Rect
|
|
217
185
|
* @param {number} x - a number representing the abscissa of the scaling vector.
|
|
218
186
|
* @param {number} [y=x] - a number representing the ordinate of the scaling vector.
|
|
219
187
|
* @returns {Rect} this rectangle
|
|
@@ -226,8 +194,6 @@ import Polygon from './poly.js';
|
|
|
226
194
|
|
|
227
195
|
/**
|
|
228
196
|
* clone this rectangle
|
|
229
|
-
* @name clone
|
|
230
|
-
* @memberof Rect
|
|
231
197
|
* @returns {Rect} new rectangle
|
|
232
198
|
*/
|
|
233
199
|
clone() {
|
|
@@ -236,8 +202,6 @@ import Polygon from './poly.js';
|
|
|
236
202
|
|
|
237
203
|
/**
|
|
238
204
|
* copy the position and size of the given rectangle into this one
|
|
239
|
-
* @name copy
|
|
240
|
-
* @memberof Rect
|
|
241
205
|
* @param {Rect} rect - Source rectangle
|
|
242
206
|
* @returns {Rect} new rectangle
|
|
243
207
|
*/
|
|
@@ -247,8 +211,6 @@ import Polygon from './poly.js';
|
|
|
247
211
|
|
|
248
212
|
/**
|
|
249
213
|
* merge this rectangle with another one
|
|
250
|
-
* @name union
|
|
251
|
-
* @memberof Rect
|
|
252
214
|
* @param {Rect} rect - other rectangle to union with
|
|
253
215
|
* @returns {Rect} the union(ed) rectangle
|
|
254
216
|
*/
|
|
@@ -268,8 +230,6 @@ import Polygon from './poly.js';
|
|
|
268
230
|
|
|
269
231
|
/**
|
|
270
232
|
* check if this rectangle is intersecting with the specified one
|
|
271
|
-
* @name overlaps
|
|
272
|
-
* @memberof Rect
|
|
273
233
|
* @param {Rect} rect
|
|
274
234
|
* @returns {boolean} true if overlaps
|
|
275
235
|
*/
|
|
@@ -283,63 +243,53 @@ import Polygon from './poly.js';
|
|
|
283
243
|
}
|
|
284
244
|
|
|
285
245
|
/**
|
|
286
|
-
* Returns true if the rectangle contains the given rectangle
|
|
287
|
-
* @
|
|
288
|
-
* @
|
|
289
|
-
* @
|
|
290
|
-
* @
|
|
291
|
-
*
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* @returns {boolean} true if contains
|
|
302
|
-
*/
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Returns true if the rectangle contains the given point
|
|
306
|
-
* @name contains
|
|
307
|
-
* @memberof Rect
|
|
308
|
-
* @param {Vector2d} point
|
|
309
|
-
* @returns {boolean} true if contains
|
|
246
|
+
* Returns true if the rectangle contains the given point or rectangle
|
|
247
|
+
* @param {number|Vector2d|Rect} x - x coordinate or a vector point, or a rectangle to test
|
|
248
|
+
* @param {number} [y] - y coordinate
|
|
249
|
+
* @returns {boolean} True if the rectangle contain the given point or rectangle, otherwise false
|
|
250
|
+
* @example
|
|
251
|
+
* if (rect.contains(10, 10)) {
|
|
252
|
+
* // do something
|
|
253
|
+
* }
|
|
254
|
+
* // or
|
|
255
|
+
* if (rect.contains(myVector2d)) {
|
|
256
|
+
* // do something
|
|
257
|
+
* }
|
|
258
|
+
* if (rect.contains(myRect)) {
|
|
259
|
+
* // do something
|
|
260
|
+
* }
|
|
310
261
|
*/
|
|
311
262
|
contains() {
|
|
312
263
|
let arg0 = arguments[0];
|
|
313
264
|
let _x1, _x2, _y1, _y2;
|
|
314
265
|
if (arguments.length === 2) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
266
|
+
// x, y
|
|
267
|
+
_x1 = _x2 = arg0;
|
|
268
|
+
_y1 = _y2 = arguments[1];
|
|
269
|
+
} else {
|
|
270
|
+
// only Rect based objects define a top and bottom properties
|
|
271
|
+
if (typeof arg0.bottom === "number") {
|
|
272
|
+
// me.Rect
|
|
273
|
+
_x1 = arg0.left;
|
|
274
|
+
_x2 = arg0.right;
|
|
275
|
+
_y1 = arg0.top;
|
|
276
|
+
_y2 = arg0.bottom;
|
|
277
|
+
} else {
|
|
278
|
+
// vector
|
|
279
|
+
_x1 = _x2 = arg0.x;
|
|
280
|
+
_y1 = _y2 = arg0.y;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return (
|
|
284
|
+
_x1 >= this.left &&
|
|
333
285
|
_x2 <= this.right &&
|
|
334
286
|
_y1 >= this.top &&
|
|
335
287
|
_y2 <= this.bottom
|
|
336
|
-
|
|
288
|
+
);
|
|
337
289
|
}
|
|
338
290
|
|
|
339
291
|
/**
|
|
340
292
|
* check if this rectangle is identical to the specified one
|
|
341
|
-
* @name equals
|
|
342
|
-
* @memberof Rect
|
|
343
293
|
* @param {Rect} rect
|
|
344
294
|
* @returns {boolean} true if equals
|
|
345
295
|
*/
|
|
@@ -354,8 +304,6 @@ import Polygon from './poly.js';
|
|
|
354
304
|
|
|
355
305
|
/**
|
|
356
306
|
* determines whether all coordinates of this rectangle are finite numbers.
|
|
357
|
-
* @name isFinite
|
|
358
|
-
* @memberof Rect
|
|
359
307
|
* @returns {boolean} false if all coordinates are positive or negative Infinity or NaN; otherwise, true.
|
|
360
308
|
*/
|
|
361
309
|
isFinite() {
|
|
@@ -364,8 +312,6 @@ import Polygon from './poly.js';
|
|
|
364
312
|
|
|
365
313
|
/**
|
|
366
314
|
* Returns a polygon whose edges are the same as this box.
|
|
367
|
-
* @name toPolygon
|
|
368
|
-
* @memberof Rect
|
|
369
315
|
* @returns {Polygon} a new Polygon that represents this rectangle.
|
|
370
316
|
*/
|
|
371
317
|
toPolygon() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -39,11 +39,8 @@ class RoundRect extends Rect {
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* the radius of the rounded corner
|
|
42
|
-
* @public
|
|
43
42
|
* @type {number}
|
|
44
43
|
* @default 20
|
|
45
|
-
* @name radius
|
|
46
|
-
* @memberof RoundRect
|
|
47
44
|
*/
|
|
48
45
|
get radius() {
|
|
49
46
|
return this._radius;
|
|
@@ -61,8 +58,6 @@ class RoundRect extends Rect {
|
|
|
61
58
|
|
|
62
59
|
/**
|
|
63
60
|
* copy the position, size and radius of the given rounded rectangle into this one
|
|
64
|
-
* @name copy
|
|
65
|
-
* @memberof RoundRect
|
|
66
61
|
* @param {RoundRect} rrect - source rounded rectangle
|
|
67
62
|
* @returns {RoundRect} new rectangle
|
|
68
63
|
*/
|
|
@@ -73,38 +68,38 @@ class RoundRect extends Rect {
|
|
|
73
68
|
}
|
|
74
69
|
|
|
75
70
|
/**
|
|
76
|
-
* Returns true if the rounded rectangle contains the given point
|
|
77
|
-
* @
|
|
78
|
-
* @
|
|
79
|
-
* @
|
|
80
|
-
* @
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
71
|
+
* Returns true if the rounded rectangle contains the given point or rectangle
|
|
72
|
+
* @param {number|Vector2d|Rect} x - x coordinate or a vector point, or a Rect to test
|
|
73
|
+
* @param {number} [y] - y coordinate
|
|
74
|
+
* @returns {boolean} True if the rounded rectangle contain the given point or rectangle, otherwise false
|
|
75
|
+
* @example
|
|
76
|
+
* if (rect.contains(10, 10)) {
|
|
77
|
+
* // do something
|
|
78
|
+
* }
|
|
79
|
+
* // or
|
|
80
|
+
* if (rect.contains(myVector2d)) {
|
|
81
|
+
* // do something
|
|
82
|
+
* }
|
|
83
|
+
* if (rect.contains(myRect)) {
|
|
84
|
+
* // do something
|
|
85
|
+
* }
|
|
91
86
|
*/
|
|
92
87
|
contains() {
|
|
93
88
|
let arg0 = arguments[0];
|
|
94
89
|
let _x, _y;
|
|
95
90
|
if (arguments.length === 2) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
// x, y
|
|
92
|
+
_x = arg0;
|
|
93
|
+
_y = arguments[1];
|
|
94
|
+
} else {
|
|
95
|
+
if ((typeof arg0.radius === "undefined") && (typeof arg0.bottom === "number")) {
|
|
96
|
+
// it's a rect
|
|
97
|
+
return super.contains(arg0);
|
|
98
|
+
} else {
|
|
99
|
+
// else a vector or point
|
|
105
100
|
_x = arg0.x;
|
|
106
101
|
_y = arg0.y;
|
|
107
|
-
|
|
102
|
+
}
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
// check whether point is outside the bounding box
|
|
@@ -144,8 +139,6 @@ class RoundRect extends Rect {
|
|
|
144
139
|
|
|
145
140
|
/**
|
|
146
141
|
* check if this RoundRect is identical to the specified one
|
|
147
|
-
* @name equals
|
|
148
|
-
* @memberof RoundRect
|
|
149
142
|
* @param {RoundRect} rrect
|
|
150
143
|
* @returns {boolean} true if equals
|
|
151
144
|
*/
|
|
@@ -155,8 +148,6 @@ class RoundRect extends Rect {
|
|
|
155
148
|
|
|
156
149
|
/**
|
|
157
150
|
* clone this RoundRect
|
|
158
|
-
* @name clone
|
|
159
|
-
* @memberof RoundRect
|
|
160
151
|
* @returns {RoundRect} new RoundRect
|
|
161
152
|
*/
|
|
162
153
|
clone() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -42,9 +42,9 @@ export { default as UISpriteElement } from './renderable/ui/uispriteelement.js';
|
|
|
42
42
|
import Collectable from './renderable/collectable.js';
|
|
43
43
|
import Trigger from './renderable/trigger.js';
|
|
44
44
|
import Light2d from './renderable/light2d.js';
|
|
45
|
-
import Text from './text/text.js';
|
|
46
|
-
import BitmapText from './text/bitmaptext.js';
|
|
47
|
-
import BitmapTextData from './text/bitmaptextdata.js';
|
|
45
|
+
import Text from './renderable/text/text.js';
|
|
46
|
+
import BitmapText from './renderable/text/bitmaptext.js';
|
|
47
|
+
import BitmapTextData from './renderable/text/bitmaptextdata.js';
|
|
48
48
|
export { Draggable } from './renderable/draggable.js';
|
|
49
49
|
export { DropTarget } from './renderable/dragndrop.js';
|
|
50
50
|
export { default as TMXRenderer } from './level/tiled/renderer/TMXRenderer.js';
|
|
@@ -112,7 +112,7 @@ import { initKeyboardEvent } from './input/keyboard.js';
|
|
|
112
112
|
* @name version
|
|
113
113
|
* @type {string}
|
|
114
114
|
*/
|
|
115
|
-
const version = "15.
|
|
115
|
+
const version = "15.4.1";
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* a flag indicating that melonJS is fully initialized
|
|
@@ -232,7 +232,7 @@ function boot() {
|
|
|
232
232
|
// call the library init function when ready
|
|
233
233
|
onReady(() => {
|
|
234
234
|
{
|
|
235
|
-
|
|
235
|
+
boot();
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -102,14 +102,14 @@ let keyUpEvent = function (e, keyCode, mouseButton) {
|
|
|
102
102
|
* PUBLIC STUFF
|
|
103
103
|
*/
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
/**
|
|
106
106
|
* the default target element for keyboard events (usually the window element in which the game is running)
|
|
107
107
|
* @public
|
|
108
108
|
* @type {EventTarget}
|
|
109
109
|
* @name keyBoardEventTarget
|
|
110
110
|
* @memberof input
|
|
111
111
|
*/
|
|
112
|
-
|
|
112
|
+
let keyBoardEventTarget = null;
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* standard keyboard constants
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -135,7 +135,7 @@ class Pointer extends Bounds {
|
|
|
135
135
|
*/
|
|
136
136
|
this.clientX = 0;
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
/**
|
|
139
139
|
* the vertical coordinate within the application's client area at which the event occurred
|
|
140
140
|
* @public
|
|
141
141
|
* @type {number}
|
|
@@ -155,7 +155,7 @@ class Pointer extends Bounds {
|
|
|
155
155
|
*/
|
|
156
156
|
this.movementX = 0;
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
/**
|
|
159
159
|
* the difference in the Y coordinate of the pointer since the previous move event
|
|
160
160
|
* @public
|
|
161
161
|
* @type {number}
|
|
@@ -279,7 +279,7 @@ class Pointer extends Bounds {
|
|
|
279
279
|
*/
|
|
280
280
|
this.gameLocalY = 0;
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
/**
|
|
283
283
|
* The unique identifier of the contact for a touch, mouse or pen
|
|
284
284
|
* @public
|
|
285
285
|
* @type {number}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -165,10 +165,9 @@ function enablePointerEvent() {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// if time interval <= 16, disable the feature
|
|
168
|
-
let i;
|
|
169
168
|
let events = findAllActiveEvents(activeEventList, POINTER_MOVE);
|
|
170
169
|
if (throttlingInterval < 17) {
|
|
171
|
-
for (i = 0; i < events.length; i++) {
|
|
170
|
+
for (let i = 0; i < events.length; i++) {
|
|
172
171
|
if (activeEventList.indexOf(events[i]) !== -1) {
|
|
173
172
|
pointerEventTarget.addEventListener(
|
|
174
173
|
events[i],
|
|
@@ -180,7 +179,7 @@ function enablePointerEvent() {
|
|
|
180
179
|
}
|
|
181
180
|
}
|
|
182
181
|
else {
|
|
183
|
-
for (i = 0; i < events.length; i++) {
|
|
182
|
+
for (let i = 0; i < events.length; i++) {
|
|
184
183
|
if (activeEventList.indexOf(events[i]) !== -1) {
|
|
185
184
|
pointerEventTarget.addEventListener(
|
|
186
185
|
events[i],
|
|
@@ -490,14 +489,14 @@ function onPointerEvent(e) {
|
|
|
490
489
|
* PUBLIC STUFF
|
|
491
490
|
*/
|
|
492
491
|
|
|
493
|
-
|
|
492
|
+
/**
|
|
494
493
|
* the default target element for pointer events (usually the canvas element in which the game is rendered)
|
|
495
494
|
* @public
|
|
496
495
|
* @type {EventTarget}
|
|
497
496
|
* @name pointerEventTarget
|
|
498
497
|
* @memberof input
|
|
499
498
|
*/
|
|
500
|
-
|
|
499
|
+
let pointerEventTarget = null;
|
|
501
500
|
|
|
502
501
|
/**
|
|
503
502
|
* Pointer information (current position and size)
|
|
@@ -620,7 +619,7 @@ function unbindPointer(button) {
|
|
|
620
619
|
// clear the event status
|
|
621
620
|
pointer.bind[
|
|
622
621
|
typeof(button) === "undefined" ?
|
|
623
|
-
|
|
622
|
+
pointer.LEFT : button
|
|
624
623
|
] = null;
|
|
625
624
|
}
|
|
626
625
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -107,7 +107,7 @@ Renderer.prototype.getScreenContext = function() {
|
|
|
107
107
|
* @deprecated since 14.0.0
|
|
108
108
|
* @see UISpriteElement
|
|
109
109
|
*/
|
|
110
|
-
|
|
110
|
+
class GUI_Object extends UISpriteElement {
|
|
111
111
|
/**
|
|
112
112
|
* @param {number} x - the x coordinate of the GUI Object
|
|
113
113
|
* @param {number} y - the y coordinate of the GUI Object
|