melonjs 10.1.0 → 10.2.2
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 +6 -12
- package/dist/melonjs.js +3119 -2857
- package/dist/melonjs.min.js +3 -3
- package/dist/melonjs.module.d.ts +2590 -2490
- package/dist/melonjs.module.js +2698 -2470
- package/package.json +10 -11
- package/src/audio/audio.js +43 -43
- package/src/camera/camera2d.js +55 -77
- package/src/entity/draggable.js +18 -17
- package/src/entity/droptarget.js +19 -18
- package/src/entity/entity.js +22 -26
- package/src/game.js +3 -3
- package/src/index.js +15 -11
- package/src/input/gamepad.js +13 -13
- package/src/input/input.js +1 -1
- package/src/input/keyboard.js +14 -16
- package/src/input/pointer.js +42 -35
- package/src/input/pointerevent.js +25 -33
- package/src/lang/deprecated.js +3 -3
- package/src/level/level.js +24 -16
- package/src/level/tiled/TMXGroup.js +6 -6
- package/src/level/tiled/TMXLayer.js +31 -31
- package/src/level/tiled/TMXObject.js +19 -19
- package/src/level/tiled/TMXTile.js +11 -12
- package/src/level/tiled/TMXTileMap.js +23 -21
- package/src/level/tiled/TMXTileset.js +13 -13
- package/src/level/tiled/TMXTilesetGroup.js +4 -4
- package/src/level/tiled/TMXUtils.js +13 -11
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +17 -17
- package/src/loader/loader.js +31 -27
- package/src/loader/loadingscreen.js +40 -72
- package/src/math/color.js +45 -64
- package/src/math/math.js +17 -17
- package/src/math/matrix2.js +46 -46
- package/src/math/matrix3.js +64 -64
- package/src/math/observable_vector2.js +45 -57
- package/src/math/observable_vector3.js +56 -70
- package/src/math/vector2.js +60 -59
- package/src/math/vector3.js +65 -64
- package/src/particles/emitter.js +53 -55
- package/src/particles/particle.js +1 -1
- package/src/physics/body.js +45 -51
- package/src/physics/bounds.js +36 -36
- package/src/physics/collision.js +15 -16
- package/src/physics/detector.js +10 -11
- package/src/physics/quadtree.js +19 -17
- package/src/physics/sat.js +17 -17
- package/src/physics/world.js +13 -10
- package/src/plugin/plugin.js +6 -6
- package/src/renderable/GUI.js +13 -18
- package/src/renderable/collectable.js +3 -3
- package/src/renderable/colorlayer.js +4 -4
- package/src/renderable/container.js +65 -46
- package/src/renderable/imagelayer.js +32 -31
- package/src/renderable/nineslicesprite.js +211 -0
- package/src/renderable/renderable.js +69 -67
- package/src/renderable/sprite.js +57 -43
- package/src/renderable/trigger.js +14 -15
- package/src/shapes/ellipse.js +27 -26
- package/src/shapes/line.js +8 -7
- package/src/shapes/poly.js +33 -31
- package/src/shapes/rectangle.js +50 -96
- package/src/state/stage.js +8 -8
- package/src/state/state.js +56 -56
- package/src/system/device.js +97 -84
- package/src/system/event.js +72 -72
- package/src/system/pooling.js +14 -14
- package/src/system/save.js +6 -3
- package/src/system/timer.js +20 -20
- package/src/text/bitmaptext.js +27 -33
- package/src/text/bitmaptextdata.js +9 -9
- package/src/text/text.js +118 -59
- package/src/tweens/easing.js +4 -4
- package/src/tweens/interpolation.js +4 -4
- package/src/tweens/tween.js +37 -27
- package/src/utils/agent.js +9 -8
- package/src/utils/array.js +4 -4
- package/src/utils/file.js +4 -4
- package/src/utils/function.js +5 -5
- package/src/utils/string.js +12 -12
- package/src/utils/utils.js +19 -19
- package/src/video/canvas/canvas_renderer.js +90 -90
- package/src/video/renderer.js +40 -39
- package/src/video/texture.js +85 -76
- package/src/video/texture_cache.js +11 -0
- package/src/video/video.js +30 -30
- package/src/video/webgl/buffer/vertex.js +9 -1
- package/src/video/webgl/glshader.js +20 -20
- package/src/video/webgl/webgl_compositor.js +47 -37
- package/src/video/webgl/webgl_renderer.js +104 -104
package/src/physics/quadtree.js
CHANGED
|
@@ -57,9 +57,9 @@ var QT_VECTOR = new Vector2d();
|
|
|
57
57
|
* @constructor
|
|
58
58
|
* @see me.game.world.broadphase
|
|
59
59
|
* @param {me.Bounds} bounds bounds of the node
|
|
60
|
-
* @param {
|
|
61
|
-
* @param {
|
|
62
|
-
* @param {
|
|
60
|
+
* @param {number} [max_objects=4] max objects a node can hold before splitting into 4 subnodes
|
|
61
|
+
* @param {number} [max_levels=4] total max levels inside root Quadtree
|
|
62
|
+
* @param {number} [level] deepth level, required for subnodes
|
|
63
63
|
*/
|
|
64
64
|
class QuadTree {
|
|
65
65
|
|
|
@@ -120,23 +120,24 @@ class QuadTree {
|
|
|
120
120
|
/*
|
|
121
121
|
* Determine which node the object belongs to
|
|
122
122
|
* @param {me.Rect} rect bounds of the area to be checked
|
|
123
|
-
* @
|
|
123
|
+
* @returns Integer index of the subnode (0-3), or -1 if rect cannot completely fit within a subnode and is part of the parent node
|
|
124
124
|
*/
|
|
125
125
|
getIndex(item) {
|
|
126
126
|
var pos;
|
|
127
|
+
var bounds = item.getBounds();
|
|
127
128
|
|
|
128
129
|
// use game world coordinates for floating items
|
|
129
|
-
if (item.
|
|
130
|
-
pos = viewport.localToWorld(
|
|
130
|
+
if (item.isFloating === true) {
|
|
131
|
+
pos = viewport.localToWorld(bounds.left, bounds.top, QT_VECTOR);
|
|
131
132
|
} else {
|
|
132
|
-
pos = QT_VECTOR.set(
|
|
133
|
+
pos = QT_VECTOR.set(bounds.left, bounds.top);
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
var index = -1,
|
|
136
137
|
rx = pos.x,
|
|
137
138
|
ry = pos.y,
|
|
138
|
-
rw =
|
|
139
|
-
rh =
|
|
139
|
+
rw = bounds.width,
|
|
140
|
+
rh = bounds.height,
|
|
140
141
|
verticalMidpoint = this.bounds.left + (this.bounds.width / 2),
|
|
141
142
|
horizontalMidpoint = this.bounds.top + (this.bounds.height / 2),
|
|
142
143
|
//rect can completely fit within the top quadrants
|
|
@@ -197,7 +198,7 @@ class QuadTree {
|
|
|
197
198
|
* @name insert
|
|
198
199
|
* @memberOf me.QuadTree
|
|
199
200
|
* @function
|
|
200
|
-
* @param {
|
|
201
|
+
* @param {object} item object to be added
|
|
201
202
|
*/
|
|
202
203
|
insert(item) {
|
|
203
204
|
var index = -1;
|
|
@@ -242,9 +243,9 @@ class QuadTree {
|
|
|
242
243
|
* @name retrieve
|
|
243
244
|
* @memberOf me.QuadTree
|
|
244
245
|
* @function
|
|
245
|
-
* @param {
|
|
246
|
-
* @param {
|
|
247
|
-
* @
|
|
246
|
+
* @param {object} item object to be checked against
|
|
247
|
+
* @param {object} [fn] a sorting function for the returned array
|
|
248
|
+
* @returns {object[]} array with all detected objects
|
|
248
249
|
*/
|
|
249
250
|
retrieve(item, fn) {
|
|
250
251
|
var returnObjects = this.objects;
|
|
@@ -278,8 +279,8 @@ class QuadTree {
|
|
|
278
279
|
* @name remove
|
|
279
280
|
* @memberOf me.QuadTree
|
|
280
281
|
* @function
|
|
281
|
-
* @param {
|
|
282
|
-
* @
|
|
282
|
+
* @param {object} item object to be removed
|
|
283
|
+
* @returns {boolean} true if the item was found and removed.
|
|
283
284
|
*/
|
|
284
285
|
remove(item) {
|
|
285
286
|
var found = false;
|
|
@@ -319,7 +320,7 @@ class QuadTree {
|
|
|
319
320
|
* @name isPrunable
|
|
320
321
|
* @memberOf me.QuadTree
|
|
321
322
|
* @function
|
|
322
|
-
* @
|
|
323
|
+
* @returns {boolean} true if the node is prunable
|
|
323
324
|
*/
|
|
324
325
|
isPrunable() {
|
|
325
326
|
return !(this.hasChildren() || (this.objects.length > 0));
|
|
@@ -330,7 +331,7 @@ class QuadTree {
|
|
|
330
331
|
* @name hasChildren
|
|
331
332
|
* @memberOf me.QuadTree
|
|
332
333
|
* @function
|
|
333
|
-
* @
|
|
334
|
+
* @returns {boolean} true if the node has any children
|
|
334
335
|
*/
|
|
335
336
|
hasChildren() {
|
|
336
337
|
for (var i = 0; i < this.nodes.length; i = i + 1) {
|
|
@@ -347,6 +348,7 @@ class QuadTree {
|
|
|
347
348
|
* @name clear
|
|
348
349
|
* @memberOf me.QuadTree
|
|
349
350
|
* @function
|
|
351
|
+
* @param {me.Bounds} [bounds=this.bounds] the bounds to be cleared
|
|
350
352
|
*/
|
|
351
353
|
clear(bounds) {
|
|
352
354
|
this.objects.length = 0;
|
package/src/physics/sat.js
CHANGED
|
@@ -26,7 +26,7 @@ var RIGHT_VORNOI_REGION = 1;
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* A pool of `Vector` objects that are used in calculations to avoid allocating memory.
|
|
29
|
-
* @type {Array.<
|
|
29
|
+
* @type {Array.<me.Vector2d>}
|
|
30
30
|
* @ignore
|
|
31
31
|
*/
|
|
32
32
|
var T_VECTORS = [];
|
|
@@ -46,8 +46,8 @@ 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.<
|
|
50
|
-
* @param {
|
|
49
|
+
* @param {Array.<me.Vector2d>} points The points to flatten.
|
|
50
|
+
* @param {me.Vector2d} normal The unit vector axis to flatten on.
|
|
51
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.
|
|
@@ -70,15 +70,15 @@ 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 {
|
|
74
|
-
* @param {
|
|
75
|
-
* @param {Array.<
|
|
76
|
-
* @param {Array.<
|
|
77
|
-
* @param {
|
|
73
|
+
* @param {me.Vector2d} aPos The position of the first polygon.
|
|
74
|
+
* @param {me.Vector2d} bPos The position of the second polygon.
|
|
75
|
+
* @param {Array.<me.Vector2d>} aPoints The points in the first polygon.
|
|
76
|
+
* @param {Array.<me.Vector2d>} bPoints The points in the second polygon.
|
|
77
|
+
* @param {me.Vector2d} axis The axis (unit sized) to test against. The points of both polygons
|
|
78
78
|
* will be projected onto this axis.
|
|
79
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
|
|
83
83
|
* the direction of the overlap will be populated.
|
|
84
84
|
*/
|
|
@@ -161,9 +161,9 @@ function isSeparatingAxis(aPos, bPos, aPoints, bPoints, axis, response) {
|
|
|
161
161
|
* </pre>
|
|
162
162
|
*
|
|
163
163
|
* @ignore
|
|
164
|
-
* @param {
|
|
165
|
-
* @param {
|
|
166
|
-
* @
|
|
164
|
+
* @param {me.Vector2d} line The line segment.
|
|
165
|
+
* @param {me.Vector2d} point The point.
|
|
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.
|
|
169
169
|
*/
|
|
@@ -192,7 +192,7 @@ function vornoiRegion(line, point) {
|
|
|
192
192
|
* @param {me.Renderable} b a reference to the object B.
|
|
193
193
|
* @param {me.Polygon} polyB a reference to the object B Polygon to be tested
|
|
194
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) {
|
|
198
198
|
// specific point for
|
|
@@ -247,7 +247,7 @@ export function testPolygonPolygon(a, polyA, b, polyB, response) {
|
|
|
247
247
|
* @param {me.Ellipse} ellipseB a reference to the object B Ellipse to be tested
|
|
248
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
|
*/
|
|
252
252
|
export function testEllipseEllipse(a, ellipseA, b, ellipseB, response) {
|
|
253
253
|
// Check if the distance between the centers of the two
|
|
@@ -287,7 +287,7 @@ export function testEllipseEllipse(a, ellipseA, b, ellipseB, response) {
|
|
|
287
287
|
* @param {me.Renderable} b a reference to the object B.
|
|
288
288
|
* @param {me.Ellipse} ellipseB a reference to the object B Ellipse to be tested
|
|
289
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) {
|
|
293
293
|
// Get the position of the circle relative to the polygon.
|
|
@@ -450,11 +450,11 @@ export function testPolygonEllipse(a, polyA, b, ellipseB, response) {
|
|
|
450
450
|
* @ignore
|
|
451
451
|
* @param {me.Renderable} a a reference to the object A.
|
|
452
452
|
* @param {me.Ellipse} ellipseA a reference to the object A Ellipse to be tested
|
|
453
|
-
* @param {me.Renderable}
|
|
453
|
+
* @param {me.Renderable} b a reference to the object B.
|
|
454
454
|
* @param {me.Polygon} polyB a reference to the object B Polygon to be tested
|
|
455
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
|
*/
|
|
459
459
|
export function testEllipsePolygon(a, ellipseA, b, polyB, response) {
|
|
460
460
|
// Test the polygon against the circle.
|
package/src/physics/world.js
CHANGED
|
@@ -7,15 +7,16 @@ import { collisionCheck } from "./detector.js";
|
|
|
7
7
|
import state from "./../state/state.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
+
* @classdesc
|
|
10
11
|
* an object representing the physic world, and responsible for managing and updating all childs and physics
|
|
11
|
-
* @class
|
|
12
|
+
* @class World
|
|
12
13
|
* @extends me.Container
|
|
13
14
|
* @memberOf me
|
|
14
15
|
* @constructor
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
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} [w=me.game.viewport.width] width of the container
|
|
19
|
+
* @param {number} [h=me.game.viewport.height] height of the container
|
|
19
20
|
*/
|
|
20
21
|
class World extends Container {
|
|
21
22
|
/**
|
|
@@ -36,7 +37,7 @@ class World extends Container {
|
|
|
36
37
|
* the rate at which the game world is updated,
|
|
37
38
|
* may be greater than or lower than the display fps
|
|
38
39
|
* @public
|
|
39
|
-
* @type me.Vector2d
|
|
40
|
+
* @type {me.Vector2d}
|
|
40
41
|
* @default 60
|
|
41
42
|
* @name fps
|
|
42
43
|
* @memberOf me.World
|
|
@@ -47,7 +48,7 @@ class World extends Container {
|
|
|
47
48
|
/**
|
|
48
49
|
* world gravity
|
|
49
50
|
* @public
|
|
50
|
-
* @type me.Vector2d
|
|
51
|
+
* @type {me.Vector2d}
|
|
51
52
|
* @default <0,0.98>
|
|
52
53
|
* @name gravity
|
|
53
54
|
* @memberOf me.World
|
|
@@ -62,7 +63,7 @@ class World extends Container {
|
|
|
62
63
|
* (amount of layer, layer size, amount of tiles per layer, etc.)<br>
|
|
63
64
|
* note : rendering method is also configurable per layer by adding this
|
|
64
65
|
* property to your layer (in Tiled).
|
|
65
|
-
* @type {
|
|
66
|
+
* @type {boolean}
|
|
66
67
|
* @default false
|
|
67
68
|
* @memberOf me.World
|
|
68
69
|
*/
|
|
@@ -124,7 +125,7 @@ class World extends Container {
|
|
|
124
125
|
* @see me.Container.addChild
|
|
125
126
|
* @function
|
|
126
127
|
* @param {me.Body} body
|
|
127
|
-
* @
|
|
128
|
+
* @returns {me.World} this game world
|
|
128
129
|
*/
|
|
129
130
|
addBody(body) {
|
|
130
131
|
//add it to the list of active body
|
|
@@ -139,7 +140,7 @@ class World extends Container {
|
|
|
139
140
|
* @see me.Container.removeChild
|
|
140
141
|
* @function
|
|
141
142
|
* @param {me.Body} body
|
|
142
|
-
* @
|
|
143
|
+
* @returns {me.World} this game world
|
|
143
144
|
*/
|
|
144
145
|
removeBody(body) {
|
|
145
146
|
//remove from the list of active body
|
|
@@ -152,6 +153,8 @@ class World extends Container {
|
|
|
152
153
|
* @name reset
|
|
153
154
|
* @memberOf me.World
|
|
154
155
|
* @function
|
|
156
|
+
* @param {number} dt the time passed since the last frame update
|
|
157
|
+
* @returns {boolean} true if the word is dirty
|
|
155
158
|
*/
|
|
156
159
|
update (dt) {
|
|
157
160
|
var isPaused = state.isPaused();
|
package/src/plugin/plugin.js
CHANGED
|
@@ -17,7 +17,7 @@ class BasePlugin {
|
|
|
17
17
|
* define the minimum required version of melonJS<br>
|
|
18
18
|
* this can be overridden by the plugin
|
|
19
19
|
* @public
|
|
20
|
-
* @type
|
|
20
|
+
* @type {string}
|
|
21
21
|
* @default "__VERSION__"
|
|
22
22
|
* @name me.plugin.Base#version
|
|
23
23
|
*/
|
|
@@ -49,8 +49,8 @@ export var plugin = {
|
|
|
49
49
|
* @memberOf me.plugin
|
|
50
50
|
* @public
|
|
51
51
|
* @function
|
|
52
|
-
* @param {
|
|
53
|
-
* @param {
|
|
52
|
+
* @param {object} proto target object
|
|
53
|
+
* @param {string} name target function
|
|
54
54
|
* @param {Function} fn replacement function
|
|
55
55
|
* @example
|
|
56
56
|
* // redefine the me.game.update function with a new one
|
|
@@ -95,9 +95,9 @@ export var plugin = {
|
|
|
95
95
|
* @see me.plugin.Base
|
|
96
96
|
* @public
|
|
97
97
|
* @function
|
|
98
|
-
* @param {me.plugin.Base}
|
|
99
|
-
* @param {
|
|
100
|
-
* @param {} [arguments
|
|
98
|
+
* @param {me.plugin.Base} pluginObj Plugin object to instantiate and register
|
|
99
|
+
* @param {string} name
|
|
100
|
+
* @param {object} [...arguments] all extra parameters will be passed to the plugin constructor
|
|
101
101
|
* @example
|
|
102
102
|
* // register a new plugin
|
|
103
103
|
* me.plugin.register(TestPlugin, "testPlugin");
|
package/src/renderable/GUI.js
CHANGED
|
@@ -13,11 +13,10 @@ import { registerPointerEvent, releasePointerEvent} from "./../input/input.js";
|
|
|
13
13
|
* @extends me.Sprite
|
|
14
14
|
* @memberOf me
|
|
15
15
|
* @constructor
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
16
|
+
* @param {number} x the x coordinate of the GUI Object
|
|
17
|
+
* @param {number} y the y coordinate of the GUI Object
|
|
18
|
+
* @param {object} settings See {@link me.Sprite}
|
|
19
19
|
* @example
|
|
20
|
-
*
|
|
21
20
|
* // create a basic GUI Object
|
|
22
21
|
* class myButton extends GUI_Object {
|
|
23
22
|
* constructor(x, y) {
|
|
@@ -42,7 +41,6 @@ import { registerPointerEvent, releasePointerEvent} from "./../input/input.js";
|
|
|
42
41
|
*
|
|
43
42
|
* // add the object at pos (10,10)
|
|
44
43
|
* me.game.world.addChild(new myButton(10,10));
|
|
45
|
-
*
|
|
46
44
|
*/
|
|
47
45
|
|
|
48
46
|
class GUI_Object extends Sprite {
|
|
@@ -58,7 +56,7 @@ class GUI_Object extends Sprite {
|
|
|
58
56
|
/**
|
|
59
57
|
* object can be clicked or not
|
|
60
58
|
* @public
|
|
61
|
-
* @type boolean
|
|
59
|
+
* @type {boolean}
|
|
62
60
|
* @default true
|
|
63
61
|
* @name me.GUI_Object#isClickable
|
|
64
62
|
*/
|
|
@@ -75,7 +73,7 @@ class GUI_Object extends Sprite {
|
|
|
75
73
|
/**
|
|
76
74
|
* object can be tap and hold
|
|
77
75
|
* @public
|
|
78
|
-
* @type boolean
|
|
76
|
+
* @type {boolean}
|
|
79
77
|
* @default false
|
|
80
78
|
* @name me.GUI_Object#isHoldable
|
|
81
79
|
*/
|
|
@@ -84,7 +82,7 @@ class GUI_Object extends Sprite {
|
|
|
84
82
|
/**
|
|
85
83
|
* true if the pointer is over the object
|
|
86
84
|
* @public
|
|
87
|
-
* @type boolean
|
|
85
|
+
* @type {boolean}
|
|
88
86
|
* @default false
|
|
89
87
|
* @name me.GUI_Object#hover
|
|
90
88
|
*/
|
|
@@ -122,14 +120,13 @@ class GUI_Object extends Sprite {
|
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
/**
|
|
125
|
-
* function called when the object is pressed
|
|
126
|
-
* to be extended <br>
|
|
127
|
-
* return false if we need to stop propagating the event
|
|
123
|
+
* function called when the object is pressed (to be extended)
|
|
128
124
|
* @name onClick
|
|
129
125
|
* @memberOf me.GUI_Object.prototype
|
|
130
126
|
* @public
|
|
131
127
|
* @function
|
|
132
|
-
* @param {
|
|
128
|
+
* @param {me.Pointer} event the event object
|
|
129
|
+
* @returns {boolean} return false if we need to stop propagating the event
|
|
133
130
|
*/
|
|
134
131
|
onClick(/* event */) {
|
|
135
132
|
return false;
|
|
@@ -151,7 +148,7 @@ class GUI_Object extends Sprite {
|
|
|
151
148
|
* @memberOf me.GUI_Object.prototype
|
|
152
149
|
* @public
|
|
153
150
|
* @function
|
|
154
|
-
* @param {
|
|
151
|
+
* @param {me.Pointer} event the event object
|
|
155
152
|
*/
|
|
156
153
|
onOver(/* event */) {}
|
|
157
154
|
|
|
@@ -172,7 +169,7 @@ class GUI_Object extends Sprite {
|
|
|
172
169
|
* @memberOf me.GUI_Object.prototype
|
|
173
170
|
* @public
|
|
174
171
|
* @function
|
|
175
|
-
* @param {
|
|
172
|
+
* @param {me.Pointer} event the event object
|
|
176
173
|
*/
|
|
177
174
|
onOut(/* event */) {
|
|
178
175
|
|
|
@@ -192,14 +189,12 @@ class GUI_Object extends Sprite {
|
|
|
192
189
|
}
|
|
193
190
|
|
|
194
191
|
/**
|
|
195
|
-
* function called when the object is pressed and released
|
|
196
|
-
* to be extended <br>
|
|
197
|
-
* return false if we need to stop propagating the event
|
|
192
|
+
* function called when the object is pressed and released (to be extended)
|
|
198
193
|
* @name onRelease
|
|
199
194
|
* @memberOf me.GUI_Object.prototype
|
|
200
195
|
* @public
|
|
201
196
|
* @function
|
|
202
|
-
* @
|
|
197
|
+
* @returns {boolean} return false if we need to stop propagating the event
|
|
203
198
|
*/
|
|
204
199
|
onRelease() {
|
|
205
200
|
return false;
|
|
@@ -10,9 +10,9 @@ import collision from "./../physics/collision.js";
|
|
|
10
10
|
* @extends me.Sprite
|
|
11
11
|
* @memberOf me
|
|
12
12
|
* @constructor
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
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 me.Sprite}
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
class Collectable extends Sprite {
|
|
@@ -10,9 +10,9 @@ import Renderable from "./renderable.js";
|
|
|
10
10
|
* @extends me.Renderable
|
|
11
11
|
* @memberOf me
|
|
12
12
|
* @constructor
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {me.Color|
|
|
15
|
-
* @param {
|
|
13
|
+
* @param {string} name Layer name
|
|
14
|
+
* @param {me.Color|string} color CSS color
|
|
15
|
+
* @param {number} [z = 0] z-index position
|
|
16
16
|
*/
|
|
17
17
|
class ColorLayer extends Renderable {
|
|
18
18
|
|
|
@@ -26,7 +26,7 @@ class ColorLayer extends Renderable {
|
|
|
26
26
|
/**
|
|
27
27
|
* the layer color component
|
|
28
28
|
* @public
|
|
29
|
-
* @type me.Color
|
|
29
|
+
* @type {me.Color}
|
|
30
30
|
* @name color
|
|
31
31
|
* @memberOf me.ColorLayer#
|
|
32
32
|
*/
|