melonjs 14.4.0 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/README.md +13 -57
- 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 +1 -1
- package/dist/melonjs.mjs/application/header.js +1 -1
- package/dist/melonjs.mjs/application/resize.js +1 -1
- package/dist/melonjs.mjs/application/settings.js +1 -1
- package/dist/melonjs.mjs/audio/audio.js +5 -7
- package/dist/melonjs.mjs/camera/camera2d.js +1 -1
- package/dist/melonjs.mjs/const.js +1 -1
- package/dist/melonjs.mjs/entity/entity.js +43 -9
- package/dist/melonjs.mjs/geometries/ellipse.js +2 -3
- package/dist/melonjs.mjs/geometries/line.js +1 -1
- package/dist/melonjs.mjs/geometries/path2d.js +20 -44
- package/dist/melonjs.mjs/geometries/point.js +1 -6
- package/dist/melonjs.mjs/geometries/poly.js +2 -5
- package/dist/melonjs.mjs/geometries/rectangle.js +13 -9
- package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
- package/dist/melonjs.mjs/index.js +10 -6
- package/dist/melonjs.mjs/input/gamepad.js +10 -16
- 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 +3 -17
- package/dist/melonjs.mjs/lang/console.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +1 -1
- package/dist/melonjs.mjs/level/level.js +3 -3
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +1 -8
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +8 -4
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +5 -5
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +1 -1
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
- package/dist/melonjs.mjs/loader/cache.js +24 -0
- package/dist/melonjs.mjs/loader/loader.js +331 -716
- package/dist/melonjs.mjs/loader/loadingscreen.js +4 -4
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parser.js +281 -0
- package/dist/melonjs.mjs/loader/settings.js +91 -0
- package/dist/melonjs.mjs/math/color.js +9 -8
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +7 -9
- package/dist/melonjs.mjs/math/matrix3.js +18 -21
- package/dist/melonjs.mjs/math/observable_vector2.js +3 -3
- package/dist/melonjs.mjs/math/observable_vector3.js +3 -4
- package/dist/melonjs.mjs/math/vector2.js +3 -3
- package/dist/melonjs.mjs/math/vector3.js +3 -4
- 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 +1 -1
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +3 -3
- package/dist/melonjs.mjs/particles/particle.js +1 -1
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +18 -14
- package/dist/melonjs.mjs/physics/bounds.js +18 -70
- package/dist/melonjs.mjs/physics/collision.js +1 -1
- package/dist/melonjs.mjs/physics/detector.js +1 -1
- package/dist/melonjs.mjs/physics/quadtree.js +1 -1
- 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 +1 -1
- package/dist/melonjs.mjs/plugin/plugin.js +3 -3
- package/dist/melonjs.mjs/renderable/collectable.js +1 -1
- package/dist/melonjs.mjs/renderable/colorlayer.js +1 -1
- package/dist/melonjs.mjs/renderable/container.js +25 -19
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +7 -1
- package/dist/melonjs.mjs/renderable/light2d.js +1 -1
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
- package/dist/melonjs.mjs/renderable/renderable.js +148 -105
- package/dist/melonjs.mjs/renderable/sprite.js +33 -54
- package/dist/melonjs.mjs/renderable/trigger.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +1 -3
- package/dist/melonjs.mjs/state/stage.js +1 -1
- package/dist/melonjs.mjs/state/state.js +2 -2
- package/dist/melonjs.mjs/system/device.js +2 -2
- 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 +8 -18
- 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 +66 -8
- package/dist/melonjs.mjs/text/bitmaptextdata.js +1 -1
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +56 -86
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +4 -6
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +1 -1
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +1 -1
- package/dist/melonjs.mjs/utils/string.js +2 -2
- package/dist/melonjs.mjs/utils/utils.js +2 -4
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +7 -11
- package/dist/melonjs.mjs/video/renderer.js +2 -13
- package/dist/melonjs.mjs/video/texture/atlas.js +12 -17
- package/dist/melonjs.mjs/video/texture/cache.js +3 -3
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +1 -1
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +2 -2
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +21 -17
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +235 -0
- package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +77 -0
- package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +249 -0
- package/dist/melonjs.mjs/video/webgl/{webgl_compositor.js → compositors/webgl_compositor.js} +20 -205
- package/dist/melonjs.mjs/video/webgl/glshader.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +2 -2
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +2 -2
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +139 -149
- package/dist/melonjs.module.js +26320 -26376
- package/dist/types/entity/entity.d.ts +3 -3
- package/dist/types/geometries/path2d.d.ts +5 -31
- package/dist/types/geometries/point.d.ts +2 -7
- package/dist/types/geometries/poly.d.ts +0 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/types/loader/cache.d.ts +7 -0
- package/dist/types/loader/loader.d.ts +166 -181
- package/dist/types/loader/parser.d.ts +41 -0
- package/dist/types/loader/settings.d.ts +57 -0
- package/dist/types/particles/emitter.d.ts +4 -4
- package/dist/types/physics/bounds.d.ts +29 -84
- package/dist/types/renderable/container.d.ts +0 -11
- package/dist/types/renderable/renderable.d.ts +43 -31
- package/dist/types/renderable/sprite.d.ts +3 -3
- package/dist/types/renderable/ui/uitextbutton.d.ts +0 -1
- package/dist/types/state/state.d.ts +1 -1
- package/dist/types/system/pooling.d.ts +2 -2
- package/dist/types/text/text.d.ts +6 -20
- package/dist/types/text/textstyle.d.ts +1 -1
- package/dist/types/video/canvas/canvas_renderer.d.ts +0 -5
- package/dist/types/video/renderer.d.ts +1 -5
- package/dist/types/video/webgl/buffer/vertex.d.ts +3 -3
- package/dist/types/video/webgl/compositors/compositor.d.ts +107 -0
- package/dist/types/video/webgl/compositors/primitive_compositor.d.ts +22 -0
- package/dist/types/video/webgl/compositors/quad_compositor.d.ts +72 -0
- package/dist/types/video/webgl/compositors/webgl_compositor.d.ts +86 -0
- package/dist/types/video/webgl/webgl_compositor.d.ts +2 -3
- package/dist/types/video/webgl/webgl_renderer.d.ts +34 -28
- package/package.json +18 -18
- package/src/audio/audio.js +4 -6
- package/src/entity/entity.js +42 -8
- package/src/geometries/ellipse.js +1 -2
- package/src/geometries/path2d.js +19 -43
- package/src/geometries/point.js +0 -5
- package/src/geometries/poly.js +1 -4
- package/src/geometries/rectangle.js +12 -8
- package/src/index.js +7 -3
- package/src/input/gamepad.js +9 -15
- package/src/input/pointerevent.js +1 -15
- package/src/level/level.js +2 -2
- package/src/level/tiled/TMXLayer.js +0 -7
- package/src/level/tiled/TMXTileMap.js +7 -3
- package/src/level/tiled/TMXTileset.js +4 -4
- package/src/loader/cache.js +16 -0
- package/src/loader/loader.js +339 -711
- package/src/loader/loadingscreen.js +3 -3
- package/src/loader/parser.js +279 -0
- package/src/loader/settings.js +85 -0
- package/src/math/color.js +8 -7
- package/src/math/matrix2.js +6 -8
- package/src/math/matrix3.js +17 -20
- package/src/math/observable_vector2.js +2 -2
- package/src/math/observable_vector3.js +2 -3
- package/src/math/vector2.js +2 -2
- package/src/math/vector3.js +2 -3
- package/src/particles/emitter.js +2 -2
- package/src/physics/body.js +17 -13
- package/src/physics/bounds.js +17 -69
- package/src/polyfill/index.js +0 -2
- package/src/renderable/container.js +24 -18
- package/src/renderable/imagelayer.js +6 -0
- package/src/renderable/renderable.js +147 -104
- package/src/renderable/sprite.js +32 -53
- package/src/renderable/ui/uitextbutton.js +0 -2
- package/src/state/state.js +1 -1
- package/src/system/device.js +1 -1
- package/src/system/pooling.js +7 -17
- package/src/text/bitmaptext.js +65 -7
- package/src/text/text.js +55 -85
- package/src/text/textstyle.js +3 -5
- package/src/utils/string.js +1 -1
- package/src/utils/utils.js +1 -3
- package/src/video/canvas/canvas_renderer.js +5 -9
- package/src/video/renderer.js +0 -11
- package/src/video/texture/atlas.js +11 -16
- package/src/video/texture/cache.js +2 -2
- package/src/video/video.js +1 -1
- package/src/video/webgl/buffer/vertex.js +20 -16
- package/src/video/webgl/compositors/compositor.js +226 -0
- package/src/video/webgl/compositors/primitive_compositor.js +68 -0
- package/src/video/webgl/compositors/quad_compositor.js +240 -0
- package/src/video/webgl/shaders/primitive.vert +2 -5
- package/src/video/webgl/shaders/quad.vert +3 -1
- package/src/video/webgl/webgl_renderer.js +137 -147
- package/dist/melonjs.mjs/_virtual/make-built-in.js +0 -10
- package/dist/melonjs.mjs/_virtual/object-define-property.js +0 -10
- package/dist/melonjs.mjs/_virtual/object-get-own-property-descriptor.js +0 -10
- package/dist/melonjs.mjs/_virtual/object-get-own-property-names.js +0 -10
- package/dist/melonjs.mjs/_virtual/object-get-own-property-symbols.js +0 -10
- package/dist/melonjs.mjs/_virtual/object-property-is-enumerable.js +0 -10
- package/dist/melonjs.mjs/_virtual/shared.js +0 -10
- package/dist/melonjs.mjs/game.js +0 -29
- package/dist/melonjs.mjs/polyfill/console.js +0 -18
- package/dist/melonjs.mjs/polyfill/performance.js +0 -27
- package/dist/melonjs.mjs/polyfill/requestAnimationFrame.js +0 -46
- package/dist/melonjs.mjs/polyfill/roundrect.js +0 -242
- package/dist/melonjs.mjs/renderable/re_container.js +0 -1016
- package/dist/melonjs.mjs/video/utils/resize.js +0 -116
- package/src/polyfill/performance.js +0 -20
- package/src/polyfill/requestAnimationFrame.js +0 -39
- package/src/video/webgl/webgl_compositor.js +0 -486
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine -
|
|
2
|
+
* melonJS Game Engine - v15.0.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -30,18 +30,42 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
30
30
|
// parent constructor
|
|
31
31
|
super(x, y, width, height);
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
if (this.pos instanceof ObservableVector3d) {
|
|
34
|
+
this.pos.setMuted(x, y, 0).setCallback(this.updateBoundsPos, this);
|
|
35
|
+
} else {
|
|
36
|
+
/**
|
|
37
|
+
* Position of the Renderable relative to its parent container
|
|
38
|
+
* @public
|
|
39
|
+
* @type {ObservableVector3d}
|
|
40
|
+
*/
|
|
41
|
+
this.pos = pool.pull("ObservableVector3d", x, y, 0, { onUpdate: this.updateBoundsPos, scope: this});
|
|
42
|
+
}
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
if (this.anchorPoint instanceof ObservableVector2d) {
|
|
45
|
+
this.anchorPoint.setMuted(0.5, 0.5).setCallback(this.onAnchorUpdate, this);
|
|
46
|
+
} else {
|
|
47
|
+
/**
|
|
48
|
+
* The anchor point is used for attachment behavior, and/or when applying transformations.<br>
|
|
49
|
+
* The coordinate system places the origin at the top left corner of the frame (0, 0) and (1, 1) means the bottom-right corner<br>
|
|
50
|
+
* <img src="images/anchor_point.png"/><br>
|
|
51
|
+
* a Renderable's anchor point defaults to (0.5,0.5), which corresponds to the center position.<br>
|
|
52
|
+
* <br>
|
|
53
|
+
* <i><b>Note:</b> Object created through Tiled will have their anchorPoint set to (0, 0) to match Tiled Level editor implementation.
|
|
54
|
+
* To specify a value through Tiled, use a json expression like `json:{"x":0.5,"y":0.5}`. </i>
|
|
55
|
+
* @type {ObservableVector2d}
|
|
56
|
+
* @default <0.5,0.5>
|
|
57
|
+
*/
|
|
58
|
+
this.anchorPoint = pool.pull("ObservableVector2d", 0.5, 0.5, { onUpdate: this.onAnchorUpdate, scope: this });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (typeof this.currentTransform === "undefined") {
|
|
62
|
+
/**
|
|
63
|
+
* the renderable default transformation matrix
|
|
64
|
+
* @type {Matrix2d}
|
|
65
|
+
*/
|
|
66
|
+
this.currentTransform = pool.pull("Matrix2d");
|
|
67
|
+
}
|
|
68
|
+
this.currentTransform.identity();
|
|
45
69
|
|
|
46
70
|
/**
|
|
47
71
|
* the renderable physic body
|
|
@@ -80,15 +104,6 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
80
104
|
*/
|
|
81
105
|
this.body = undefined;
|
|
82
106
|
|
|
83
|
-
if (typeof this.currentTransform === "undefined") {
|
|
84
|
-
/**
|
|
85
|
-
* the renderable default transformation matrix
|
|
86
|
-
* @type {Matrix2d}
|
|
87
|
-
*/
|
|
88
|
-
this.currentTransform = pool.pull("Matrix2d");
|
|
89
|
-
}
|
|
90
|
-
this.currentTransform.identity();
|
|
91
|
-
|
|
92
107
|
/**
|
|
93
108
|
* (G)ame (U)nique (Id)entifier" <br>
|
|
94
109
|
* a GUID will be allocated for any renderable object added <br>
|
|
@@ -139,23 +154,6 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
139
154
|
*/
|
|
140
155
|
this.floating = false;
|
|
141
156
|
|
|
142
|
-
if (this.anchorPoint instanceof ObservableVector2d) {
|
|
143
|
-
this.anchorPoint.setMuted(0.5, 0.5).setCallback(this.onAnchorUpdate, this);
|
|
144
|
-
} else {
|
|
145
|
-
/**
|
|
146
|
-
* The anchor point is used for attachment behavior, and/or when applying transformations.<br>
|
|
147
|
-
* The coordinate system places the origin at the top left corner of the frame (0, 0) and (1, 1) means the bottom-right corner<br>
|
|
148
|
-
* <img src="images/anchor_point.png"/><br>
|
|
149
|
-
* a Renderable's anchor point defaults to (0.5,0.5), which corresponds to the center position.<br>
|
|
150
|
-
* <br>
|
|
151
|
-
* <i><b>Note:</b> Object created through Tiled will have their anchorPoint set to (0, 0) to match Tiled Level editor implementation.
|
|
152
|
-
* To specify a value through Tiled, use a json expression like `json:{"x":0.5,"y":0.5}`. </i>
|
|
153
|
-
* @type {ObservableVector2d}
|
|
154
|
-
* @default <0.5,0.5>
|
|
155
|
-
*/
|
|
156
|
-
this.anchorPoint = pool.pull("ObservableVector2d", 0.5, 0.5, { onUpdate: this.onAnchorUpdate, scope: this });
|
|
157
|
-
}
|
|
158
|
-
|
|
159
157
|
/**
|
|
160
158
|
* When enabled, an object container will automatically apply
|
|
161
159
|
* any defined transformation before calling the child draw method.
|
|
@@ -215,6 +213,13 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
215
213
|
*/
|
|
216
214
|
this.mask = undefined;
|
|
217
215
|
|
|
216
|
+
/**
|
|
217
|
+
* (Experimental) an optional shader, to be used instead of the default built-in one, when drawing this renderable (WebGL only)
|
|
218
|
+
* @type {GLShader}
|
|
219
|
+
* @default undefined
|
|
220
|
+
*/
|
|
221
|
+
this.shader = undefined;
|
|
222
|
+
|
|
218
223
|
/**
|
|
219
224
|
* the blend mode to be applied to this renderable (see renderer setBlendMode for available blend mode)
|
|
220
225
|
* @type {string}
|
|
@@ -231,23 +236,25 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
231
236
|
*/
|
|
232
237
|
this.name = "";
|
|
233
238
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
239
|
+
/**
|
|
240
|
+
* to identify the object as a renderable object
|
|
241
|
+
* @ignore
|
|
242
|
+
*/
|
|
243
|
+
this.isRenderable = true;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* If true then physic collision and input events will not impact this renderable
|
|
247
|
+
* @type {boolean}
|
|
248
|
+
* @default true
|
|
249
|
+
*/
|
|
250
|
+
this.isKinematic = true;
|
|
244
251
|
|
|
245
252
|
/**
|
|
246
253
|
* when true the renderable will be redrawn during the next update cycle
|
|
247
254
|
* @type {boolean}
|
|
248
|
-
* @default
|
|
255
|
+
* @default true
|
|
249
256
|
*/
|
|
250
|
-
this.isDirty =
|
|
257
|
+
this.isDirty = true;
|
|
251
258
|
|
|
252
259
|
// keep track of when we flip
|
|
253
260
|
this._flip = {
|
|
@@ -344,7 +351,7 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
344
351
|
if (typeof this._bounds === "undefined") {
|
|
345
352
|
super.getBounds();
|
|
346
353
|
if (this.isFinite()) {
|
|
347
|
-
this.
|
|
354
|
+
this.updateBounds();
|
|
348
355
|
} else {
|
|
349
356
|
// e.g. containers or game world can have infinite size
|
|
350
357
|
this._bounds.setMinMax(this.pos.x, this.pos.y, this.width, this.height);
|
|
@@ -384,8 +391,11 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
384
391
|
* @returns {Renderable} Reference to this object for method chaining
|
|
385
392
|
*/
|
|
386
393
|
flipX(flip = true) {
|
|
387
|
-
this.
|
|
388
|
-
|
|
394
|
+
if (this.isFlippedX !== flip) {
|
|
395
|
+
this._flip.x = !!flip;
|
|
396
|
+
this.scale(-1, 1);
|
|
397
|
+
this.isDirty = true;
|
|
398
|
+
}
|
|
389
399
|
return this;
|
|
390
400
|
}
|
|
391
401
|
|
|
@@ -396,8 +406,11 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
396
406
|
* @returns {Renderable} Reference to this object for method chaining
|
|
397
407
|
*/
|
|
398
408
|
flipY(flip = true) {
|
|
399
|
-
this.
|
|
400
|
-
|
|
409
|
+
if (this.isFlippedY !== flip) {
|
|
410
|
+
this._flip.y = !!flip;
|
|
411
|
+
this.scale(1, -1);
|
|
412
|
+
this.isDirty = true;
|
|
413
|
+
}
|
|
401
414
|
return this;
|
|
402
415
|
}
|
|
403
416
|
|
|
@@ -409,8 +422,7 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
409
422
|
*/
|
|
410
423
|
transform(m) {
|
|
411
424
|
this.currentTransform.multiply(m);
|
|
412
|
-
|
|
413
|
-
this.updateBoundsPos(this.pos.x, this.pos.y);
|
|
425
|
+
this.updateBounds();
|
|
414
426
|
this.isDirty = true;
|
|
415
427
|
return this;
|
|
416
428
|
}
|
|
@@ -485,9 +497,9 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
485
497
|
* @returns {Renderable} Reference to this object for method chaining
|
|
486
498
|
*/
|
|
487
499
|
rotate(angle, v) {
|
|
488
|
-
if (
|
|
500
|
+
if (angle !== 0) {
|
|
489
501
|
this.currentTransform.rotate(angle, v);
|
|
490
|
-
|
|
502
|
+
this.updateBounds();
|
|
491
503
|
this.isDirty = true;
|
|
492
504
|
}
|
|
493
505
|
return this;
|
|
@@ -503,9 +515,9 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
503
515
|
* @param {number} [y=x] - a number representing the ordinate of the scaling vector.
|
|
504
516
|
* @returns {Renderable} Reference to this object for method chaining
|
|
505
517
|
*/
|
|
506
|
-
scale(x, y) {
|
|
518
|
+
scale(x, y = x) {
|
|
507
519
|
this.currentTransform.scale(x, y);
|
|
508
|
-
|
|
520
|
+
this.updateBounds();
|
|
509
521
|
this.isDirty = true;
|
|
510
522
|
return this;
|
|
511
523
|
}
|
|
@@ -531,44 +543,68 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
531
543
|
|
|
532
544
|
/**
|
|
533
545
|
* update the bounding box for this shape.
|
|
534
|
-
* @
|
|
546
|
+
* @param {boolean} [absolute=true] - update the bounds size and position in (world) absolute coordinates
|
|
535
547
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
536
548
|
*/
|
|
537
|
-
updateBounds() {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
549
|
+
updateBounds(absolute = true) {
|
|
550
|
+
if (this.isRenderable) {
|
|
551
|
+
var bounds = this.getBounds();
|
|
552
|
+
|
|
553
|
+
bounds.clear();
|
|
554
|
+
|
|
555
|
+
if ((this.autoTransform === true) && (!this.currentTransform.isIdentity())) {
|
|
556
|
+
// temporarly translate the matrix based on the anchor point
|
|
557
|
+
this.currentTransform.translate(
|
|
558
|
+
-this.width * this.anchorPoint.x,
|
|
559
|
+
-this.height * this.anchorPoint.y
|
|
560
|
+
);
|
|
561
|
+
bounds.addFrame(
|
|
562
|
+
0,
|
|
563
|
+
0,
|
|
564
|
+
this.width,
|
|
565
|
+
this.height,
|
|
566
|
+
this.currentTransform
|
|
567
|
+
);
|
|
568
|
+
this.currentTransform.translate(
|
|
569
|
+
this.width * this.anchorPoint.x,
|
|
570
|
+
this.height * this.anchorPoint.y
|
|
571
|
+
);
|
|
572
|
+
} else {
|
|
573
|
+
bounds.addFrame(
|
|
574
|
+
0,
|
|
575
|
+
0,
|
|
576
|
+
this.width,
|
|
577
|
+
this.height
|
|
578
|
+
);
|
|
579
|
+
// translate the bounds based on the anchor point
|
|
580
|
+
bounds.translate(
|
|
581
|
+
-this.width * this.anchorPoint.x,
|
|
582
|
+
-this.height * this.anchorPoint.y
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (absolute === true) {
|
|
587
|
+
bounds.centerOn(this.pos.x + bounds.x + bounds.width / 2, this.pos.y + bounds.y + bounds.height / 2);
|
|
588
|
+
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
|
|
589
|
+
bounds.translate(this.ancestor.getAbsolutePosition());
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
}
|
|
593
|
+
return bounds;
|
|
594
|
+
|
|
595
|
+
} else {
|
|
596
|
+
// manage the case where updateBounds is called
|
|
597
|
+
// before the object being yet properly initialized
|
|
598
|
+
return super.updateBounds(absolute);
|
|
599
|
+
}
|
|
541
600
|
}
|
|
542
601
|
|
|
543
602
|
/**
|
|
544
603
|
* update the renderable's bounding rect (private)
|
|
545
604
|
* @ignore
|
|
546
605
|
*/
|
|
547
|
-
updateBoundsPos(newX, newY) {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
bounds.shift(newX, newY);
|
|
551
|
-
|
|
552
|
-
if (typeof this.anchorPoint !== "undefined" && bounds.isFinite()) {
|
|
553
|
-
bounds.translate(
|
|
554
|
-
-(this.anchorPoint.x * bounds.width),
|
|
555
|
-
-(this.anchorPoint.y * bounds.height)
|
|
556
|
-
);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
/*
|
|
560
|
-
if (typeof this.body !== "undefined") {
|
|
561
|
-
var bodyBounds = this.body.getBounds();
|
|
562
|
-
bounds.translate(bodyBounds.x, bodyBounds.y);
|
|
563
|
-
}
|
|
564
|
-
*/
|
|
565
|
-
|
|
566
|
-
// XXX: This is called from the constructor, before it gets an ancestor
|
|
567
|
-
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
|
|
568
|
-
bounds.translate(this.ancestor.getAbsolutePosition());
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
this.isDirty = true;
|
|
606
|
+
updateBoundsPos(newX = this.pos.x, newY = this.pos.y) {
|
|
607
|
+
this.getBounds().translate(newX - this.pos.x, newY - this.pos.y);
|
|
572
608
|
}
|
|
573
609
|
|
|
574
610
|
/**
|
|
@@ -598,7 +634,8 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
598
634
|
// manually update the anchor point (required for updateBoundsPos)
|
|
599
635
|
this.anchorPoint.setMuted(x, y);
|
|
600
636
|
// then call updateBounds
|
|
601
|
-
this.
|
|
637
|
+
this.updateBounds();
|
|
638
|
+
this.isDirty = true;
|
|
602
639
|
}
|
|
603
640
|
|
|
604
641
|
/**
|
|
@@ -609,9 +646,8 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
609
646
|
* @param {CanvasRenderer|WebGLRenderer} renderer - a renderer object
|
|
610
647
|
*/
|
|
611
648
|
preDraw(renderer) {
|
|
612
|
-
var
|
|
613
|
-
|
|
614
|
-
ay = bounds.height * this.anchorPoint.y;
|
|
649
|
+
var ax = this.width * this.anchorPoint.x,
|
|
650
|
+
ay = this.height * this.anchorPoint.y;
|
|
615
651
|
|
|
616
652
|
// save renderer context
|
|
617
653
|
renderer.save();
|
|
@@ -619,16 +655,6 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
619
655
|
// apply the defined alpha value
|
|
620
656
|
renderer.setGlobalAlpha(renderer.globalAlpha() * this.getOpacity());
|
|
621
657
|
|
|
622
|
-
// apply flip
|
|
623
|
-
if (this._flip.x || this._flip.y) {
|
|
624
|
-
var dx = this._flip.x ? this.centerX - ax : 0,
|
|
625
|
-
dy = this._flip.y ? this.centerY - ay : 0;
|
|
626
|
-
|
|
627
|
-
renderer.translate(dx, dy);
|
|
628
|
-
renderer.scale(this._flip.x ? -1 : 1, this._flip.y ? -1 : 1);
|
|
629
|
-
renderer.translate(-dx, -dy);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
658
|
// apply stencil mask if defined
|
|
633
659
|
if (typeof this.mask !== "undefined") {
|
|
634
660
|
renderer.translate(this.pos.x, this.pos.y);
|
|
@@ -636,6 +662,11 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
636
662
|
renderer.translate(-this.pos.x, -this.pos.y);
|
|
637
663
|
}
|
|
638
664
|
|
|
665
|
+
// use this renderable shader if defined
|
|
666
|
+
if (typeof this.shader === "object" && typeof renderer.gl !== "undefined") {
|
|
667
|
+
renderer.customShader = this.shader;
|
|
668
|
+
}
|
|
669
|
+
|
|
639
670
|
if ((this.autoTransform === true) && (!this.currentTransform.isIdentity())) {
|
|
640
671
|
// apply the renderable transformation matrix
|
|
641
672
|
renderer.translate(this.pos.x, this.pos.y);
|
|
@@ -687,6 +718,12 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
687
718
|
renderer.clearMask();
|
|
688
719
|
}
|
|
689
720
|
|
|
721
|
+
// revert to the default shader if defined
|
|
722
|
+
if (typeof this.shader === "object" && typeof renderer.gl !== "undefined") {
|
|
723
|
+
renderer.customShader = undefined;
|
|
724
|
+
//renderer.setCompositor("quad");
|
|
725
|
+
}
|
|
726
|
+
|
|
690
727
|
// restore the context
|
|
691
728
|
renderer.restore();
|
|
692
729
|
|
|
@@ -766,6 +803,12 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
766
803
|
|
|
767
804
|
// call the user defined destroy method
|
|
768
805
|
this.onDestroyEvent.apply(this, arguments);
|
|
806
|
+
|
|
807
|
+
// destroy any shader object if not done by the user through onDestroyEvent()
|
|
808
|
+
if (typeof this.shader === "object") {
|
|
809
|
+
this.shader.destroy();
|
|
810
|
+
this.shader = undefined;
|
|
811
|
+
}
|
|
769
812
|
}
|
|
770
813
|
|
|
771
814
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine -
|
|
2
|
+
* melonJS Game Engine - v15.0.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { renderer } from '../video/video.js';
|
|
9
9
|
import pool from '../system/pooling.js';
|
|
10
|
-
import
|
|
10
|
+
import { getImage } from '../loader/loader.js';
|
|
11
11
|
import { TextureAtlas } from '../video/texture/atlas.js';
|
|
12
12
|
import Renderable from './renderable.js';
|
|
13
13
|
import Color from '../math/color.js';
|
|
@@ -102,7 +102,7 @@ import Color from '../math/color.js';
|
|
|
102
102
|
// (reusing current, any better/cleaner place?)
|
|
103
103
|
this.current = {
|
|
104
104
|
// the current animation name
|
|
105
|
-
name :
|
|
105
|
+
name : undefined,
|
|
106
106
|
// length of the current animation name
|
|
107
107
|
length : 0,
|
|
108
108
|
//current frame texture offset
|
|
@@ -139,9 +139,6 @@ import Color from '../math/color.js';
|
|
|
139
139
|
if (region) {
|
|
140
140
|
// set the sprite region within the texture
|
|
141
141
|
this.setRegion(region);
|
|
142
|
-
// update the default "current" frame size
|
|
143
|
-
this.current.width = settings.framewidth || region.width;
|
|
144
|
-
this.current.height = settings.frameheight || region.height;
|
|
145
142
|
} else {
|
|
146
143
|
// throw an error
|
|
147
144
|
throw new Error("Texture - region for " + settings.region + " not found");
|
|
@@ -149,14 +146,14 @@ import Color from '../math/color.js';
|
|
|
149
146
|
}
|
|
150
147
|
} else {
|
|
151
148
|
// HTMLImageElement/Canvas or {string}
|
|
152
|
-
this.image = (typeof settings.image === "object") ? settings.image :
|
|
149
|
+
this.image = (typeof settings.image === "object") ? settings.image : getImage(settings.image);
|
|
153
150
|
// throw an error if image ends up being null/undefined
|
|
154
151
|
if (!this.image) {
|
|
155
152
|
throw new Error("me.Sprite: '" + settings.image + "' image/texture not found!");
|
|
156
153
|
}
|
|
157
154
|
// update the default "current" frame size
|
|
158
|
-
this.current.width = settings.framewidth = settings.framewidth || this.image.width;
|
|
159
|
-
this.current.height = settings.frameheight = settings.frameheight || this.image.height;
|
|
155
|
+
this.width = this.current.width = settings.framewidth = settings.framewidth || this.image.width;
|
|
156
|
+
this.height = this.current.height = settings.frameheight = settings.frameheight || this.image.height;
|
|
160
157
|
this.source = renderer.cache.get(this.image, settings);
|
|
161
158
|
this.textureAtlas = this.source.getAtlas();
|
|
162
159
|
}
|
|
@@ -167,10 +164,6 @@ import Color from '../math/color.js';
|
|
|
167
164
|
this.atlasIndices = settings.atlasIndices;
|
|
168
165
|
}
|
|
169
166
|
|
|
170
|
-
// resize based on the active frame
|
|
171
|
-
this.width = this.current.width;
|
|
172
|
-
this.height = this.current.height;
|
|
173
|
-
|
|
174
167
|
// apply flip flags if specified
|
|
175
168
|
if (typeof (settings.flipX) !== "undefined") {
|
|
176
169
|
this.flipX(!!settings.flipX);
|
|
@@ -209,14 +202,11 @@ import Color from '../math/color.js';
|
|
|
209
202
|
this.pos.z = settings.z;
|
|
210
203
|
}
|
|
211
204
|
|
|
212
|
-
//
|
|
205
|
+
// addAnimation will return 0 if no texture atlas is defined
|
|
213
206
|
if (this.addAnimation("default", null) !== 0) {
|
|
214
207
|
// set as default
|
|
215
208
|
this.setCurrentAnimation("default");
|
|
216
209
|
}
|
|
217
|
-
|
|
218
|
-
// enable currentTransform for me.Sprite based objects
|
|
219
|
-
this.autoTransform = true;
|
|
220
210
|
}
|
|
221
211
|
|
|
222
212
|
/**
|
|
@@ -396,22 +386,24 @@ import Color from '../math/color.js';
|
|
|
396
386
|
* return false; // do not reset to first frame
|
|
397
387
|
* }).bind(this));
|
|
398
388
|
*/
|
|
399
|
-
setCurrentAnimation(name, resetAnim, preserve_dt) {
|
|
400
|
-
if (this.anim[name]) {
|
|
401
|
-
this.
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
389
|
+
setCurrentAnimation(name, resetAnim, preserve_dt = false) {
|
|
390
|
+
if (typeof this.anim[name] !== "undefined") {
|
|
391
|
+
if (!this.isCurrentAnimation(name)) {
|
|
392
|
+
this.current.name = name;
|
|
393
|
+
this.current.length = this.anim[this.current.name].length;
|
|
394
|
+
if (typeof resetAnim === "string") {
|
|
395
|
+
this.resetAnim = this.setCurrentAnimation.bind(this, resetAnim, null, true);
|
|
396
|
+
} else if (typeof resetAnim === "function") {
|
|
397
|
+
this.resetAnim = resetAnim;
|
|
398
|
+
} else {
|
|
399
|
+
this.resetAnim = undefined;
|
|
400
|
+
}
|
|
401
|
+
this.setAnimationFrame(0);
|
|
402
|
+
if (!preserve_dt) {
|
|
403
|
+
this.dt = 0;
|
|
404
|
+
}
|
|
405
|
+
this.isDirty = true;
|
|
413
406
|
}
|
|
414
|
-
this.isDirty = true;
|
|
415
407
|
} else {
|
|
416
408
|
throw new Error("animation id '" + name + "' not defined");
|
|
417
409
|
}
|
|
@@ -468,17 +460,19 @@ import Color from '../math/color.js';
|
|
|
468
460
|
// set the sprite offset within the texture
|
|
469
461
|
this.current.offset.setV(region.offset);
|
|
470
462
|
// set angle if defined
|
|
471
|
-
this.current.angle = region.angle;
|
|
463
|
+
this.current.angle = typeof region.angle === "number" ? region.angle : 0;
|
|
472
464
|
// update the default "current" size
|
|
473
465
|
this.width = this.current.width = region.width;
|
|
474
466
|
this.height = this.current.height = region.height;
|
|
475
467
|
// set global anchortPoint if defined
|
|
476
468
|
if (region.anchorPoint) {
|
|
477
|
-
this.anchorPoint.
|
|
469
|
+
this.anchorPoint.setMuted(
|
|
478
470
|
this._flip.x && region.trimmed === true ? 1 - region.anchorPoint.x : region.anchorPoint.x,
|
|
479
471
|
this._flip.y && region.trimmed === true ? 1 - region.anchorPoint.y : region.anchorPoint.y
|
|
480
472
|
);
|
|
481
473
|
}
|
|
474
|
+
// update the sprite bounding box
|
|
475
|
+
this.updateBounds();
|
|
482
476
|
this.isDirty = true;
|
|
483
477
|
return this;
|
|
484
478
|
}
|
|
@@ -487,14 +481,14 @@ import Color from '../math/color.js';
|
|
|
487
481
|
* force the current animation frame index.
|
|
488
482
|
* @name setAnimationFrame
|
|
489
483
|
* @memberof Sprite
|
|
490
|
-
* @param {number} [
|
|
484
|
+
* @param {number} [index=0] - animation frame index
|
|
491
485
|
* @returns {Sprite} Reference to this object for method chaining
|
|
492
486
|
* @example
|
|
493
487
|
* // reset the current animation to the first frame
|
|
494
488
|
* this.setAnimationFrame();
|
|
495
489
|
*/
|
|
496
|
-
setAnimationFrame(
|
|
497
|
-
this.current.idx =
|
|
490
|
+
setAnimationFrame(index = 0) {
|
|
491
|
+
this.current.idx = index % this.current.length;
|
|
498
492
|
return this.setRegion(this.getAnimationFrameObjectByIndex(this.current.idx));
|
|
499
493
|
}
|
|
500
494
|
|
|
@@ -531,14 +525,14 @@ import Color from '../math/color.js';
|
|
|
531
525
|
*/
|
|
532
526
|
update(dt) {
|
|
533
527
|
// Update animation if necessary
|
|
534
|
-
if (!this.animationpause && this.current
|
|
528
|
+
if (!this.animationpause && this.current.length > 1) {
|
|
535
529
|
var duration = this.getAnimationFrameObjectByIndex(this.current.idx).delay;
|
|
536
530
|
this.dt += dt;
|
|
537
531
|
while (this.dt >= duration) {
|
|
538
532
|
this.isDirty = true;
|
|
539
533
|
this.dt -= duration;
|
|
540
534
|
|
|
541
|
-
var nextFrame = (this.current.length > 1? this.current.idx+1: this.current.idx);
|
|
535
|
+
var nextFrame = (this.current.length > 1 ? this.current.idx + 1 : this.current.idx);
|
|
542
536
|
this.setAnimationFrame(nextFrame);
|
|
543
537
|
|
|
544
538
|
// Switch animation if we reach the end of the strip and a callback is defined
|
|
@@ -558,21 +552,6 @@ import Color from '../math/color.js';
|
|
|
558
552
|
}
|
|
559
553
|
}
|
|
560
554
|
|
|
561
|
-
// update the sprite bounding box
|
|
562
|
-
/*
|
|
563
|
-
if (this.isDirty === true && !this.currentTransform.isIdentity()) {
|
|
564
|
-
this.getBounds().clear();
|
|
565
|
-
this.getBounds().addFrame(
|
|
566
|
-
0,
|
|
567
|
-
0,
|
|
568
|
-
this.current.width,
|
|
569
|
-
this.current.height,
|
|
570
|
-
this.currentTransform
|
|
571
|
-
);
|
|
572
|
-
this.updateBoundsPos(this.pos.x, this.pos.y);
|
|
573
|
-
}
|
|
574
|
-
*/
|
|
575
|
-
|
|
576
555
|
//update the "flickering" state if necessary
|
|
577
556
|
if (this._flicker.isFlickering) {
|
|
578
557
|
this._flicker.duration -= dt;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine -
|
|
2
|
+
* melonJS Game Engine - v15.0.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -30,7 +30,6 @@ import UIBaseElement from './uibaseelement.js';
|
|
|
30
30
|
* @param {string} [settings.backgroundColor] - The css value of a background color
|
|
31
31
|
* @param {string} [settings.hoverColor] - The css value of a color to be used if the pointer hovers over the button
|
|
32
32
|
* @param {string} [settings.borderStrokeColor] - The css value of a color to be used to draw the border
|
|
33
|
-
* @param {boolean} [settings.offScreenCanvas] - Weather to use an offScreen canvas or not
|
|
34
33
|
* @param {string} [settings.fillStyle] - The css value of a tint color to be used to tint the text
|
|
35
34
|
* @param {number} [settings.borderWidth] - Width of the button
|
|
36
35
|
* @param {number} [settings.borderHeight] - Height of the button
|
|
@@ -63,7 +62,6 @@ import UIBaseElement from './uibaseelement.js';
|
|
|
63
62
|
settings.backgroundColor = settings.backgroundColor || "#00aa00";
|
|
64
63
|
settings.hoverColor = settings.hoverColor || "#00ff00";
|
|
65
64
|
settings.borderStrokeColor = settings.borderStrokeColor || "#000000";
|
|
66
|
-
settings.offScreenCanvas = settings.offScreenCanvas || false;
|
|
67
65
|
settings.fillStyle = settings.fillStyle || "#ffffff";
|
|
68
66
|
settings.lineWidth = settings.lineWidth || 1;
|
|
69
67
|
settings.anchorPoint = settings.anchorPoint || new Vector2d(0, 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine -
|
|
2
|
+
* melonJS Game Engine - v15.0.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -514,7 +514,7 @@ var state = {
|
|
|
514
514
|
},
|
|
515
515
|
|
|
516
516
|
/**
|
|
517
|
-
* enable/disable transition
|
|
517
|
+
* enable/disable the transition to a particular state (by default enabled for all)
|
|
518
518
|
* @name setTransition
|
|
519
519
|
* @memberof state
|
|
520
520
|
* @public
|