melonjs 14.1.0 → 14.1.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 +8 -3
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/_virtual/index2.js +1 -1
- package/dist/melonjs.mjs/_virtual/multimap.js +1 -1
- package/dist/melonjs.mjs/_virtual/setmultimap.js +1 -1
- package/dist/melonjs.mjs/application/application.js +3 -5
- package/dist/melonjs.mjs/audio/audio.js +1 -1
- package/dist/melonjs.mjs/camera/camera2d.js +3 -4
- package/dist/melonjs.mjs/entity/entity.js +3 -4
- package/dist/melonjs.mjs/game.js +1 -1
- package/dist/melonjs.mjs/geometries/ellipse.js +3 -4
- package/dist/melonjs.mjs/geometries/line.js +3 -4
- package/dist/melonjs.mjs/geometries/path2d.js +3 -4
- package/dist/melonjs.mjs/geometries/point.js +3 -4
- package/dist/melonjs.mjs/geometries/poly.js +3 -5
- package/dist/melonjs.mjs/geometries/rectangle.js +3 -4
- package/dist/melonjs.mjs/geometries/roundrect.js +2 -3
- package/dist/melonjs.mjs/index.js +2 -2
- package/dist/melonjs.mjs/input/gamepad.js +1 -1
- package/dist/melonjs.mjs/input/input.js +1 -1
- package/dist/melonjs.mjs/input/keyboard.js +1 -1
- package/dist/melonjs.mjs/input/pointer.js +1 -1
- package/dist/melonjs.mjs/input/pointerevent.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +1 -1
- package/dist/melonjs.mjs/level/level.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +3 -5
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +3 -4
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +5 -8
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +3 -5
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +3 -5
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +3 -5
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +3 -5
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +3 -5
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +3 -4
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +3 -5
- 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/math/color.js +3 -5
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +3 -5
- package/dist/melonjs.mjs/math/matrix3.js +3 -5
- package/dist/melonjs.mjs/math/observable_vector2.js +3 -5
- package/dist/melonjs.mjs/math/observable_vector3.js +3 -5
- package/dist/melonjs.mjs/math/vector2.js +3 -5
- package/dist/melonjs.mjs/math/vector3.js +3 -5
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.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 +9 -0
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +3 -5
- package/dist/melonjs.mjs/particles/particle.js +3 -5
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +3 -5
- package/dist/melonjs.mjs/physics/bounds.js +3 -4
- package/dist/melonjs.mjs/physics/collision.js +1 -1
- package/dist/melonjs.mjs/physics/detector.js +1 -5
- package/dist/melonjs.mjs/physics/quadtree.js +23 -20
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +1 -1
- package/dist/melonjs.mjs/physics/world.js +3 -5
- package/dist/melonjs.mjs/plugin/plugin.js +3 -3
- package/dist/melonjs.mjs/renderable/collectable.js +3 -5
- package/dist/melonjs.mjs/renderable/colorlayer.js +3 -5
- package/dist/melonjs.mjs/renderable/container.js +6 -8
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +4 -5
- package/dist/melonjs.mjs/renderable/light2d.js +3 -4
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +3 -4
- package/dist/melonjs.mjs/renderable/renderable.js +5 -7
- package/dist/melonjs.mjs/renderable/sprite.js +3 -4
- package/dist/melonjs.mjs/renderable/trigger.js +3 -4
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +3 -4
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +3 -4
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +3 -4
- package/dist/melonjs.mjs/state/stage.js +3 -4
- package/dist/melonjs.mjs/state/state.js +1 -1
- package/dist/melonjs.mjs/system/device.js +1 -1
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +1 -1
- package/dist/melonjs.mjs/system/platform.js +1 -1
- package/dist/melonjs.mjs/system/pooling.js +1 -1
- package/dist/melonjs.mjs/system/save.js +1 -1
- package/dist/melonjs.mjs/system/timer.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptext.js +3 -4
- package/dist/melonjs.mjs/text/bitmaptextdata.js +3 -4
- package/dist/melonjs.mjs/text/glyph.js +3 -4
- package/dist/melonjs.mjs/text/text.js +3 -4
- package/dist/melonjs.mjs/text/textmetrics.js +3 -4
- 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 +3 -4
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +1 -1
- package/dist/melonjs.mjs/utils/string.js +1 -1
- package/dist/melonjs.mjs/utils/utils.js +1 -1
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +3 -4
- package/dist/melonjs.mjs/video/renderer.js +4 -5
- package/dist/melonjs.mjs/video/texture/atlas.js +1 -1
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +1 -1
- package/dist/melonjs.mjs/video/video.js +1 -1
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +3 -4
- package/dist/melonjs.mjs/video/webgl/glshader.js +3 -4
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +3 -4
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +3 -4
- package/dist/melonjs.module.js +659 -740
- package/dist/types/index.d.ts +108 -0
- package/package.json +19 -19
- package/src/application/application.js +1 -2
- package/src/camera/camera2d.js +1 -2
- package/src/entity/entity.js +1 -2
- package/src/geometries/ellipse.js +1 -2
- package/src/geometries/line.js +1 -2
- package/src/geometries/path2d.js +1 -2
- package/src/geometries/point.js +1 -2
- package/src/geometries/poly.js +1 -3
- package/src/geometries/rectangle.js +1 -2
- package/src/geometries/roundrect.js +1 -2
- package/src/level/tiled/TMXLayer.js +1 -2
- package/src/level/tiled/TMXTile.js +1 -2
- package/src/level/tiled/TMXTileMap.js +2 -4
- package/src/level/tiled/TMXTileset.js +1 -2
- package/src/level/tiled/TMXTilesetGroup.js +1 -2
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -2
- package/src/math/color.js +1 -2
- package/src/math/matrix2.js +1 -2
- package/src/math/matrix3.js +1 -2
- package/src/math/observable_vector2.js +1 -2
- package/src/math/observable_vector3.js +1 -2
- package/src/math/vector2.js +1 -2
- package/src/math/vector3.js +1 -2
- package/src/particles/emitter.js +1 -2
- package/src/particles/particle.js +1 -2
- package/src/physics/body.js +1 -2
- package/src/physics/bounds.js +2 -2
- package/src/physics/detector.js +0 -4
- package/src/physics/quadtree.js +7 -12
- package/src/physics/world.js +1 -2
- package/src/renderable/collectable.js +1 -3
- package/src/renderable/colorlayer.js +1 -3
- package/src/renderable/container.js +4 -6
- package/src/renderable/imagelayer.js +1 -2
- package/src/renderable/light2d.js +1 -2
- package/src/renderable/nineslicesprite.js +1 -2
- package/src/renderable/renderable.js +3 -5
- package/src/renderable/sprite.js +1 -2
- package/src/renderable/trigger.js +1 -2
- package/src/renderable/ui/uibaseelement.js +1 -2
- package/src/renderable/ui/uispriteelement.js +2 -2
- package/src/renderable/ui/uitextbutton.js +2 -2
- package/src/state/stage.js +1 -2
- package/src/text/bitmaptext.js +1 -2
- package/src/text/bitmaptextdata.js +1 -2
- package/src/text/glyph.js +1 -2
- package/src/text/text.js +1 -2
- package/src/text/textmetrics.js +1 -2
- package/src/tweens/tween.js +1 -2
- package/src/video/canvas/canvas_renderer.js +1 -2
- package/src/video/renderer.js +1 -2
- package/src/video/webgl/buffer/vertex.js +1 -2
- package/src/video/webgl/glshader.js +2 -2
- package/src/video/webgl/webgl_compositor.js +1 -2
- package/src/video/webgl/webgl_renderer.js +1 -2
- package/dist/melonjs.module.d.ts +0 -14020
package/src/physics/bounds.js
CHANGED
|
@@ -5,7 +5,7 @@ import Vector2d from "./../math/vector2.js";
|
|
|
5
5
|
* @classdesc
|
|
6
6
|
* a bound object contains methods for creating and manipulating axis-aligned bounding boxes (AABB).
|
|
7
7
|
*/
|
|
8
|
-
class Bounds {
|
|
8
|
+
export default class Bounds {
|
|
9
9
|
/**
|
|
10
10
|
* @param {Vector2d[]} [vertices] - an array of me.Vector2d points
|
|
11
11
|
*/
|
|
@@ -448,4 +448,4 @@ class Bounds {
|
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
}
|
|
451
|
-
|
|
451
|
+
|
package/src/physics/detector.js
CHANGED
|
@@ -25,8 +25,6 @@ let globalResponse = new ResponseObject();
|
|
|
25
25
|
/**
|
|
26
26
|
* a function used to determine if two objects should collide (based on both respective objects collision mask and type).<br>
|
|
27
27
|
* you can redefine this function if you need any specific rules over what should collide with what.
|
|
28
|
-
* @name shouldCollide
|
|
29
|
-
* @memberof collision
|
|
30
28
|
* @ignore
|
|
31
29
|
* @param {Renderable} a - a reference to the object A.
|
|
32
30
|
* @param {Renderable} b - a reference to the object B.
|
|
@@ -50,7 +48,6 @@ function shouldCollide(a, b) {
|
|
|
50
48
|
|
|
51
49
|
/**
|
|
52
50
|
* find all the collisions for the specified object
|
|
53
|
-
* @name collisionCheck
|
|
54
51
|
* @ignore
|
|
55
52
|
* @param {Renderable} objA - object to be tested for collision
|
|
56
53
|
* @param {ResponseObject} [response] - a user defined response object that will be populated if they intersect.
|
|
@@ -113,7 +110,6 @@ export function collisionCheck(objA, response = globalResponse) {
|
|
|
113
110
|
|
|
114
111
|
/**
|
|
115
112
|
* Checks for object colliding with the given line
|
|
116
|
-
* @name rayCast
|
|
117
113
|
* @ignore
|
|
118
114
|
* @param {Line} line - line to be tested for collision
|
|
119
115
|
* @param {Array.<Renderable>} [result] - a user defined array that will be populated with intersecting physic objects.
|
package/src/physics/quadtree.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Vector2d from "./../math/vector2.js";
|
|
2
|
-
import Container from "./../renderable/container.js";
|
|
3
2
|
import * as arrayUtil from "./../utils/array.js";
|
|
4
3
|
|
|
5
4
|
/*
|
|
@@ -8,7 +7,6 @@ import * as arrayUtil from "./../utils/array.js";
|
|
|
8
7
|
* https://github.com/timohausmann/quadtree-js/
|
|
9
8
|
**/
|
|
10
9
|
|
|
11
|
-
|
|
12
10
|
/**
|
|
13
11
|
* a pool of `QuadTree` objects
|
|
14
12
|
* @ignore
|
|
@@ -53,7 +51,7 @@ var QT_VECTOR = new Vector2d();
|
|
|
53
51
|
* a QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
|
|
54
52
|
* @see game.world.broadphase
|
|
55
53
|
*/
|
|
56
|
-
class QuadTree {
|
|
54
|
+
export default class QuadTree {
|
|
57
55
|
/**
|
|
58
56
|
* @param {World} world - the physic world this QuadTree belongs to
|
|
59
57
|
* @param {Bounds} bounds - bounds of the node
|
|
@@ -70,7 +68,6 @@ class QuadTree {
|
|
|
70
68
|
this.max_levels = max_levels;
|
|
71
69
|
|
|
72
70
|
this.level = level;
|
|
73
|
-
this.bounds = bounds;
|
|
74
71
|
|
|
75
72
|
this.objects = [];
|
|
76
73
|
this.nodes = [];
|
|
@@ -89,7 +86,7 @@ class QuadTree {
|
|
|
89
86
|
//top right node
|
|
90
87
|
this.nodes[0] = QT_ARRAY_POP(
|
|
91
88
|
this.world,
|
|
92
|
-
|
|
89
|
+
{
|
|
93
90
|
left : left + subWidth,
|
|
94
91
|
top : top,
|
|
95
92
|
width : subWidth,
|
|
@@ -103,7 +100,7 @@ class QuadTree {
|
|
|
103
100
|
//top left node
|
|
104
101
|
this.nodes[1] = QT_ARRAY_POP(
|
|
105
102
|
this.world,
|
|
106
|
-
|
|
103
|
+
{
|
|
107
104
|
left : left,
|
|
108
105
|
top: top,
|
|
109
106
|
width : subWidth,
|
|
@@ -117,7 +114,7 @@ class QuadTree {
|
|
|
117
114
|
//bottom left node
|
|
118
115
|
this.nodes[2] = QT_ARRAY_POP(
|
|
119
116
|
this.world,
|
|
120
|
-
|
|
117
|
+
{
|
|
121
118
|
left : left,
|
|
122
119
|
top : top + subHeight,
|
|
123
120
|
width : subWidth,
|
|
@@ -131,7 +128,7 @@ class QuadTree {
|
|
|
131
128
|
//bottom right node
|
|
132
129
|
this.nodes[3] = QT_ARRAY_POP(
|
|
133
130
|
this.world,
|
|
134
|
-
|
|
131
|
+
{
|
|
135
132
|
left : left + subWidth,
|
|
136
133
|
top : top + subHeight,
|
|
137
134
|
width : subWidth,
|
|
@@ -156,7 +153,7 @@ class QuadTree {
|
|
|
156
153
|
if (item.isFloating === true) {
|
|
157
154
|
pos = this.world.app.viewport.localToWorld(bounds.left, bounds.top, QT_VECTOR);
|
|
158
155
|
} else {
|
|
159
|
-
pos = QT_VECTOR.set(
|
|
156
|
+
pos = QT_VECTOR.set(item.left, item.top);
|
|
160
157
|
}
|
|
161
158
|
|
|
162
159
|
var index = -1,
|
|
@@ -199,7 +196,7 @@ class QuadTree {
|
|
|
199
196
|
insertContainer(container) {
|
|
200
197
|
for (var i = container.children.length, child; i--, (child = container.children[i]);) {
|
|
201
198
|
if (child.isKinematic !== true) {
|
|
202
|
-
if (child
|
|
199
|
+
if (typeof child.addChild === "function") {
|
|
203
200
|
if (child.name !== "rootContainer") {
|
|
204
201
|
this.insert(child);
|
|
205
202
|
}
|
|
@@ -386,5 +383,3 @@ class QuadTree {
|
|
|
386
383
|
}
|
|
387
384
|
}
|
|
388
385
|
}
|
|
389
|
-
|
|
390
|
-
export default QuadTree;
|
package/src/physics/world.js
CHANGED
|
@@ -11,7 +11,7 @@ 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
16
|
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
17
17
|
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
@@ -209,4 +209,3 @@ class World extends Container {
|
|
|
209
209
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
export default World;
|
|
@@ -8,7 +8,7 @@ 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
13
|
* @param {number} x - the x coordinates of the collectable
|
|
14
14
|
* @param {number} y - the y coordinates of the collectable
|
|
@@ -49,5 +49,3 @@ class Collectable extends Sprite {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
export default Collectable;
|
|
@@ -7,7 +7,7 @@ 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
12
|
* @param {string} name - Layer name
|
|
13
13
|
* @param {Color|string} color - CSS color
|
|
@@ -68,5 +68,3 @@ class ColorLayer extends Renderable {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
export default ColorLayer;
|
|
@@ -10,18 +10,18 @@ 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
26
|
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
27
27
|
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
@@ -1005,5 +1005,3 @@ class Container extends Renderable {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
|
-
|
|
1009
|
-
export default Container;
|
|
@@ -11,7 +11,7 @@ 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
16
|
* @param {number} x - x coordinate
|
|
17
17
|
* @param {number} y - y coordinate
|
|
@@ -295,4 +295,3 @@ class ImageLayer extends Sprite {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
}
|
|
298
|
-
export default ImageLayer;
|
|
@@ -49,7 +49,7 @@ 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.
|
|
@@ -144,4 +144,3 @@ class Light2d extends Renderable {
|
|
|
144
144
|
super.destroy();
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
export default Light2d;
|
|
@@ -8,7 +8,7 @@ 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
13
|
* @param {number} x - the x coordinates of the sprite object
|
|
14
14
|
* @param {number} y - the y coordinates of the sprite object
|
|
@@ -235,4 +235,3 @@ class NineSliceSprite extends Sprite {
|
|
|
235
235
|
);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
export default NineSliceSprite;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import ObservableVector2d from "./../math/observable_vector2.js";
|
|
2
2
|
import ObservableVector3d from "./../math/observable_vector3.js";
|
|
3
3
|
import Rect from "./../geometries/rectangle.js";
|
|
4
|
-
import Container from "./container.js";
|
|
5
4
|
import pool from "./../system/pooling.js";
|
|
6
5
|
import { releaseAllPointerEvents } from "./../input/input.js";
|
|
7
6
|
import { clamp } from "./../math/math.js";
|
|
@@ -12,7 +11,7 @@ import Color from "./../math/color.js";
|
|
|
12
11
|
* A base class for renderable objects.
|
|
13
12
|
* @augments Rect
|
|
14
13
|
*/
|
|
15
|
-
class Renderable extends Rect {
|
|
14
|
+
export default class Renderable extends Rect {
|
|
16
15
|
/**
|
|
17
16
|
* @param {number} x - position of the renderable object (accessible through inherited pos.x property)
|
|
18
17
|
* @param {number} y - position of the renderable object (accessible through inherited pos.y property)
|
|
@@ -558,7 +557,7 @@ class Renderable extends Rect {
|
|
|
558
557
|
*/
|
|
559
558
|
|
|
560
559
|
// XXX: This is called from the constructor, before it gets an ancestor
|
|
561
|
-
if (this.ancestor
|
|
560
|
+
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
|
|
562
561
|
bounds.translate(this.ancestor.getAbsolutePosition());
|
|
563
562
|
}
|
|
564
563
|
|
|
@@ -575,7 +574,7 @@ class Renderable extends Rect {
|
|
|
575
574
|
}
|
|
576
575
|
// XXX Cache me or something
|
|
577
576
|
this._absPos.set(this.pos.x, this.pos.y);
|
|
578
|
-
if (this.ancestor
|
|
577
|
+
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
|
|
579
578
|
this._absPos.add(this.ancestor.getAbsolutePosition());
|
|
580
579
|
}
|
|
581
580
|
return this._absPos;
|
|
@@ -771,4 +770,3 @@ class Renderable extends Rect {
|
|
|
771
770
|
}
|
|
772
771
|
|
|
773
772
|
}
|
|
774
|
-
export default Renderable;
|
package/src/renderable/sprite.js
CHANGED
|
@@ -10,7 +10,7 @@ import Color from "../math/color.js";
|
|
|
10
10
|
* An object to display a fixed or animated sprite on screen.
|
|
11
11
|
* @augments Renderable
|
|
12
12
|
*/
|
|
13
|
-
class Sprite extends Renderable {
|
|
13
|
+
export default class Sprite extends Renderable {
|
|
14
14
|
/**
|
|
15
15
|
* @param {number} x - the x coordinates of the sprite object
|
|
16
16
|
* @param {number} y - the y coordinates of the sprite object
|
|
@@ -642,4 +642,3 @@ class Sprite extends Renderable {
|
|
|
642
642
|
);
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
-
export default Sprite;
|
|
@@ -10,7 +10,7 @@ import pool from "./../system/pooling.js";
|
|
|
10
10
|
* trigger an event when colliding with another object
|
|
11
11
|
* @augments Renderable
|
|
12
12
|
*/
|
|
13
|
-
class Trigger extends Renderable {
|
|
13
|
+
export default class Trigger extends Renderable {
|
|
14
14
|
/**
|
|
15
15
|
* @param {number} x - the x coordinates of the trigger area
|
|
16
16
|
* @param {number} y - the y coordinates of the trigger area
|
|
@@ -145,4 +145,3 @@ class Trigger extends Renderable {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
}
|
|
148
|
-
export default Trigger;
|
|
@@ -9,7 +9,7 @@ import { registerPointerEvent, releasePointerEvent} from "./../../input/input.js
|
|
|
9
9
|
* text and images.
|
|
10
10
|
* @augments Container
|
|
11
11
|
*/
|
|
12
|
-
class UIBaseElement extends Container {
|
|
12
|
+
export default class UIBaseElement extends Container {
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
15
15
|
* @param {number} x - The x position of the container
|
|
@@ -201,4 +201,3 @@ class UIBaseElement extends Container {
|
|
|
201
201
|
timer.clearTimeout(this.holdTimeout);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
export default UIBaseElement;
|
|
@@ -7,7 +7,7 @@ import { registerPointerEvent, releasePointerEvent} from "./../../input/input.js
|
|
|
7
7
|
* This is a basic sprite based button which you can use in your Game UI.
|
|
8
8
|
* @augments Sprite
|
|
9
9
|
*/
|
|
10
|
-
class UISpriteElement extends Sprite {
|
|
10
|
+
export default class UISpriteElement extends Sprite {
|
|
11
11
|
/**
|
|
12
12
|
* @param {number} x - the x coordinate of the GUI Object
|
|
13
13
|
* @param {number} y - the y coordinate of the GUI Object
|
|
@@ -214,4 +214,4 @@ class UISpriteElement extends Sprite {
|
|
|
214
214
|
timer.clearTimeout(this.holdTimeout);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
|
|
@@ -9,7 +9,7 @@ import UIBaseElement from "./uibaseelement.js";
|
|
|
9
9
|
* This is a basic base text button which you can use in your Game UI.
|
|
10
10
|
* @augments UIBaseElement
|
|
11
11
|
*/
|
|
12
|
-
class UITextButton extends UIBaseElement {
|
|
12
|
+
export default class UITextButton extends UIBaseElement {
|
|
13
13
|
/**
|
|
14
14
|
* A Text Button with an outlined background border, filled with background color.
|
|
15
15
|
* It uses a RoundRect as background and changes the background color on hovering over.
|
|
@@ -117,5 +117,5 @@ class UITextButton extends UIBaseElement {
|
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
|
|
121
121
|
|
package/src/state/stage.js
CHANGED
|
@@ -18,7 +18,7 @@ var default_settings = {
|
|
|
18
18
|
* through the state manager must inherit from this base class.
|
|
19
19
|
* @see state
|
|
20
20
|
*/
|
|
21
|
-
class Stage {
|
|
21
|
+
export default class Stage {
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @param {object} [settings] - The stage` parameters
|
|
@@ -225,4 +225,3 @@ class Stage {
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
export default Stage;
|
package/src/text/bitmaptext.js
CHANGED
|
@@ -9,7 +9,7 @@ import TextMetrics from "./textmetrics.js";
|
|
|
9
9
|
* a bitmap font object
|
|
10
10
|
* @augments Renderable
|
|
11
11
|
*/
|
|
12
|
-
class BitmapText extends Renderable {
|
|
12
|
+
export default class BitmapText extends Renderable {
|
|
13
13
|
/**
|
|
14
14
|
* @param {number} x - position of the text object
|
|
15
15
|
* @param {number} y - position of the text object
|
|
@@ -358,4 +358,3 @@ class BitmapText extends Renderable {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
}
|
|
361
|
-
export default BitmapText;
|
|
@@ -56,7 +56,7 @@ function createSpaceGlyph(glyphs) {
|
|
|
56
56
|
* Class for storing relevant data from the font file.
|
|
57
57
|
* @ignore
|
|
58
58
|
*/
|
|
59
|
-
class BitmapTextData {
|
|
59
|
+
export default class BitmapTextData {
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* @param {string} data - The bitmap font data pulled from the resource loader using me.loader.getBinary()
|
|
@@ -187,4 +187,3 @@ class BitmapTextData {
|
|
|
187
187
|
this.capHeight -= padY;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
export default BitmapTextData;
|
package/src/text/glyph.js
CHANGED
|
@@ -7,7 +7,7 @@ const PAGE_SIZE = 1 << LOG2_PAGE_SIZE;
|
|
|
7
7
|
* a glyph representing a single character in a font
|
|
8
8
|
* @ignore
|
|
9
9
|
*/
|
|
10
|
-
class Glyph {
|
|
10
|
+
export default class Glyph {
|
|
11
11
|
/**
|
|
12
12
|
* @ignore
|
|
13
13
|
*/
|
|
@@ -55,4 +55,3 @@ class Glyph {
|
|
|
55
55
|
page[ch & PAGE_SIZE - 1] = value;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
export default Glyph;
|
package/src/text/text.js
CHANGED
|
@@ -36,7 +36,7 @@ var getContext2d = function (renderer, text) {
|
|
|
36
36
|
* a generic system font object.
|
|
37
37
|
* @augments Renderable
|
|
38
38
|
*/
|
|
39
|
-
class Text extends Renderable {
|
|
39
|
+
export default class Text extends Renderable {
|
|
40
40
|
/**
|
|
41
41
|
* @param {number} x - position of the text object
|
|
42
42
|
* @param {number} y - position of the text object
|
|
@@ -441,4 +441,3 @@ class Text extends Renderable {
|
|
|
441
441
|
super.destroy();
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
export default Text;
|
package/src/text/textmetrics.js
CHANGED
|
@@ -7,7 +7,7 @@ import setContextStyle from "./textstyle.js";
|
|
|
7
7
|
* a Text Metrics object that contains helper for text manipulation
|
|
8
8
|
* @augments Bounds
|
|
9
9
|
*/
|
|
10
|
-
class TextMetrics extends Bounds {
|
|
10
|
+
export default class TextMetrics extends Bounds {
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @param {Text|BitmapText} ancestor - the parent object that contains this TextMetrics object
|
|
@@ -164,4 +164,3 @@ class TextMetrics extends Bounds {
|
|
|
164
164
|
return output;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
export default TextMetrics;
|
package/src/tweens/tween.js
CHANGED
|
@@ -23,7 +23,7 @@ import { Interpolation } from "./interpolation.js";
|
|
|
23
23
|
* author lechecacharro<br>
|
|
24
24
|
* author Josh Faul / http://jocafa.com/
|
|
25
25
|
*/
|
|
26
|
-
class Tween {
|
|
26
|
+
export default class Tween {
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @param {object} object - object on which to apply the tween
|
|
@@ -468,4 +468,3 @@ class Tween {
|
|
|
468
468
|
static get Easing() { return Easing; }
|
|
469
469
|
static get Interpolation() { return Interpolation; }
|
|
470
470
|
}
|
|
471
|
-
export default Tween;
|
|
@@ -12,7 +12,7 @@ import * as event from "./../../system/event.js";
|
|
|
12
12
|
* a canvas renderer object
|
|
13
13
|
* @augments Renderer
|
|
14
14
|
*/
|
|
15
|
-
class CanvasRenderer extends Renderer {
|
|
15
|
+
export default class CanvasRenderer extends Renderer {
|
|
16
16
|
/**
|
|
17
17
|
* @param {object} options - The renderer parameters
|
|
18
18
|
* @param {number} options.width - The width of the canvas without scaling
|
|
@@ -795,4 +795,3 @@ class CanvasRenderer extends Renderer {
|
|
|
795
795
|
}
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
|
-
export default CanvasRenderer;
|
package/src/video/renderer.js
CHANGED
|
@@ -17,7 +17,7 @@ import Point from "../geometries/point.js";
|
|
|
17
17
|
* @classdesc
|
|
18
18
|
* a base renderer object
|
|
19
19
|
*/
|
|
20
|
-
class Renderer {
|
|
20
|
+
export default class Renderer {
|
|
21
21
|
/**
|
|
22
22
|
* @param {object} options - The renderer parameters
|
|
23
23
|
* @param {number} options.width - The width of the canvas without scaling
|
|
@@ -399,4 +399,3 @@ class Renderer {
|
|
|
399
399
|
drawFont(/*bounds*/) {}
|
|
400
400
|
|
|
401
401
|
}
|
|
402
|
-
export default Renderer;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @ignore
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
class VertexArrayBuffer {
|
|
8
|
+
export default class VertexArrayBuffer {
|
|
9
9
|
|
|
10
10
|
constructor(vertex_size, vertex_per_quad) {
|
|
11
11
|
// the size of one vertex in float
|
|
@@ -131,4 +131,3 @@ class VertexArrayBuffer {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
}
|
|
134
|
-
export default VertexArrayBuffer;
|
|
@@ -10,7 +10,7 @@ import { minify } from "./utils/string.js";
|
|
|
10
10
|
* @classdesc
|
|
11
11
|
* a base GL Shader object
|
|
12
12
|
*/
|
|
13
|
-
class GLShader {
|
|
13
|
+
export default class GLShader {
|
|
14
14
|
/**
|
|
15
15
|
* @param {WebGLRenderingContext} gl - the current WebGL rendering context
|
|
16
16
|
* @param {string} vertex - a string containing the GLSL source code to set
|
|
@@ -156,4 +156,4 @@ class GLShader {
|
|
|
156
156
|
this.fragment = null;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
|
|
@@ -22,7 +22,7 @@ var V_ARRAY = [
|
|
|
22
22
|
* A WebGL Compositor object. This class handles all of the WebGL state<br>
|
|
23
23
|
* Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU
|
|
24
24
|
*/
|
|
25
|
-
class WebGLCompositor {
|
|
25
|
+
export default class WebGLCompositor {
|
|
26
26
|
/**
|
|
27
27
|
* @param {WebGLRenderer} renderer - the current WebGL renderer session
|
|
28
28
|
*/
|
|
@@ -484,4 +484,3 @@ class WebGLCompositor {
|
|
|
484
484
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
-
export default WebGLCompositor;
|
|
@@ -14,7 +14,7 @@ import { isPowerOfTwo, nextPowerOfTwo } from "./../../math/math.js";
|
|
|
14
14
|
* a WebGL renderer object
|
|
15
15
|
* @augments Renderer
|
|
16
16
|
*/
|
|
17
|
-
class WebGLRenderer extends Renderer {
|
|
17
|
+
export default class WebGLRenderer extends Renderer {
|
|
18
18
|
/**
|
|
19
19
|
* @param {object} options - The renderer parameters
|
|
20
20
|
* @param {number} options.width - The width of the canvas without scaling
|
|
@@ -1024,4 +1024,3 @@ class WebGLRenderer extends Renderer {
|
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
export default WebGLRenderer;
|