melonjs 14.0.2 → 14.1.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/README.md +2 -0
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +10 -0
- package/dist/melonjs.mjs/_virtual/arraymultimap.js +10 -0
- package/dist/melonjs.mjs/_virtual/earcut.js +10 -0
- package/dist/melonjs.mjs/_virtual/howler.js +10 -0
- package/dist/melonjs.mjs/_virtual/index.js +10 -0
- package/dist/melonjs.mjs/_virtual/index2.js +10 -0
- package/dist/melonjs.mjs/_virtual/multimap.js +10 -0
- package/dist/melonjs.mjs/_virtual/setmultimap.js +10 -0
- package/dist/melonjs.mjs/application/application.js +238 -0
- package/dist/melonjs.mjs/audio/audio.js +536 -0
- package/dist/melonjs.mjs/camera/camera2d.js +731 -0
- package/dist/melonjs.mjs/entity/entity.js +247 -0
- package/dist/melonjs.mjs/game.js +29 -0
- package/dist/melonjs.mjs/geometries/ellipse.js +274 -0
- package/dist/melonjs.mjs/geometries/line.js +115 -0
- package/dist/melonjs.mjs/geometries/path2d.js +318 -0
- package/dist/melonjs.mjs/geometries/point.js +88 -0
- package/dist/melonjs.mjs/geometries/poly.js +498 -0
- package/dist/melonjs.mjs/geometries/rectangle.js +374 -0
- package/dist/melonjs.mjs/geometries/roundrect.js +167 -0
- package/dist/melonjs.mjs/index.js +248 -0
- package/dist/melonjs.mjs/input/gamepad.js +501 -0
- package/dist/melonjs.mjs/input/input.js +26 -0
- package/dist/melonjs.mjs/input/keyboard.js +470 -0
- package/dist/melonjs.mjs/input/pointer.js +393 -0
- package/dist/melonjs.mjs/input/pointerevent.js +818 -0
- package/dist/melonjs.mjs/lang/deprecated.js +157 -0
- package/dist/melonjs.mjs/level/level.js +297 -0
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +141 -0
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +446 -0
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +355 -0
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +193 -0
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +636 -0
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +309 -0
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +81 -0
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +367 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +504 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +218 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +155 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +124 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +107 -0
- package/dist/melonjs.mjs/loader/loader.js +801 -0
- package/dist/melonjs.mjs/loader/loadingscreen.js +120 -0
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +11 -0
- package/dist/melonjs.mjs/math/color.js +616 -0
- package/dist/melonjs.mjs/math/math.js +218 -0
- package/dist/melonjs.mjs/math/matrix2.js +501 -0
- package/dist/melonjs.mjs/math/matrix3.js +679 -0
- package/dist/melonjs.mjs/math/observable_vector2.js +469 -0
- package/dist/melonjs.mjs/math/observable_vector3.js +559 -0
- package/dist/melonjs.mjs/math/vector2.js +526 -0
- package/dist/melonjs.mjs/math/vector3.js +567 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +73 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +21 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +324 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +69 -0
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +691 -0
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +350 -0
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +3241 -0
- package/dist/melonjs.mjs/particles/emitter.js +265 -0
- package/dist/melonjs.mjs/particles/particle.js +186 -0
- package/dist/melonjs.mjs/particles/settings.js +319 -0
- package/dist/melonjs.mjs/physics/body.js +702 -0
- package/dist/melonjs.mjs/physics/bounds.js +459 -0
- package/dist/melonjs.mjs/physics/collision.js +132 -0
- package/dist/melonjs.mjs/physics/detector.js +194 -0
- package/dist/melonjs.mjs/physics/quadtree.js +394 -0
- package/dist/melonjs.mjs/physics/response.js +57 -0
- package/dist/melonjs.mjs/physics/sat.js +483 -0
- package/dist/melonjs.mjs/physics/world.js +219 -0
- package/dist/melonjs.mjs/plugin/plugin.js +141 -0
- package/dist/melonjs.mjs/renderable/collectable.js +60 -0
- package/dist/melonjs.mjs/renderable/colorlayer.js +78 -0
- package/dist/melonjs.mjs/renderable/container.js +1016 -0
- package/dist/melonjs.mjs/renderable/dragndrop.js +224 -0
- package/dist/melonjs.mjs/renderable/imagelayer.js +305 -0
- package/dist/melonjs.mjs/renderable/light2d.js +155 -0
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +246 -0
- package/dist/melonjs.mjs/renderable/renderable.js +781 -0
- package/dist/melonjs.mjs/renderable/sprite.js +653 -0
- package/dist/melonjs.mjs/renderable/trigger.js +156 -0
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +212 -0
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +225 -0
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +127 -0
- package/dist/melonjs.mjs/state/stage.js +236 -0
- package/dist/melonjs.mjs/state/state.js +596 -0
- package/dist/melonjs.mjs/system/device.js +909 -0
- package/dist/melonjs.mjs/system/dom.js +78 -0
- package/dist/melonjs.mjs/system/event.js +537 -0
- package/dist/melonjs.mjs/system/platform.js +41 -0
- package/dist/melonjs.mjs/system/pooling.js +209 -0
- package/dist/melonjs.mjs/system/save.js +157 -0
- package/dist/melonjs.mjs/system/timer.js +286 -0
- package/dist/melonjs.mjs/text/bitmaptext.js +363 -0
- package/dist/melonjs.mjs/text/bitmaptextdata.js +198 -0
- package/dist/melonjs.mjs/text/glyph.js +65 -0
- package/dist/melonjs.mjs/text/text.js +452 -0
- package/dist/melonjs.mjs/text/textmetrics.js +175 -0
- package/dist/melonjs.mjs/text/textstyle.js +23 -0
- package/dist/melonjs.mjs/tweens/easing.js +336 -0
- package/dist/melonjs.mjs/tweens/interpolation.js +112 -0
- package/dist/melonjs.mjs/tweens/tween.js +479 -0
- package/dist/melonjs.mjs/utils/agent.js +76 -0
- package/dist/melonjs.mjs/utils/array.js +63 -0
- package/dist/melonjs.mjs/utils/file.js +42 -0
- package/dist/melonjs.mjs/utils/function.js +70 -0
- package/dist/melonjs.mjs/utils/string.js +82 -0
- package/dist/melonjs.mjs/utils/utils.js +173 -0
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +806 -0
- package/dist/melonjs.mjs/video/renderer.js +410 -0
- package/dist/melonjs.mjs/video/texture/atlas.js +519 -0
- package/dist/melonjs.mjs/video/texture/cache.js +143 -0
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +144 -0
- package/dist/melonjs.mjs/video/video.js +462 -0
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +142 -0
- package/dist/melonjs.mjs/video/webgl/glshader.js +167 -0
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +10 -0
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +25 -0
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +20 -0
- package/dist/melonjs.mjs/video/webgl/utils/program.js +67 -0
- package/dist/melonjs.mjs/video/webgl/utils/string.js +25 -0
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +92 -0
- package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +494 -0
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1035 -0
- package/dist/melonjs.module.d.ts +1298 -1359
- package/dist/melonjs.module.js +2072 -3520
- package/package.json +21 -16
- package/src/application/application.js +4 -5
- package/src/audio/audio.js +32 -32
- package/src/camera/camera2d.js +32 -33
- package/src/entity/entity.js +18 -19
- package/src/geometries/ellipse.js +17 -18
- package/src/geometries/line.js +6 -7
- package/src/geometries/path2d.js +33 -34
- package/src/geometries/point.js +1 -2
- package/src/geometries/poly.js +16 -18
- package/src/geometries/rectangle.js +19 -20
- package/src/geometries/roundrect.js +9 -10
- package/src/input/gamepad.js +15 -15
- package/src/input/keyboard.js +12 -12
- package/src/input/pointer.js +6 -6
- package/src/input/pointerevent.js +12 -12
- package/src/lang/deprecated.js +12 -12
- package/src/level/level.js +25 -25
- package/src/level/tiled/TMXLayer.js +23 -24
- package/src/level/tiled/TMXTile.js +6 -7
- package/src/level/tiled/TMXTileMap.js +8 -10
- package/src/level/tiled/TMXTileset.js +3 -4
- package/src/level/tiled/TMXTilesetGroup.js +1 -2
- package/src/level/tiled/TMXUtils.js +5 -5
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +3 -4
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +3 -4
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXRenderer.js +20 -21
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -2
- package/src/loader/loader.js +20 -20
- package/src/math/color.js +21 -22
- package/src/math/math.js +16 -16
- package/src/math/matrix2.js +17 -18
- package/src/math/matrix3.js +26 -27
- package/src/math/observable_vector2.js +15 -16
- package/src/math/observable_vector3.js +17 -18
- package/src/math/vector2.js +10 -11
- package/src/math/vector3.js +11 -12
- package/src/particles/emitter.js +7 -8
- package/src/particles/particle.js +3 -4
- package/src/physics/body.js +29 -30
- package/src/physics/bounds.js +10 -10
- package/src/physics/collision.js +2 -2
- package/src/physics/detector.js +6 -6
- package/src/physics/quadtree.js +18 -23
- package/src/physics/sat.js +31 -31
- package/src/physics/world.js +6 -7
- package/src/plugin/plugin.js +5 -5
- package/src/renderable/collectable.js +4 -6
- package/src/renderable/colorlayer.js +6 -8
- package/src/renderable/container.js +25 -27
- package/src/renderable/dragndrop.js +14 -14
- package/src/renderable/imagelayer.js +14 -15
- package/src/renderable/light2d.js +4 -5
- package/src/renderable/nineslicesprite.js +17 -18
- package/src/renderable/renderable.js +26 -28
- package/src/renderable/sprite.js +29 -30
- package/src/renderable/trigger.js +16 -17
- package/src/renderable/ui/uibaseelement.js +8 -9
- package/src/renderable/ui/uispriteelement.js +8 -8
- package/src/renderable/ui/uitextbutton.js +15 -15
- package/src/state/stage.js +8 -9
- package/src/state/state.js +17 -17
- package/src/system/device.js +11 -11
- package/src/system/event.js +10 -10
- package/src/system/pooling.js +9 -9
- package/src/system/save.js +2 -2
- package/src/system/timer.js +10 -10
- package/src/text/bitmaptext.js +19 -20
- package/src/text/bitmaptextdata.js +3 -4
- package/src/text/glyph.js +1 -2
- package/src/text/text.js +24 -25
- package/src/text/textmetrics.js +9 -10
- package/src/tweens/tween.js +20 -21
- package/src/utils/agent.js +5 -5
- package/src/utils/array.js +4 -4
- package/src/utils/file.js +2 -2
- package/src/utils/function.js +6 -6
- package/src/utils/string.js +5 -5
- package/src/utils/utils.js +4 -4
- package/src/video/canvas/canvas_renderer.js +72 -73
- package/src/video/renderer.js +27 -28
- package/src/video/texture/atlas.js +22 -22
- package/src/video/texture/canvas_texture.js +9 -9
- package/src/video/video.js +17 -17
- package/src/video/webgl/buffer/vertex.js +1 -2
- package/src/video/webgl/glshader.js +12 -12
- package/src/video/webgl/webgl_compositor.js +42 -43
- package/src/video/webgl/webgl_renderer.js +76 -77
package/src/physics/sat.js
CHANGED
|
@@ -46,9 +46,9 @@ for (var a = 0; a < 5; a++) { T_ARRAYS.push([]); }
|
|
|
46
46
|
* resulting in a one dimensional range of the minimum and
|
|
47
47
|
* maximum value on that axis.
|
|
48
48
|
* @ignore
|
|
49
|
-
* @param {Array.<Vector2d>} points The points to flatten.
|
|
50
|
-
* @param {Vector2d} normal The unit vector axis to flatten on.
|
|
51
|
-
* @param {Array.<number>} result An array. After calling this function,
|
|
49
|
+
* @param {Array.<Vector2d>} points - The points to flatten.
|
|
50
|
+
* @param {Vector2d} normal - The unit vector axis to flatten on.
|
|
51
|
+
* @param {Array.<number>} result - An array. After calling this function,
|
|
52
52
|
* result[0] will be the minimum value,
|
|
53
53
|
* result[1] will be the maximum value.
|
|
54
54
|
*/
|
|
@@ -70,13 +70,13 @@ function flattenPointsOn(points, normal, result) {
|
|
|
70
70
|
* Check whether two convex polygons are separated by the specified
|
|
71
71
|
* axis (must be a unit vector).
|
|
72
72
|
* @ignore
|
|
73
|
-
* @param {Vector2d} aPos The position of the first polygon.
|
|
74
|
-
* @param {Vector2d} bPos The position of the second polygon.
|
|
75
|
-
* @param {Array.<Vector2d>} aPoints The points in the first polygon.
|
|
76
|
-
* @param {Array.<Vector2d>} bPoints The points in the second polygon.
|
|
77
|
-
* @param {Vector2d} axis The axis (unit sized) to test against. The points of both polygons
|
|
73
|
+
* @param {Vector2d} aPos - The position of the first polygon.
|
|
74
|
+
* @param {Vector2d} bPos - The position of the second polygon.
|
|
75
|
+
* @param {Array.<Vector2d>} aPoints - The points in the first polygon.
|
|
76
|
+
* @param {Array.<Vector2d>} bPoints - The points in the second polygon.
|
|
77
|
+
* @param {Vector2d} axis - The axis (unit sized) to test against. The points of both polygons
|
|
78
78
|
* will be projected onto this axis.
|
|
79
|
-
* @param {Response=} response A Response object (optional) which will be populated
|
|
79
|
+
* @param {Response=} response - A Response object (optional) which will be populated
|
|
80
80
|
* if the axis is not a separating axis.
|
|
81
81
|
* @returns {boolean} true if it is a separating axis, false otherwise. If false,
|
|
82
82
|
* and a response is passed in, information about how much overlap and
|
|
@@ -161,8 +161,8 @@ function isSeparatingAxis(aPos, bPos, aPoints, bPoints, axis, response) {
|
|
|
161
161
|
* </pre>
|
|
162
162
|
*
|
|
163
163
|
* @ignore
|
|
164
|
-
* @param {Vector2d} line The line segment.
|
|
165
|
-
* @param {Vector2d} point The point.
|
|
164
|
+
* @param {Vector2d} line - The line segment.
|
|
165
|
+
* @param {Vector2d} point - The point.
|
|
166
166
|
* @returns {number} LEFT_VORNOI_REGION (-1) if it is the left region,
|
|
167
167
|
* MIDDLE_VORNOI_REGION (0) if it is the middle region,
|
|
168
168
|
* RIGHT_VORNOI_REGION (1) if it is the right region.
|
|
@@ -187,11 +187,11 @@ function vornoiRegion(line, point) {
|
|
|
187
187
|
/**
|
|
188
188
|
* Checks whether polygons collide.
|
|
189
189
|
* @ignore
|
|
190
|
-
* @param {Renderable} a a reference to the object A.
|
|
191
|
-
* @param {Polygon} polyA a reference to the object A Polygon to be tested
|
|
192
|
-
* @param {Renderable} b a reference to the object B.
|
|
193
|
-
* @param {Polygon} polyB a reference to the object B Polygon to be tested
|
|
194
|
-
* @param {Response=} response Response object (optional) that will be populated if they intersect.
|
|
190
|
+
* @param {Renderable} a - a reference to the object A.
|
|
191
|
+
* @param {Polygon} polyA - a reference to the object A Polygon to be tested
|
|
192
|
+
* @param {Renderable} b - a reference to the object B.
|
|
193
|
+
* @param {Polygon} polyB - a reference to the object B Polygon to be tested
|
|
194
|
+
* @param {Response=} response - Response object (optional) that will be populated if they intersect.
|
|
195
195
|
* @returns {boolean} true if they intersect, false if they don't.
|
|
196
196
|
*/
|
|
197
197
|
export function testPolygonPolygon(a, polyA, b, polyB, response) {
|
|
@@ -241,11 +241,11 @@ export function testPolygonPolygon(a, polyA, b, polyB, response) {
|
|
|
241
241
|
/**
|
|
242
242
|
* Check if two Ellipse collide.
|
|
243
243
|
* @ignore
|
|
244
|
-
* @param {Renderable} a a reference to the object A.
|
|
245
|
-
* @param {Ellipse} ellipseA a reference to the object A Ellipse to be tested
|
|
246
|
-
* @param {Renderable} b a reference to the object B.
|
|
247
|
-
* @param {Ellipse} ellipseB a reference to the object B Ellipse to be tested
|
|
248
|
-
* @param {Response=} response Response object (optional) that will be populated if
|
|
244
|
+
* @param {Renderable} a - a reference to the object A.
|
|
245
|
+
* @param {Ellipse} ellipseA - a reference to the object A Ellipse to be tested
|
|
246
|
+
* @param {Renderable} b - a reference to the object B.
|
|
247
|
+
* @param {Ellipse} ellipseB - a reference to the object B Ellipse to be tested
|
|
248
|
+
* @param {Response=} response - Response object (optional) that will be populated if
|
|
249
249
|
* the circles intersect.
|
|
250
250
|
* @returns {boolean} true if the circles intersect, false if they don't.
|
|
251
251
|
*/
|
|
@@ -282,11 +282,11 @@ export function testEllipseEllipse(a, ellipseA, b, ellipseB, response) {
|
|
|
282
282
|
/**
|
|
283
283
|
* Check if a polygon and an ellipse collide.
|
|
284
284
|
* @ignore
|
|
285
|
-
* @param {Renderable} a a reference to the object A.
|
|
286
|
-
* @param {Polygon} polyA a reference to the object A Polygon to be tested
|
|
287
|
-
* @param {Renderable} b a reference to the object B.
|
|
288
|
-
* @param {Ellipse} ellipseB a reference to the object B Ellipse to be tested
|
|
289
|
-
* @param {Response=} response Response object (optional) that will be populated if they intersect.
|
|
285
|
+
* @param {Renderable} a - a reference to the object A.
|
|
286
|
+
* @param {Polygon} polyA - a reference to the object A Polygon to be tested
|
|
287
|
+
* @param {Renderable} b - a reference to the object B.
|
|
288
|
+
* @param {Ellipse} ellipseB - a reference to the object B Ellipse to be tested
|
|
289
|
+
* @param {Response=} response - Response object (optional) that will be populated if they intersect.
|
|
290
290
|
* @returns {boolean} true if they intersect, false if they don't.
|
|
291
291
|
*/
|
|
292
292
|
export function testPolygonEllipse(a, polyA, b, ellipseB, response) {
|
|
@@ -448,11 +448,11 @@ export function testPolygonEllipse(a, polyA, b, ellipseB, response) {
|
|
|
448
448
|
* **NOTE:** This is slightly less efficient than testPolygonEllipse as it just
|
|
449
449
|
* runs testPolygonEllipse and reverses the response at the end.
|
|
450
450
|
* @ignore
|
|
451
|
-
* @param {Renderable} a a reference to the object A.
|
|
452
|
-
* @param {Ellipse} ellipseA a reference to the object A Ellipse to be tested
|
|
453
|
-
* @param {Renderable} b a reference to the object B.
|
|
454
|
-
* @param {Polygon} polyB a reference to the object B Polygon to be tested
|
|
455
|
-
* @param {Response=} response Response object (optional) that will be populated if
|
|
451
|
+
* @param {Renderable} a - a reference to the object A.
|
|
452
|
+
* @param {Ellipse} ellipseA - a reference to the object A Ellipse to be tested
|
|
453
|
+
* @param {Renderable} b - a reference to the object B.
|
|
454
|
+
* @param {Polygon} polyB - a reference to the object B Polygon to be tested
|
|
455
|
+
* @param {Response=} response - Response object (optional) that will be populated if
|
|
456
456
|
* they intersect.
|
|
457
457
|
* @returns {boolean} true if they intersect, false if they don't.
|
|
458
458
|
*/
|
package/src/physics/world.js
CHANGED
|
@@ -11,12 +11,12 @@ import state from "./../state/state.js";
|
|
|
11
11
|
* an object representing the physic world, and responsible for managing and updating all childs and physics
|
|
12
12
|
* @augments Container
|
|
13
13
|
*/
|
|
14
|
-
class World extends Container {
|
|
14
|
+
export default class World extends Container {
|
|
15
15
|
/**
|
|
16
|
-
* @param {number} [x=0] position of the container (accessible via the inherited pos.x property)
|
|
17
|
-
* @param {number} [y=0] position of the container (accessible via the inherited pos.y property)
|
|
18
|
-
* @param {number} [width=game.viewport.width] width of the container
|
|
19
|
-
* @param {number} [height=game.viewport.height] height of the container
|
|
16
|
+
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
17
|
+
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
18
|
+
* @param {number} [width=game.viewport.width] - width of the container
|
|
19
|
+
* @param {number} [height=game.viewport.height] - height of the container
|
|
20
20
|
*/
|
|
21
21
|
constructor(x = 0, y = 0, width = Infinity, height = Infinity) {
|
|
22
22
|
// call the super constructor
|
|
@@ -169,7 +169,7 @@ class World extends Container {
|
|
|
169
169
|
* update the game world
|
|
170
170
|
* @name reset
|
|
171
171
|
* @memberof World
|
|
172
|
-
* @param {number} dt the time passed since the last frame update
|
|
172
|
+
* @param {number} dt - the time passed since the last frame update
|
|
173
173
|
* @returns {boolean} true if the word is dirty
|
|
174
174
|
*/
|
|
175
175
|
update(dt) {
|
|
@@ -209,4 +209,3 @@ class World extends Container {
|
|
|
209
209
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
export default World;
|
package/src/plugin/plugin.js
CHANGED
|
@@ -44,9 +44,9 @@ export var plugin = {
|
|
|
44
44
|
* @name patch
|
|
45
45
|
* @memberof plugin
|
|
46
46
|
* @public
|
|
47
|
-
* @param {object} proto target object
|
|
48
|
-
* @param {string} name target function
|
|
49
|
-
* @param {Function} fn replacement function
|
|
47
|
+
* @param {object} proto - target object
|
|
48
|
+
* @param {string} name - target function
|
|
49
|
+
* @param {Function} fn - replacement function
|
|
50
50
|
* @example
|
|
51
51
|
* // redefine the me.game.update function with a new one
|
|
52
52
|
* me.plugin.patch(me.game, "update", function () {
|
|
@@ -89,9 +89,9 @@ export var plugin = {
|
|
|
89
89
|
* @memberof plugin
|
|
90
90
|
* @see Base
|
|
91
91
|
* @public
|
|
92
|
-
* @param {plugin.Base} pluginObj Plugin object to instantiate and register
|
|
92
|
+
* @param {plugin.Base} pluginObj - Plugin object to instantiate and register
|
|
93
93
|
* @param {string} name
|
|
94
|
-
* @param {object} [...arguments] all extra parameters will be passed to the plugin constructor
|
|
94
|
+
* @param {object} [...arguments] - all extra parameters will be passed to the plugin constructor
|
|
95
95
|
* @example
|
|
96
96
|
* // register a new plugin
|
|
97
97
|
* me.plugin.register(TestPlugin, "testPlugin");
|
|
@@ -8,11 +8,11 @@ import pool from "./../system/pooling.js";
|
|
|
8
8
|
* a basic collectable helper class for immovable object (e.g. a coin)
|
|
9
9
|
* @augments Sprite
|
|
10
10
|
*/
|
|
11
|
-
class Collectable extends Sprite {
|
|
11
|
+
export default class Collectable extends Sprite {
|
|
12
12
|
/**
|
|
13
|
-
* @param {number} x the x coordinates of the collectable
|
|
14
|
-
* @param {number} y the y coordinates of the collectable
|
|
15
|
-
* @param {object} settings See {@link Sprite}
|
|
13
|
+
* @param {number} x - the x coordinates of the collectable
|
|
14
|
+
* @param {number} y - the y coordinates of the collectable
|
|
15
|
+
* @param {object} settings - See {@link Sprite}
|
|
16
16
|
*/
|
|
17
17
|
constructor(x, y, settings) {
|
|
18
18
|
|
|
@@ -49,5 +49,3 @@ class Collectable extends Sprite {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
export default Collectable;
|
|
@@ -7,11 +7,11 @@ import Renderable from "./renderable.js";
|
|
|
7
7
|
* a generic Color Layer Object. Fills the entire Canvas with the color not just the container the object belongs to.
|
|
8
8
|
* @augments Renderable
|
|
9
9
|
*/
|
|
10
|
-
class ColorLayer extends Renderable {
|
|
10
|
+
export default class ColorLayer extends Renderable {
|
|
11
11
|
/**
|
|
12
|
-
* @param {string} name Layer name
|
|
13
|
-
* @param {Color|string} color CSS color
|
|
14
|
-
* @param {number} [z = 0] z-index position
|
|
12
|
+
* @param {string} name - Layer name
|
|
13
|
+
* @param {Color|string} color - CSS color
|
|
14
|
+
* @param {number} [z = 0] - z-index position
|
|
15
15
|
*/
|
|
16
16
|
constructor(name, color, z) {
|
|
17
17
|
// parent constructor
|
|
@@ -44,8 +44,8 @@ class ColorLayer extends Renderable {
|
|
|
44
44
|
* @name draw
|
|
45
45
|
* @memberof ColorLayer
|
|
46
46
|
* @protected
|
|
47
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
48
|
-
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
47
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer - a renderer instance
|
|
48
|
+
* @param {Camera2d} [viewport] - the viewport to (re)draw
|
|
49
49
|
*/
|
|
50
50
|
draw(renderer, viewport) {
|
|
51
51
|
renderer.save();
|
|
@@ -68,5 +68,3 @@ class ColorLayer extends Renderable {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
export default ColorLayer;
|
|
@@ -10,23 +10,23 @@ import Body from "./../physics/body.js";
|
|
|
10
10
|
* Private function to re-use for object removal in a defer
|
|
11
11
|
* @ignore
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
function deferredRemove(child, keepalive) {
|
|
14
14
|
this.removeChildNow(child, keepalive);
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
let globalFloatingCounter = 0;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @classdesc
|
|
21
21
|
* Container represents a collection of child objects
|
|
22
22
|
* @augments Renderable
|
|
23
23
|
*/
|
|
24
|
-
class Container extends Renderable {
|
|
24
|
+
export default class Container extends Renderable {
|
|
25
25
|
/**
|
|
26
|
-
* @param {number} [x=0] position of the container (accessible via the inherited pos.x property)
|
|
27
|
-
* @param {number} [y=0] position of the container (accessible via the inherited pos.y property)
|
|
28
|
-
* @param {number} [width=game.viewport.width] width of the container
|
|
29
|
-
* @param {number} [height=game.viewport.height] height of the container
|
|
26
|
+
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
27
|
+
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
28
|
+
* @param {number} [width=game.viewport.width] - width of the container
|
|
29
|
+
* @param {number} [height=game.viewport.height] - height of the container
|
|
30
30
|
*/
|
|
31
31
|
constructor(x = 0, y = 0, width, height, root = false) {
|
|
32
32
|
|
|
@@ -104,7 +104,7 @@ class Container extends Renderable {
|
|
|
104
104
|
* a callback to be extended, triggered after a child has been added or removed
|
|
105
105
|
* @name onChildChange
|
|
106
106
|
* @memberof Container#
|
|
107
|
-
* @param {number} index added or removed child index
|
|
107
|
+
* @param {number} index - added or removed child index
|
|
108
108
|
*/
|
|
109
109
|
this.onChildChange = function (index) { // eslint-disable-line no-unused-vars
|
|
110
110
|
// to be extended
|
|
@@ -198,7 +198,7 @@ class Container extends Renderable {
|
|
|
198
198
|
* @name addChild
|
|
199
199
|
* @memberof Container
|
|
200
200
|
* @param {Renderable} child
|
|
201
|
-
* @param {number} [z] forces the z index of the child to the specified value
|
|
201
|
+
* @param {number} [z] - forces the z index of the child to the specified value
|
|
202
202
|
* @returns {Renderable} the added child
|
|
203
203
|
*/
|
|
204
204
|
addChild(child, z) {
|
|
@@ -318,8 +318,8 @@ class Container extends Renderable {
|
|
|
318
318
|
* - The array forEach() was called upon. <br>
|
|
319
319
|
* @name forEach
|
|
320
320
|
* @memberof Container
|
|
321
|
-
* @param {Function} callback fnction to execute on each element
|
|
322
|
-
* @param {object} [thisArg] value to use as this(i.e reference Object) when executing callback.
|
|
321
|
+
* @param {Function} callback - fnction to execute on each element
|
|
322
|
+
* @param {object} [thisArg] - value to use as this(i.e reference Object) when executing callback.
|
|
323
323
|
* @example
|
|
324
324
|
* // iterate through all children of the root container
|
|
325
325
|
* me.game.world.forEach((child) => {
|
|
@@ -437,8 +437,8 @@ class Container extends Renderable {
|
|
|
437
437
|
* @name getChildByProp
|
|
438
438
|
* @memberof Container
|
|
439
439
|
* @public
|
|
440
|
-
* @param {string} prop Property name
|
|
441
|
-
* @param {string|RegExp|number|boolean} value Value of the property
|
|
440
|
+
* @param {string} prop - Property name
|
|
441
|
+
* @param {string|RegExp|number|boolean} value - Value of the property
|
|
442
442
|
* @returns {Renderable[]} Array of childs
|
|
443
443
|
* @example
|
|
444
444
|
* // get the first child object called "mainPlayer" in a specific container :
|
|
@@ -514,7 +514,7 @@ class Container extends Renderable {
|
|
|
514
514
|
* @name getChildByName
|
|
515
515
|
* @memberof Container
|
|
516
516
|
* @public
|
|
517
|
-
* @param {string|RegExp|number|boolean} name child name
|
|
517
|
+
* @param {string|RegExp|number|boolean} name - child name
|
|
518
518
|
* @returns {Renderable[]} Array of children
|
|
519
519
|
*/
|
|
520
520
|
getChildByName(name) {
|
|
@@ -528,7 +528,7 @@ class Container extends Renderable {
|
|
|
528
528
|
* @name getChildByGUID
|
|
529
529
|
* @memberof Container
|
|
530
530
|
* @public
|
|
531
|
-
* @param {string|RegExp|number|boolean} guid child GUID
|
|
531
|
+
* @param {string|RegExp|number|boolean} guid - child GUID
|
|
532
532
|
* @returns {Renderable} corresponding child or null
|
|
533
533
|
*/
|
|
534
534
|
getChildByGUID(guid) {
|
|
@@ -642,7 +642,7 @@ class Container extends Renderable {
|
|
|
642
642
|
* @memberof Container
|
|
643
643
|
* @public
|
|
644
644
|
* @param {Renderable} child
|
|
645
|
-
* @param {boolean} [keepalive=false] true to prevent calling child.destroy()
|
|
645
|
+
* @param {boolean} [keepalive=false] - true to prevent calling child.destroy()
|
|
646
646
|
*/
|
|
647
647
|
removeChild(child, keepalive) {
|
|
648
648
|
if (this.hasChild(child)) {
|
|
@@ -660,7 +660,7 @@ class Container extends Renderable {
|
|
|
660
660
|
* @name removeChildNow
|
|
661
661
|
* @memberof Container
|
|
662
662
|
* @param {Renderable} child
|
|
663
|
-
* @param {boolean} [keepalive=False] True to prevent calling child.destroy()
|
|
663
|
+
* @param {boolean} [keepalive=False] - True to prevent calling child.destroy()
|
|
664
664
|
*/
|
|
665
665
|
removeChildNow(child, keepalive) {
|
|
666
666
|
if (this.hasChild(child) && (this.getChildIndex(child) >= 0)) {
|
|
@@ -711,9 +711,9 @@ class Container extends Renderable {
|
|
|
711
711
|
* Automatically set the specified property of all childs to the given value
|
|
712
712
|
* @name setChildsProperty
|
|
713
713
|
* @memberof Container
|
|
714
|
-
* @param {string} prop property name
|
|
715
|
-
* @param {object} value property value
|
|
716
|
-
* @param {boolean} [recursive=false] recursively apply the value to child containers if true
|
|
714
|
+
* @param {string} prop - property name
|
|
715
|
+
* @param {object} value - property value
|
|
716
|
+
* @param {boolean} [recursive=false] - recursively apply the value to child containers if true
|
|
717
717
|
*/
|
|
718
718
|
setChildsProperty(prop, value, recursive) {
|
|
719
719
|
this.forEach((child) => {
|
|
@@ -799,7 +799,7 @@ class Container extends Renderable {
|
|
|
799
799
|
* @name sort
|
|
800
800
|
* @memberof Container
|
|
801
801
|
* @public
|
|
802
|
-
* @param {boolean} [recursive=false] recursively sort all containers if true
|
|
802
|
+
* @param {boolean} [recursive=false] - recursively sort all containers if true
|
|
803
803
|
*/
|
|
804
804
|
sort(recursive) {
|
|
805
805
|
// do nothing if there is already a pending sort
|
|
@@ -893,7 +893,7 @@ class Container extends Renderable {
|
|
|
893
893
|
* @name update
|
|
894
894
|
* @memberof Container
|
|
895
895
|
* @protected
|
|
896
|
-
* @param {number} dt time since the last update in milliseconds.
|
|
896
|
+
* @param {number} dt - time since the last update in milliseconds.
|
|
897
897
|
* @returns {boolean} true if the Container is dirty
|
|
898
898
|
*/
|
|
899
899
|
update(dt) {
|
|
@@ -944,8 +944,8 @@ class Container extends Renderable {
|
|
|
944
944
|
* @name draw
|
|
945
945
|
* @memberof Container
|
|
946
946
|
* @protected
|
|
947
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
948
|
-
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
947
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer - a renderer instance
|
|
948
|
+
* @param {Camera2d} [viewport] - the viewport to (re)draw
|
|
949
949
|
*/
|
|
950
950
|
draw(renderer, viewport) {
|
|
951
951
|
var isFloating = false;
|
|
@@ -1005,5 +1005,3 @@ class Container extends Renderable {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
|
-
|
|
1009
|
-
export default Container;
|
|
@@ -11,10 +11,10 @@ import Renderable from "./../renderable/renderable.js";
|
|
|
11
11
|
*/
|
|
12
12
|
export class Draggable extends Renderable {
|
|
13
13
|
/**
|
|
14
|
-
* @param {number} x the x coordinates of the draggable object
|
|
15
|
-
* @param {number} y the y coordinates of the draggable object
|
|
16
|
-
* @param {number} width draggable object width
|
|
17
|
-
* @param {number} height draggable object height
|
|
14
|
+
* @param {number} x - the x coordinates of the draggable object
|
|
15
|
+
* @param {number} y - the y coordinates of the draggable object
|
|
16
|
+
* @param {number} width - draggable object width
|
|
17
|
+
* @param {number} height - draggable object height
|
|
18
18
|
*/
|
|
19
19
|
constructor(x, y, width, height) {
|
|
20
20
|
super(x, y, width, height);
|
|
@@ -56,7 +56,7 @@ export class Draggable extends Renderable {
|
|
|
56
56
|
* Gets called when the user starts dragging the entity
|
|
57
57
|
* @name dragStart
|
|
58
58
|
* @memberof Draggable
|
|
59
|
-
* @param {object} e the pointer event
|
|
59
|
+
* @param {object} e - the pointer event
|
|
60
60
|
* @returns {boolean} false if the object is being dragged
|
|
61
61
|
*/
|
|
62
62
|
dragStart(e) {
|
|
@@ -72,7 +72,7 @@ export class Draggable extends Renderable {
|
|
|
72
72
|
* Gets called when the user drags this entity around
|
|
73
73
|
* @name dragMove
|
|
74
74
|
* @memberof Draggable
|
|
75
|
-
* @param {object} e the pointer event
|
|
75
|
+
* @param {object} e - the pointer event
|
|
76
76
|
*/
|
|
77
77
|
dragMove(e) {
|
|
78
78
|
if (this.dragging === true) {
|
|
@@ -119,10 +119,10 @@ export class Draggable extends Renderable {
|
|
|
119
119
|
*/
|
|
120
120
|
export class DropTarget extends Renderable {
|
|
121
121
|
/**
|
|
122
|
-
* @param {number} x the x coordinates of the drop target
|
|
123
|
-
* @param {number} y the y coordinates of the drop target
|
|
124
|
-
* @param {number} width drop target width
|
|
125
|
-
* @param {number} height drop target height
|
|
122
|
+
* @param {number} x - the x coordinates of the drop target
|
|
123
|
+
* @param {number} y - the y coordinates of the drop target
|
|
124
|
+
* @param {number} width - drop target width
|
|
125
|
+
* @param {number} height - drop target height
|
|
126
126
|
*/
|
|
127
127
|
constructor(x, y, width, height) {
|
|
128
128
|
super(x, y, width, height);
|
|
@@ -168,7 +168,7 @@ export class DropTarget extends Renderable {
|
|
|
168
168
|
* Sets the collision method which is going to be used to check a valid drop
|
|
169
169
|
* @name setCheckMethod
|
|
170
170
|
* @memberof DropTarget
|
|
171
|
-
* @param {string} checkMethod the checkmethod (defaults to CHECKMETHOD_OVERLAP)
|
|
171
|
+
* @param {string} checkMethod - the checkmethod (defaults to CHECKMETHOD_OVERLAP)
|
|
172
172
|
*/
|
|
173
173
|
setCheckMethod(checkMethod) {
|
|
174
174
|
// We can improve this check,
|
|
@@ -182,8 +182,8 @@ export class DropTarget extends Renderable {
|
|
|
182
182
|
* Checks if a dropped entity is dropped on the current entity
|
|
183
183
|
* @name checkOnMe
|
|
184
184
|
* @memberof DropTarget
|
|
185
|
-
* @param {object} e the triggering event
|
|
186
|
-
* @param {Draggable} draggable the draggable object that is dropped
|
|
185
|
+
* @param {object} e - the triggering event
|
|
186
|
+
* @param {Draggable} draggable - the draggable object that is dropped
|
|
187
187
|
*/
|
|
188
188
|
checkOnMe(e, draggable) {
|
|
189
189
|
if (draggable && this.getBounds()[this.checkMethod](draggable.getBounds())) {
|
|
@@ -196,7 +196,7 @@ export class DropTarget extends Renderable {
|
|
|
196
196
|
* Gets called when a draggable entity is dropped on the current entity
|
|
197
197
|
* @name drop
|
|
198
198
|
* @memberof DropTarget
|
|
199
|
-
* @param {Draggable} draggable the draggable object that is dropped
|
|
199
|
+
* @param {Draggable} draggable - the draggable object that is dropped
|
|
200
200
|
*/
|
|
201
201
|
drop(draggable) { // eslint-disable-line no-unused-vars
|
|
202
202
|
|
|
@@ -11,17 +11,17 @@ import * as stringUtil from "./../utils/string.js";
|
|
|
11
11
|
* a generic Image Layer Object
|
|
12
12
|
* @augments Renderable
|
|
13
13
|
*/
|
|
14
|
-
class ImageLayer extends Sprite {
|
|
14
|
+
export default class ImageLayer extends Sprite {
|
|
15
15
|
/**
|
|
16
|
-
* @param {number} x x coordinate
|
|
17
|
-
* @param {number} y y coordinate
|
|
18
|
-
* @param {object} settings ImageLayer properties
|
|
19
|
-
* @param {HTMLImageElement|HTMLCanvasElement|string} settings.image Image reference. See {@link loader.getImage}
|
|
20
|
-
* @param {string} [settings.name="me.ImageLayer"] layer name
|
|
21
|
-
* @param {number} [settings.z=0] z-index position
|
|
22
|
-
* @param {number|Vector2d} [settings.ratio=1.0] Scrolling ratio to be applied. See {@link ImageLayer#ratio}
|
|
23
|
-
* @param {string} [settings.repeat='repeat'] define if and how an Image Layer should be repeated (accepted values are 'repeat', 'repeat-x', 'repeat-y', 'no-repeat'). See {@link ImageLayer#repeat}
|
|
24
|
-
* @param {number|Vector2d} [settings.anchorPoint=0.0] Image origin. See {@link ImageLayer#anchorPoint}
|
|
16
|
+
* @param {number} x - x coordinate
|
|
17
|
+
* @param {number} y - y coordinate
|
|
18
|
+
* @param {object} settings - ImageLayer properties
|
|
19
|
+
* @param {HTMLImageElement|HTMLCanvasElement|string} settings.image - Image reference. See {@link loader.getImage}
|
|
20
|
+
* @param {string} [settings.name="me.ImageLayer"] - layer name
|
|
21
|
+
* @param {number} [settings.z=0] - z-index position
|
|
22
|
+
* @param {number|Vector2d} [settings.ratio=1.0] - Scrolling ratio to be applied. See {@link ImageLayer#ratio}
|
|
23
|
+
* @param {string} [settings.repeat='repeat'] - define if and how an Image Layer should be repeated (accepted values are 'repeat', 'repeat-x', 'repeat-y', 'no-repeat'). See {@link ImageLayer#repeat}
|
|
24
|
+
* @param {number|Vector2d} [settings.anchorPoint=0.0] - Image origin. See {@link ImageLayer#anchorPoint}
|
|
25
25
|
* @example
|
|
26
26
|
* // create a repetitive background pattern on the X axis using the citycloud image asset
|
|
27
27
|
* me.game.world.addChild(new me.ImageLayer(0, 0, {
|
|
@@ -160,8 +160,8 @@ class ImageLayer extends Sprite {
|
|
|
160
160
|
* resize the Image Layer to match the given size
|
|
161
161
|
* @name resize
|
|
162
162
|
* @memberof ImageLayer
|
|
163
|
-
* @param {number} w new width
|
|
164
|
-
* @param {number} h new height
|
|
163
|
+
* @param {number} w - new width
|
|
164
|
+
* @param {number} h - new height
|
|
165
165
|
*/
|
|
166
166
|
resize(w, h) {
|
|
167
167
|
return super.resize(
|
|
@@ -247,8 +247,8 @@ class ImageLayer extends Sprite {
|
|
|
247
247
|
* @name draw
|
|
248
248
|
* @memberof ImageLayer
|
|
249
249
|
* @protected
|
|
250
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
251
|
-
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
250
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer - a renderer instance
|
|
251
|
+
* @param {Camera2d} [viewport] - the viewport to (re)draw
|
|
252
252
|
*/
|
|
253
253
|
draw(renderer, viewport) {
|
|
254
254
|
var width = this.width,
|
|
@@ -295,4 +295,3 @@ class ImageLayer extends Sprite {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
}
|
|
298
|
-
export default ImageLayer;
|
|
@@ -49,13 +49,13 @@ function createGradient(light) {
|
|
|
49
49
|
* (multiple lights are not supported, alpha component of the ambient light is ignored)
|
|
50
50
|
* @see stage.lights
|
|
51
51
|
*/
|
|
52
|
-
class Light2d extends Renderable {
|
|
52
|
+
export default class Light2d extends Renderable {
|
|
53
53
|
/**
|
|
54
54
|
* @param {number} x - The horizontal position of the light.
|
|
55
55
|
* @param {number} y - The vertical position of the light.
|
|
56
56
|
* @param {number} radiusX - The horizontal radius of the light.
|
|
57
57
|
* @param {number} [radiusY=radiusX] - The vertical radius of the light.
|
|
58
|
-
* @param {Color|string} [color="#FFF"] the color of the light
|
|
58
|
+
* @param {Color|string} [color="#FFF"] - the color of the light
|
|
59
59
|
* @param {number} [intensity=0.7] - The intensity of the light.
|
|
60
60
|
*/
|
|
61
61
|
constructor(x, y, radiusX, radiusY = radiusX, color = "#FFF", intensity = 0.7) {
|
|
@@ -123,8 +123,8 @@ class Light2d extends Renderable {
|
|
|
123
123
|
* @name draw
|
|
124
124
|
* @memberof Light2d
|
|
125
125
|
* @protected
|
|
126
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
127
|
-
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
126
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer - a renderer instance
|
|
127
|
+
* @param {Camera2d} [viewport] - the viewport to (re)draw
|
|
128
128
|
*/
|
|
129
129
|
draw(renderer, viewport) { // eslint-disable-line no-unused-vars
|
|
130
130
|
renderer.drawImage(this.texture.canvas, this.getBounds().x, this.getBounds().y);
|
|
@@ -144,4 +144,3 @@ class Light2d extends Renderable {
|
|
|
144
144
|
super.destroy();
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
export default Light2d;
|
|
@@ -8,24 +8,24 @@ import Sprite from "./sprite.js";
|
|
|
8
8
|
* @see https://en.wikipedia.org/wiki/9-slice_scaling
|
|
9
9
|
* @augments Sprite
|
|
10
10
|
*/
|
|
11
|
-
class NineSliceSprite extends Sprite {
|
|
11
|
+
export default class NineSliceSprite extends Sprite {
|
|
12
12
|
/**
|
|
13
|
-
* @param {number} x the x coordinates of the sprite object
|
|
14
|
-
* @param {number} y the y coordinates of the sprite object
|
|
15
|
-
* @param {object} settings Configuration parameters for the Sprite object
|
|
16
|
-
* @param {number} settings.width the width of the Renderable over which the sprite needs to be stretched
|
|
17
|
-
* @param {number} settings.height the height of the Renderable over which the sprite needs to be stretched
|
|
18
|
-
* @param {number} [settings.insetx] the width of a corner over which the sprite is unscaled (default is a quarter of the sprite width)
|
|
19
|
-
* @param {number} [settings.insety] the height of a corner over which the sprite is unscaled (default is a quarter of the sprite height)
|
|
20
|
-
* @param {HTMLImageElement|HTMLCanvasElement|TextureAtlas|string} settings.image reference to spritesheet image, a texture atlas or to a texture atlas
|
|
21
|
-
* @param {string} [settings.name=""] name of this object
|
|
22
|
-
* @param {string} [settings.region] region name of a specific region to use when using a texture atlas, see {@link TextureAtlas}
|
|
23
|
-
* @param {number} [settings.framewidth] Width of a single frame within the spritesheet
|
|
24
|
-
* @param {number} [settings.frameheight] Height of a single frame within the spritesheet
|
|
25
|
-
* @param {string|Color} [settings.tint] a tint to be applied to this sprite
|
|
26
|
-
* @param {number} [settings.flipX] flip the sprite on the horizontal axis
|
|
27
|
-
* @param {number} [settings.flipY] flip the sprite on the vertical axis
|
|
28
|
-
* @param {Vector2d} [settings.anchorPoint={x:0.5, y:0.5}] Anchor point to draw the frame at (defaults to the center of the frame).
|
|
13
|
+
* @param {number} x - the x coordinates of the sprite object
|
|
14
|
+
* @param {number} y - the y coordinates of the sprite object
|
|
15
|
+
* @param {object} settings - Configuration parameters for the Sprite object
|
|
16
|
+
* @param {number} settings.width - the width of the Renderable over which the sprite needs to be stretched
|
|
17
|
+
* @param {number} settings.height - the height of the Renderable over which the sprite needs to be stretched
|
|
18
|
+
* @param {number} [settings.insetx] - the width of a corner over which the sprite is unscaled (default is a quarter of the sprite width)
|
|
19
|
+
* @param {number} [settings.insety] - the height of a corner over which the sprite is unscaled (default is a quarter of the sprite height)
|
|
20
|
+
* @param {HTMLImageElement|HTMLCanvasElement|TextureAtlas|string} settings.image - reference to spritesheet image, a texture atlas or to a texture atlas
|
|
21
|
+
* @param {string} [settings.name=""] - name of this object
|
|
22
|
+
* @param {string} [settings.region] - region name of a specific region to use when using a texture atlas, see {@link TextureAtlas}
|
|
23
|
+
* @param {number} [settings.framewidth] - Width of a single frame within the spritesheet
|
|
24
|
+
* @param {number} [settings.frameheight] - Height of a single frame within the spritesheet
|
|
25
|
+
* @param {string|Color} [settings.tint] - a tint to be applied to this sprite
|
|
26
|
+
* @param {number} [settings.flipX] - flip the sprite on the horizontal axis
|
|
27
|
+
* @param {number} [settings.flipY] - flip the sprite on the vertical axis
|
|
28
|
+
* @param {Vector2d} [settings.anchorPoint={x:0.5, y:0.5}] - Anchor point to draw the frame at (defaults to the center of the frame).
|
|
29
29
|
* @example
|
|
30
30
|
* this.panelSprite = new me.NineSliceSprite(0, 0, {
|
|
31
31
|
* image : game.texture,
|
|
@@ -235,4 +235,3 @@ class NineSliceSprite extends Sprite {
|
|
|
235
235
|
);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
export default NineSliceSprite;
|