melonjs 15.3.0 → 15.4.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/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/application/application.js +53 -5
- package/dist/melonjs.mjs/application/header.js +2 -2
- package/dist/melonjs.mjs/application/resize.js +4 -8
- package/dist/melonjs.mjs/application/settings.js +5 -5
- package/dist/melonjs.mjs/audio/audio.js +4 -6
- package/dist/melonjs.mjs/camera/camera2d.js +12 -14
- package/dist/melonjs.mjs/const.js +1 -1
- package/dist/melonjs.mjs/entity/entity.js +3 -4
- package/dist/melonjs.mjs/geometries/ellipse.js +26 -59
- package/dist/melonjs.mjs/geometries/line.js +18 -25
- package/dist/melonjs.mjs/geometries/path2d.js +16 -13
- package/dist/melonjs.mjs/geometries/point.js +8 -16
- package/dist/melonjs.mjs/geometries/poly.js +40 -97
- package/dist/melonjs.mjs/geometries/rectangle.js +37 -91
- package/dist/melonjs.mjs/geometries/roundrect.js +26 -35
- package/dist/melonjs.mjs/index.js +6 -6
- package/dist/melonjs.mjs/input/gamepad.js +1 -1
- package/dist/melonjs.mjs/input/input.js +1 -1
- package/dist/melonjs.mjs/input/keyboard.js +3 -3
- package/dist/melonjs.mjs/input/pointer.js +4 -4
- package/dist/melonjs.mjs/input/pointerevent.js +6 -7
- package/dist/melonjs.mjs/lang/console.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +2 -2
- package/dist/melonjs.mjs/level/level.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +16 -33
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +3 -4
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +4 -4
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +3 -3
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +4 -7
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +2 -2
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +26 -29
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +3 -3
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
- package/dist/melonjs.mjs/loader/cache.js +1 -1
- package/dist/melonjs.mjs/loader/loader.js +1 -1
- package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parser.js +4 -5
- package/dist/melonjs.mjs/loader/settings.js +1 -1
- package/dist/melonjs.mjs/math/color.js +2 -2
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +5 -59
- package/dist/melonjs.mjs/math/matrix3.js +82 -141
- package/dist/melonjs.mjs/math/observable_vector2.js +7 -7
- package/dist/melonjs.mjs/math/observable_vector3.js +5 -5
- package/dist/melonjs.mjs/math/vector2.js +7 -91
- package/dist/melonjs.mjs/math/vector3.js +6 -90
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +2 -2
- package/dist/melonjs.mjs/particles/particle.js +2 -2
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +22 -20
- package/dist/melonjs.mjs/physics/bounds.js +27 -33
- package/dist/melonjs.mjs/physics/collision.js +5 -5
- package/dist/melonjs.mjs/physics/detector.js +10 -10
- package/dist/melonjs.mjs/physics/quadtree.js +5 -5
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +3 -4
- package/dist/melonjs.mjs/physics/world.js +6 -9
- package/dist/melonjs.mjs/plugin/plugin.js +3 -3
- package/dist/melonjs.mjs/renderable/collectable.js +2 -2
- package/dist/melonjs.mjs/renderable/colorlayer.js +4 -4
- package/dist/melonjs.mjs/renderable/container.js +25 -25
- package/dist/melonjs.mjs/renderable/draggable.js +1 -1
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +4 -4
- package/dist/melonjs.mjs/renderable/light2d.js +3 -3
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +2 -2
- package/dist/melonjs.mjs/renderable/renderable.js +26 -26
- package/dist/melonjs.mjs/renderable/sprite.js +3 -3
- package/dist/melonjs.mjs/renderable/text/bitmaptext.js +421 -0
- package/dist/melonjs.mjs/renderable/text/bitmaptextdata.js +195 -0
- package/dist/melonjs.mjs/renderable/text/glyph.js +65 -0
- package/dist/melonjs.mjs/renderable/text/text.js +422 -0
- package/dist/melonjs.mjs/renderable/text/textmetrics.js +175 -0
- package/dist/melonjs.mjs/renderable/text/textstyle.js +21 -0
- package/dist/melonjs.mjs/renderable/trigger.js +10 -10
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +7 -7
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +7 -7
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +3 -3
- package/dist/melonjs.mjs/state/stage.js +2 -2
- package/dist/melonjs.mjs/state/state.js +1 -38
- package/dist/melonjs.mjs/system/device.js +49 -10
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +24 -2
- package/dist/melonjs.mjs/system/platform.js +18 -18
- package/dist/melonjs.mjs/system/pooling.js +10 -10
- package/dist/melonjs.mjs/system/save.js +1 -1
- package/dist/melonjs.mjs/system/timer.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptextdata.js +3 -6
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +1 -1
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +2 -2
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +2 -3
- package/dist/melonjs.mjs/utils/string.js +1 -1
- package/dist/melonjs.mjs/utils/utils.js +1 -1
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +3 -7
- package/dist/melonjs.mjs/video/renderer.js +16 -16
- package/dist/melonjs.mjs/video/texture/atlas.js +13 -13
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +15 -15
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +4 -4
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +3 -3
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +13 -14
- package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +5 -5
- package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +2 -3
- package/dist/melonjs.mjs/video/webgl/glshader.js +2 -2
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +4 -4
- package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +50 -52
- package/dist/melonjs.module.js +1137 -1576
- package/dist/types/application/application.d.ts +28 -4
- package/dist/types/application/header.d.ts +2 -2
- package/dist/types/application/settings.d.ts +23 -23
- package/dist/types/audio/audio.d.ts +4 -6
- package/dist/types/camera/camera2d.d.ts +13 -16
- package/dist/types/entity/entity.d.ts +0 -1
- package/dist/types/geometries/ellipse.d.ts +18 -50
- package/dist/types/geometries/path2d.d.ts +1 -1
- package/dist/types/geometries/point.d.ts +5 -13
- package/dist/types/geometries/poly.d.ts +26 -75
- package/dist/types/geometries/rectangle.d.ts +12 -58
- package/dist/types/geometries/roundrect.d.ts +2 -11
- package/dist/types/index.d.ts +3 -3
- package/dist/types/input/gamepad.d.ts +31 -31
- package/dist/types/input/keyboard.d.ts +105 -105
- package/dist/types/input/pointer.d.ts +21 -21
- package/dist/types/input/pointerevent.d.ts +6 -6
- package/dist/types/level/tiled/TMXLayer.d.ts +1 -1
- package/dist/types/math/matrix2.d.ts +9 -63
- package/dist/types/math/matrix3.d.ts +9 -68
- package/dist/types/math/observable_vector2.d.ts +2 -2
- package/dist/types/math/observable_vector3.d.ts +2 -2
- package/dist/types/math/vector2.d.ts +8 -92
- package/dist/types/math/vector3.d.ts +8 -92
- package/dist/types/particles/settings.d.ts +29 -29
- package/dist/types/physics/body.d.ts +10 -8
- package/dist/types/physics/bounds.d.ts +24 -30
- package/dist/types/physics/collision.d.ts +12 -12
- package/dist/types/physics/detector.d.ts +1 -1
- package/dist/types/physics/world.d.ts +4 -7
- package/dist/types/renderable/container.d.ts +19 -19
- package/dist/types/renderable/imagelayer.d.ts +6 -6
- package/dist/types/renderable/light2d.d.ts +7 -7
- package/dist/types/renderable/renderable.d.ts +9 -16
- package/dist/types/renderable/text/bitmaptext.d.ts +151 -0
- package/dist/types/renderable/text/bitmaptextdata.d.ts +35 -0
- package/dist/types/renderable/text/glyph.d.ts +28 -0
- package/dist/types/renderable/text/text.d.ts +159 -0
- package/dist/types/renderable/text/textmetrics.d.ts +47 -0
- package/dist/types/renderable/text/textstyle.d.ts +5 -0
- package/dist/types/renderable/ui/uibaseelement.d.ts +0 -1
- package/dist/types/renderable/ui/uispriteelement.d.ts +0 -1
- package/dist/types/renderable/ui/uitextbutton.d.ts +2 -7
- package/dist/types/state/state.d.ts +11 -11
- package/dist/types/system/device.d.ts +15 -9
- package/dist/types/system/event.d.ts +20 -0
- package/dist/types/system/platform.d.ts +17 -17
- package/dist/types/utils/function.d.ts +1 -2
- package/dist/types/video/renderer.d.ts +13 -13
- package/dist/types/video/texture/canvas_texture.d.ts +14 -14
- package/dist/types/video/video.d.ts +2 -2
- package/dist/types/video/webgl/buffer/vertex.d.ts +2 -2
- package/dist/types/video/webgl/compositors/compositor.d.ts +24 -13
- package/dist/types/video/webgl/compositors/primitive_compositor.d.ts +0 -1
- package/dist/types/video/webgl/compositors/quad_compositor.d.ts +0 -1
- package/dist/types/video/webgl/utils/precision.d.ts +1 -1
- package/dist/types/video/webgl/webgl_renderer.d.ts +47 -50
- package/package.json +15 -15
- package/src/application/application.js +51 -3
- package/src/application/header.js +1 -1
- package/src/application/resize.js +3 -7
- package/src/application/settings.js +4 -4
- package/src/audio/audio.js +3 -5
- package/src/camera/camera2d.js +11 -13
- package/src/entity/entity.js +2 -3
- package/src/geometries/ellipse.js +25 -58
- package/src/geometries/line.js +17 -24
- package/src/geometries/path2d.js +15 -12
- package/src/geometries/point.js +7 -15
- package/src/geometries/poly.js +39 -96
- package/src/geometries/rectangle.js +36 -90
- package/src/geometries/roundrect.js +25 -34
- package/src/index.js +4 -4
- package/src/input/keyboard.js +2 -2
- package/src/input/pointer.js +3 -3
- package/src/input/pointerevent.js +5 -6
- package/src/lang/deprecated.js +1 -1
- package/src/level/tiled/TMXLayer.js +15 -32
- package/src/level/tiled/TMXObject.js +2 -3
- package/src/level/tiled/TMXTile.js +3 -3
- package/src/level/tiled/TMXTileMap.js +2 -2
- package/src/level/tiled/TMXTileset.js +3 -6
- package/src/level/tiled/TMXTilesetGroup.js +1 -1
- package/src/level/tiled/TMXUtils.js +25 -28
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/src/loader/parser.js +3 -4
- package/src/math/color.js +1 -1
- package/src/math/matrix2.js +4 -58
- package/src/math/matrix3.js +81 -140
- package/src/math/observable_vector2.js +6 -6
- package/src/math/observable_vector3.js +4 -4
- package/src/math/vector2.js +6 -90
- package/src/math/vector3.js +5 -89
- package/src/particles/emitter.js +1 -1
- package/src/particles/particle.js +1 -1
- package/src/physics/body.js +21 -19
- package/src/physics/bounds.js +26 -32
- package/src/physics/collision.js +4 -4
- package/src/physics/detector.js +9 -9
- package/src/physics/quadtree.js +4 -4
- package/src/physics/sat.js +2 -3
- package/src/physics/world.js +5 -8
- package/src/polyfill/roundrect.js +163 -163
- package/src/renderable/collectable.js +1 -1
- package/src/renderable/colorlayer.js +3 -3
- package/src/renderable/container.js +24 -24
- package/src/renderable/imagelayer.js +3 -3
- package/src/renderable/light2d.js +2 -2
- package/src/renderable/nineslicesprite.js +1 -1
- package/src/renderable/renderable.js +25 -25
- package/src/renderable/sprite.js +2 -2
- package/src/{text → renderable/text}/bitmaptext.js +8 -8
- package/src/{text → renderable/text}/bitmaptextdata.js +4 -7
- package/src/{text → renderable/text}/glyph.js +1 -1
- package/src/{text → renderable/text}/text.js +16 -17
- package/src/{text → renderable/text}/textmetrics.js +2 -2
- package/src/renderable/trigger.js +9 -9
- package/src/renderable/ui/uibaseelement.js +6 -6
- package/src/renderable/ui/uispriteelement.js +6 -6
- package/src/renderable/ui/uitextbutton.js +2 -2
- package/src/state/stage.js +1 -1
- package/src/state/state.js +0 -49
- package/src/system/device.js +48 -9
- package/src/system/event.js +22 -0
- package/src/system/platform.js +18 -18
- package/src/system/pooling.js +9 -9
- package/src/tweens/tween.js +1 -1
- package/src/utils/function.js +1 -2
- package/src/video/canvas/canvas_renderer.js +2 -6
- package/src/video/renderer.js +15 -15
- package/src/video/texture/atlas.js +12 -12
- package/src/video/texture/canvas_texture.js +14 -14
- package/src/video/video.js +3 -3
- package/src/video/webgl/buffer/vertex.js +2 -2
- package/src/video/webgl/compositors/compositor.js +12 -13
- package/src/video/webgl/compositors/primitive_compositor.js +4 -4
- package/src/video/webgl/compositors/quad_compositor.js +1 -2
- package/src/video/webgl/glshader.js +1 -1
- package/src/video/webgl/utils/precision.js +3 -3
- package/src/video/webgl/webgl_renderer.js +49 -51
- /package/src/{text → renderable/text}/textstyle.js +0 -0
|
@@ -15,7 +15,7 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
15
15
|
* a WebGL renderer object
|
|
16
16
|
* @augments Renderer
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
export default class WebGLRenderer extends Renderer {
|
|
19
19
|
/**
|
|
20
20
|
* @param {Application.Settings} [options] - optional parameters for the renderer
|
|
21
21
|
*/
|
|
@@ -231,8 +231,8 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
231
231
|
/**
|
|
232
232
|
* add a new compositor to this renderer
|
|
233
233
|
* @param {Compositor} compositor - a compositor instance
|
|
234
|
-
* @param {
|
|
235
|
-
* @param {
|
|
234
|
+
* @param {string} name - a name uniquely identifying this compositor
|
|
235
|
+
* @param {boolean} [activate=false] - true if the given compositor should be set as the active one
|
|
236
236
|
*/
|
|
237
237
|
addCompositor(compositor, name = "default", activate = false) {
|
|
238
238
|
// make sure there is no existing compositor with the same name
|
|
@@ -251,9 +251,9 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
253
|
* set the active compositor for this renderer
|
|
254
|
-
* @param {
|
|
254
|
+
* @param {string} name - a compositor name
|
|
255
255
|
* @param {GLShader} [shader] - an optional shader program to be used, instead of the default one, when activating the compositor
|
|
256
|
-
* @
|
|
256
|
+
* @returns {Compositor} an instance to the current active compositor
|
|
257
257
|
*/
|
|
258
258
|
setCompositor(name = "default", shader = this.customShader) {
|
|
259
259
|
let compositor = this.compositors.get(name);
|
|
@@ -292,7 +292,7 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
292
292
|
* Create a pattern with the specified repetition
|
|
293
293
|
* @param {HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas|VideoFrame} image - Source image to be used as the pattern's image
|
|
294
294
|
* @param {string} repeat - Define how the pattern should be repeated
|
|
295
|
-
* @returns {TextureAtlas}
|
|
295
|
+
* @returns {TextureAtlas} the patterned texture created
|
|
296
296
|
* @see ImageLayer#repeat
|
|
297
297
|
* @example
|
|
298
298
|
* let tileable = renderer.createPattern(image, "repeat");
|
|
@@ -329,7 +329,7 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
329
329
|
|
|
330
330
|
/**
|
|
331
331
|
* set/change the current projection matrix (WebGL only)
|
|
332
|
-
* @param {Matrix3d} matrix
|
|
332
|
+
* @param {Matrix3d} matrix - the new projection matrix
|
|
333
333
|
*/
|
|
334
334
|
setProjection(matrix) {
|
|
335
335
|
super.setProjection(matrix);
|
|
@@ -452,10 +452,10 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
452
452
|
/**
|
|
453
453
|
* Draw a pattern within the given rectangle.
|
|
454
454
|
* @param {TextureAtlas} pattern - Pattern object
|
|
455
|
-
* @param {number} x
|
|
456
|
-
* @param {number} y
|
|
457
|
-
* @param {number} width
|
|
458
|
-
* @param {number} height
|
|
455
|
+
* @param {number} x - x position where to draw the pattern
|
|
456
|
+
* @param {number} y - y position where to draw the pattern
|
|
457
|
+
* @param {number} width - width of the pattern
|
|
458
|
+
* @param {number} height - height of the pattern
|
|
459
459
|
* @see WebGLRenderer#createPattern
|
|
460
460
|
*/
|
|
461
461
|
drawPattern(pattern, x, y, width, height) {
|
|
@@ -466,10 +466,10 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
466
466
|
|
|
467
467
|
/**
|
|
468
468
|
* Returns the WebGL Context object of the given canvas element
|
|
469
|
-
* @param {HTMLCanvasElement} canvas
|
|
469
|
+
* @param {HTMLCanvasElement} canvas - the canvas element
|
|
470
470
|
* @param {boolean} [transparent=false] - use true to enable transparency
|
|
471
471
|
* @param {boolean} [depth=false] - use true to enable depth buffer testing
|
|
472
|
-
* @returns {WebGLRenderingContext}
|
|
472
|
+
* @returns {WebGLRenderingContext} the WebGL Context object
|
|
473
473
|
*/
|
|
474
474
|
getContextGL(canvas, transparent = false, depth = false) {
|
|
475
475
|
if (typeof canvas === "undefined" || canvas === null) {
|
|
@@ -518,7 +518,7 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
518
518
|
/**
|
|
519
519
|
* Returns the WebGLContext instance for the renderer
|
|
520
520
|
* return a reference to the system 2d Context
|
|
521
|
-
* @returns {WebGLRenderingContext}
|
|
521
|
+
* @returns {WebGLRenderingContext} the current WebGL context
|
|
522
522
|
*/
|
|
523
523
|
getContext() {
|
|
524
524
|
return this.gl;
|
|
@@ -537,7 +537,7 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
537
537
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
538
538
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
539
539
|
* @param {string} [mode="normal"] - blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
540
|
-
* @param {WebGLRenderingContext} [gl]
|
|
540
|
+
* @param {WebGLRenderingContext} [gl] - a WebGL context
|
|
541
541
|
*/
|
|
542
542
|
setBlendMode(mode = "normal", gl = this.gl) {
|
|
543
543
|
|
|
@@ -626,8 +626,8 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
626
626
|
|
|
627
627
|
/**
|
|
628
628
|
* scales the uniform matrix
|
|
629
|
-
* @param {number} x
|
|
630
|
-
* @param {number} y
|
|
629
|
+
* @param {number} x - x-axis scale
|
|
630
|
+
* @param {number} y - y-axis scale
|
|
631
631
|
*/
|
|
632
632
|
scale(x, y) {
|
|
633
633
|
this.currentTransform.scale(x, y);
|
|
@@ -681,11 +681,11 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
681
681
|
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
682
682
|
* @param {number} x - arc center point x-axis
|
|
683
683
|
* @param {number} y - arc center point y-axis
|
|
684
|
-
* @param {number} radius
|
|
684
|
+
* @param {number} radius - arc radius
|
|
685
685
|
* @param {number} start - start angle in radians
|
|
686
686
|
* @param {number} end - end angle in radians
|
|
687
687
|
* @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
|
|
688
|
-
* @param {boolean} [fill=false]
|
|
688
|
+
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
689
689
|
*/
|
|
690
690
|
strokeArc(x, y, radius, start, end, antiClockwise = false, fill = false) {
|
|
691
691
|
this.setCompositor("primitive");
|
|
@@ -703,7 +703,7 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
703
703
|
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
704
704
|
* @param {number} x - arc center point x-axis
|
|
705
705
|
* @param {number} y - arc center point y-axis
|
|
706
|
-
* @param {number} radius
|
|
706
|
+
* @param {number} radius - arc radius
|
|
707
707
|
* @param {number} start - start angle in radians
|
|
708
708
|
* @param {number} end - end angle in radians
|
|
709
709
|
* @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
|
|
@@ -806,10 +806,10 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
806
806
|
|
|
807
807
|
/**
|
|
808
808
|
* Draw a stroke rectangle at the specified coordinates
|
|
809
|
-
* @param {number} x
|
|
810
|
-
* @param {number} y
|
|
811
|
-
* @param {number} width
|
|
812
|
-
* @param {number} height
|
|
809
|
+
* @param {number} x - x axis of the coordinate for the rectangle starting point.
|
|
810
|
+
* @param {number} y - y axis of the coordinate for the rectangle starting point.
|
|
811
|
+
* @param {number} width - The rectangle's width.
|
|
812
|
+
* @param {number} height - The rectangle's height.
|
|
813
813
|
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
814
814
|
*/
|
|
815
815
|
strokeRect(x, y, width, height, fill = false) {
|
|
@@ -825,10 +825,10 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
825
825
|
|
|
826
826
|
/**
|
|
827
827
|
* Draw a filled rectangle at the specified coordinates
|
|
828
|
-
* @param {number} x
|
|
829
|
-
* @param {number} y
|
|
830
|
-
* @param {number} width
|
|
831
|
-
* @param {number} height
|
|
828
|
+
* @param {number} x - x axis of the coordinate for the rectangle starting point.
|
|
829
|
+
* @param {number} y - y axis of the coordinate for the rectangle starting point.
|
|
830
|
+
* @param {number} width - The rectangle's width.
|
|
831
|
+
* @param {number} height - The rectangle's height.
|
|
832
832
|
*/
|
|
833
833
|
fillRect(x, y, width, height) {
|
|
834
834
|
this.strokeRect(x, y, width, height, true);
|
|
@@ -836,11 +836,11 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
836
836
|
|
|
837
837
|
/**
|
|
838
838
|
* Stroke a rounded rectangle at the specified coordinates
|
|
839
|
-
* @param {number} x
|
|
840
|
-
* @param {number} y
|
|
841
|
-
* @param {number} width
|
|
842
|
-
* @param {number} height
|
|
843
|
-
* @param {number} radius
|
|
839
|
+
* @param {number} x - x axis of the coordinate for the rounded rectangle starting point.
|
|
840
|
+
* @param {number} y - y axis of the coordinate for the rounded rectangle starting point.
|
|
841
|
+
* @param {number} width - The rounded rectangle's width.
|
|
842
|
+
* @param {number} height - The rounded rectangle's height.
|
|
843
|
+
* @param {number} radius - The rounded corner's radius.
|
|
844
844
|
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
845
845
|
*/
|
|
846
846
|
strokeRoundRect(x, y, width, height, radius, fill = false) {
|
|
@@ -857,11 +857,11 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
857
857
|
|
|
858
858
|
/**
|
|
859
859
|
* Draw a rounded filled rectangle at the specified coordinates
|
|
860
|
-
* @param {number} x
|
|
861
|
-
* @param {number} y
|
|
862
|
-
* @param {number} width
|
|
863
|
-
* @param {number} height
|
|
864
|
-
* @param {number} radius
|
|
860
|
+
* @param {number} x - x axis of the coordinate for the rounded rectangle starting point.
|
|
861
|
+
* @param {number} y - y axis of the coordinate for the rounded rectangle starting point.
|
|
862
|
+
* @param {number} width - The rounded rectangle's width.
|
|
863
|
+
* @param {number} height - The rounded rectangle's height.
|
|
864
|
+
* @param {number} radius - The rounded corner's radius.
|
|
865
865
|
*/
|
|
866
866
|
fillRoundRect(x, y, width, height, radius) {
|
|
867
867
|
this.strokeRoundRect(x, y, width, height, radius, true);
|
|
@@ -869,8 +869,8 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
869
869
|
|
|
870
870
|
/**
|
|
871
871
|
* Stroke a Point at the specified coordinates
|
|
872
|
-
* @param {number} x
|
|
873
|
-
* @param {number} y
|
|
872
|
+
* @param {number} x - x axis of the coordinate for the point.
|
|
873
|
+
* @param {number} y - y axis of the coordinate for the point.
|
|
874
874
|
*/
|
|
875
875
|
strokePoint(x, y) {
|
|
876
876
|
this.strokeLine(x, y, x + 1, y + 1);
|
|
@@ -878,10 +878,8 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
878
878
|
|
|
879
879
|
/**
|
|
880
880
|
* Draw a a point at the specified coordinates
|
|
881
|
-
* @param {number} x
|
|
882
|
-
* @param {number} y
|
|
883
|
-
* @param {number} width
|
|
884
|
-
* @param {number} height
|
|
881
|
+
* @param {number} x - x axis of the coordinate for the point.
|
|
882
|
+
* @param {number} y - y axis of the coordinate for the point.
|
|
885
883
|
*/
|
|
886
884
|
fillPoint(x, y) {
|
|
887
885
|
this.strokePoint(x, y);
|
|
@@ -914,8 +912,8 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
914
912
|
|
|
915
913
|
/**
|
|
916
914
|
* Translates the uniform matrix by the given coordinates
|
|
917
|
-
* @param {number} x
|
|
918
|
-
* @param {number} y
|
|
915
|
+
* @param {number} x - x axis of the coordinate for the translation.
|
|
916
|
+
* @param {number} y - y axis of the coordinate for the translation.
|
|
919
917
|
*/
|
|
920
918
|
translate(x, y) {
|
|
921
919
|
let currentTransform = this.currentTransform;
|
|
@@ -934,10 +932,10 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
934
932
|
* You can however save the current region using the save(),
|
|
935
933
|
* and restore it (with the restore() method) any time in the future.
|
|
936
934
|
* (<u>this is an experimental feature !</u>)
|
|
937
|
-
* @param {number} x
|
|
938
|
-
* @param {number} y
|
|
939
|
-
* @param {number} width
|
|
940
|
-
* @param {number} height
|
|
935
|
+
* @param {number} x - x axis of the coordinate for the upper-left corner of the rectangle to start clipping from.
|
|
936
|
+
* @param {number} y - y axis of the coordinate for the upper-left corner of the rectangle to start clipping from.
|
|
937
|
+
* @param {number} width - the width of the rectangle to start clipping from.
|
|
938
|
+
* @param {number} height - the height of the rectangle to start clipping from.
|
|
941
939
|
*/
|
|
942
940
|
clipRect(x, y, width, height) {
|
|
943
941
|
let canvas = this.getCanvas();
|
|
@@ -949,7 +947,7 @@ import { isPowerOfTwo } from "./../../math/math.js";
|
|
|
949
947
|
// if same as the current scissor box do nothing
|
|
950
948
|
if (currentScissor[0] === x && currentScissor[1] === y &&
|
|
951
949
|
currentScissor[2] === width && currentScissor[3] === height) {
|
|
952
|
-
|
|
950
|
+
return;
|
|
953
951
|
}
|
|
954
952
|
}
|
|
955
953
|
// flush the compositor
|
|
File without changes
|