melonjs 20.3.0 → 20.5.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/README.md +19 -19
- package/build/application/application.d.ts +0 -17
- package/build/application/application.d.ts.map +1 -1
- package/build/application/settings.d.ts +3 -0
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/backend/engine.d.ts +0 -19
- package/build/audio/backend/engine.d.ts.map +1 -1
- package/build/audio/backend/sound.d.ts +1 -51
- package/build/audio/backend/sound.d.ts.map +1 -1
- package/build/audio/backend/spatial.d.ts.map +1 -1
- package/build/audio/backend/types.d.ts +11 -1
- package/build/audio/backend/types.d.ts.map +1 -1
- package/build/audio/backend/voice.d.ts +0 -25
- package/build/audio/backend/voice.d.ts.map +1 -1
- package/build/audio/playback.d.ts.map +1 -1
- package/build/audio/procedural.d.ts +7 -2
- package/build/audio/procedural.d.ts.map +1 -1
- package/build/audio/state.d.ts +6 -79
- package/build/audio/state.d.ts.map +1 -1
- package/build/audio/types.d.ts +22 -0
- package/build/audio/types.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +28 -68
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +110 -82
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/camera/effects/fade_effect.d.ts +0 -5
- package/build/camera/effects/fade_effect.d.ts.map +1 -1
- package/build/camera/effects/mask_effect.d.ts +0 -5
- package/build/camera/effects/mask_effect.d.ts.map +1 -1
- package/build/camera/fog.d.ts +118 -0
- package/build/camera/fog.d.ts.map +1 -0
- package/build/geometries/box3d.d.ts +0 -28
- package/build/geometries/box3d.d.ts.map +1 -1
- package/build/geometries/ellipse.d.ts +0 -20
- package/build/geometries/ellipse.d.ts.map +1 -1
- package/build/geometries/observablePoint.d.ts +0 -3
- package/build/geometries/observablePoint.d.ts.map +1 -1
- package/build/geometries/path2d.d.ts +0 -19
- package/build/geometries/path2d.d.ts.map +1 -1
- package/build/geometries/polygon.d.ts +7 -13
- package/build/geometries/polygon.d.ts.map +1 -1
- package/build/geometries/roundrect.d.ts +0 -18
- package/build/geometries/roundrect.d.ts.map +1 -1
- package/build/geometries/sphere.d.ts +0 -9
- package/build/geometries/sphere.d.ts.map +1 -1
- package/build/geometries/toarccanvas.d.ts.map +1 -1
- package/build/index.d.ts +5 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3697 -563
- package/build/index.js.map +4 -4
- package/build/input/gamepad.d.ts.map +1 -1
- package/build/input/pointer.d.ts +0 -4
- package/build/input/pointer.d.ts.map +1 -1
- package/build/input/pointerevent.d.ts +0 -6
- package/build/input/pointerevent.d.ts.map +1 -1
- package/build/lang/deprecated.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts +44 -82
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/gltf/GLTFScene.d.ts +1 -44
- package/build/level/gltf/GLTFScene.d.ts.map +1 -1
- package/build/level/gltf/gltf_sampler.d.ts +1 -48
- package/build/level/gltf/gltf_sampler.d.ts.map +1 -1
- package/build/level/level.d.ts +195 -113
- package/build/level/level.d.ts.map +1 -1
- package/build/level/tiled/TMXGroup.d.ts +1 -65
- package/build/level/tiled/TMXGroup.d.ts.map +1 -1
- package/build/level/tiled/TMXLayer.d.ts +0 -44
- package/build/level/tiled/TMXLayer.d.ts.map +1 -1
- package/build/level/tiled/TMXObject.d.ts +1 -136
- package/build/level/tiled/TMXObject.d.ts.map +1 -1
- package/build/level/tiled/TMXObjectFactory.d.ts +1 -40
- package/build/level/tiled/TMXObjectFactory.d.ts.map +1 -1
- package/build/level/tiled/TMXTile.d.ts +1 -30
- package/build/level/tiled/TMXTile.d.ts.map +1 -1
- package/build/level/tiled/TMXTileMap.d.ts +0 -10
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/level/tiled/TMXTileset.d.ts +0 -113
- package/build/level/tiled/TMXTileset.d.ts.map +1 -1
- package/build/level/tiled/TMXTilesetGroup.d.ts +0 -1
- package/build/level/tiled/TMXTilesetGroup.d.ts.map +1 -1
- package/build/level/tiled/TMXUtils.d.ts +1 -43
- package/build/level/tiled/TMXUtils.d.ts.map +1 -1
- package/build/level/tiled/factories/shape.d.ts +1 -7
- package/build/level/tiled/factories/shape.d.ts.map +1 -1
- package/build/level/tiled/factories/text.d.ts +1 -7
- package/build/level/tiled/factories/text.d.ts.map +1 -1
- package/build/level/tiled/factories/tile.d.ts +1 -7
- package/build/level/tiled/factories/tile.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts +0 -60
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts +0 -42
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +0 -5
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +0 -31
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXRenderer.d.ts +2 -2
- package/build/level/tiled/renderer/TMXRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXStaggeredRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/autodetect.d.ts +1 -6
- package/build/level/tiled/renderer/autodetect.d.ts.map +1 -1
- package/build/lighting/light2d.d.ts +0 -25
- package/build/lighting/light2d.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts +20 -63
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/loader.d.ts +146 -37
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/loadingscreen.d.ts +0 -33
- package/build/loader/loadingscreen.d.ts.map +1 -1
- package/build/loader/parsers/aseprite.d.ts +0 -13
- package/build/loader/parsers/aseprite.d.ts.map +1 -1
- package/build/loader/parsers/audio.d.ts +1 -30
- package/build/loader/parsers/audio.d.ts.map +1 -1
- package/build/loader/parsers/binary.d.ts +1 -10
- package/build/loader/parsers/binary.d.ts.map +1 -1
- package/build/loader/parsers/compressed_textures/compressed_image.d.ts.map +1 -1
- package/build/loader/parsers/compressed_textures/parseDDS.d.ts +1 -7
- package/build/loader/parsers/compressed_textures/parseDDS.d.ts.map +1 -1
- package/build/loader/parsers/compressed_textures/parseKTX.d.ts +1 -7
- package/build/loader/parsers/compressed_textures/parseKTX.d.ts.map +1 -1
- package/build/loader/parsers/compressed_textures/parseKTX2.d.ts +1 -7
- package/build/loader/parsers/compressed_textures/parseKTX2.d.ts.map +1 -1
- package/build/loader/parsers/compressed_textures/parsePKM.d.ts +1 -7
- package/build/loader/parsers/compressed_textures/parsePKM.d.ts.map +1 -1
- package/build/loader/parsers/compressed_textures/parsePVR.d.ts +1 -7
- package/build/loader/parsers/compressed_textures/parsePVR.d.ts.map +1 -1
- package/build/loader/parsers/fontface.d.ts +1 -13
- package/build/loader/parsers/fontface.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts +1 -70
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/loader/parsers/image.d.ts +1 -22
- package/build/loader/parsers/image.d.ts.map +1 -1
- package/build/loader/parsers/json.d.ts +1 -10
- package/build/loader/parsers/json.d.ts.map +1 -1
- package/build/loader/parsers/mtl.d.ts +1 -28
- package/build/loader/parsers/mtl.d.ts.map +1 -1
- package/build/loader/parsers/obj.d.ts +1 -59
- package/build/loader/parsers/obj.d.ts.map +1 -1
- package/build/loader/parsers/pbr.d.ts +1 -62
- package/build/loader/parsers/pbr.d.ts.map +1 -1
- package/build/loader/parsers/script.d.ts +1 -10
- package/build/loader/parsers/script.d.ts.map +1 -1
- package/build/loader/parsers/shader.d.ts +1 -52
- package/build/loader/parsers/shader.d.ts.map +1 -1
- package/build/loader/parsers/tmx.d.ts +1 -10
- package/build/loader/parsers/tmx.d.ts.map +1 -1
- package/build/loader/parsers/video.d.ts +1 -10
- package/build/loader/parsers/video.d.ts.map +1 -1
- package/build/math/color.d.ts.map +1 -1
- package/build/math/noise.d.ts +0 -40
- package/build/math/noise.d.ts.map +1 -1
- package/build/math/observableVector2d.d.ts +0 -3
- package/build/math/observableVector2d.d.ts.map +1 -1
- package/build/math/observableVector3d.d.ts +0 -3
- package/build/math/observableVector3d.d.ts.map +1 -1
- package/build/math/vector2d.d.ts +0 -6
- package/build/math/vector2d.d.ts.map +1 -1
- package/build/math/vertex.d.ts +25 -0
- package/build/math/vertex.d.ts.map +1 -1
- package/build/particles/emitter.d.ts +0 -65
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/particles/particle.d.ts +0 -81
- package/build/particles/particle.d.ts.map +1 -1
- package/build/physics/bounds.d.ts +0 -1
- package/build/physics/bounds.d.ts.map +1 -1
- package/build/physics/broadphase/broadphase.d.ts +0 -7
- package/build/physics/broadphase/broadphase.d.ts.map +1 -1
- package/build/physics/broadphase/octree.d.ts +0 -91
- package/build/physics/broadphase/octree.d.ts.map +1 -1
- package/build/physics/broadphase/quadtree.d.ts +0 -47
- package/build/physics/broadphase/quadtree.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +2 -65
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts +0 -312
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/sat.d.ts +1 -48
- package/build/physics/builtin/sat.d.ts.map +1 -1
- package/build/physics/builtin/sat3d.d.ts +1 -56
- package/build/physics/builtin/sat3d.d.ts.map +1 -1
- package/build/physics/collision.d.ts +0 -2
- package/build/physics/collision.d.ts.map +1 -1
- package/build/physics/response.d.ts +0 -1
- package/build/physics/response.d.ts.map +1 -1
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/anchorPoint.d.ts +1 -73
- package/build/renderable/anchorPoint.d.ts.map +1 -1
- package/build/renderable/animation.d.ts +21 -13
- package/build/renderable/animation.d.ts.map +1 -1
- package/build/renderable/colorlayer.d.ts +0 -5
- package/build/renderable/colorlayer.d.ts.map +1 -1
- package/build/renderable/container.d.ts +27 -60
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/draggable.d.ts +0 -5
- package/build/renderable/draggable.d.ts.map +1 -1
- package/build/renderable/dragndrop.d.ts +1 -12
- package/build/renderable/dragndrop.d.ts.map +1 -1
- package/build/renderable/entity/entity.d.ts +0 -8
- package/build/renderable/entity/entity.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts +0 -41
- package/build/renderable/frameAnimation.d.ts.map +1 -1
- package/build/renderable/groundshadow.d.ts +1 -91
- package/build/renderable/groundshadow.d.ts.map +1 -1
- package/build/renderable/imagelayer.d.ts +0 -29
- package/build/renderable/imagelayer.d.ts.map +1 -1
- package/build/renderable/instanced_mesh.d.ts +55 -108
- package/build/renderable/instanced_mesh.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +257 -231
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/nineslicesprite.d.ts +0 -4
- package/build/renderable/nineslicesprite.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +18 -44
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +0 -45
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +12 -97
- package/build/renderable/sprite3d.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +32 -21
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/bitmaptextdata.d.ts +0 -22
- package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
- package/build/renderable/text/glyph.d.ts +1 -39
- package/build/renderable/text/glyph.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts +75 -20
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/renderable/text/textmetrics.d.ts +2 -0
- package/build/renderable/text/textmetrics.d.ts.map +1 -1
- package/build/renderable/text/textstyle.d.ts +1 -5
- package/build/renderable/text/textstyle.d.ts.map +1 -1
- package/build/renderable/trail.d.ts +0 -29
- package/build/renderable/trail.d.ts.map +1 -1
- package/build/renderable/trigger.d.ts +0 -6
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/renderable/ui/uibaseelement.d.ts +0 -40
- package/build/renderable/ui/uibaseelement.d.ts.map +1 -1
- package/build/renderable/ui/uispriteelement.d.ts +0 -35
- package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
- package/build/state/stage.d.ts +5 -50
- package/build/state/stage.d.ts.map +1 -1
- package/build/state/state.d.ts.map +1 -1
- package/build/system/device.d.ts +1 -13
- package/build/system/device.d.ts.map +1 -1
- package/build/system/dom.d.ts +1 -8
- package/build/system/dom.d.ts.map +1 -1
- package/build/system/legacy_pool.d.ts +1 -6
- package/build/system/legacy_pool.d.ts.map +1 -1
- package/build/system/platform.d.ts +0 -1
- package/build/system/platform.d.ts.map +1 -1
- package/build/system/pool.d.ts +0 -9
- package/build/system/pool.d.ts.map +1 -1
- package/build/system/save.d.ts +44 -1
- package/build/system/save.d.ts.map +1 -1
- package/build/system/timer.d.ts +0 -20
- package/build/system/timer.d.ts.map +1 -1
- package/build/tweens/tween.d.ts +0 -62
- package/build/tweens/tween.d.ts.map +1 -1
- package/build/utils/array-multimap.d.ts +1 -13
- package/build/utils/array-multimap.d.ts.map +1 -1
- package/build/utils/decode.d.ts.map +1 -1
- package/build/utils/fetchdata.d.ts +1 -31
- package/build/utils/fetchdata.d.ts.map +1 -1
- package/build/utils/utils.d.ts +0 -13
- package/build/utils/utils.d.ts.map +1 -1
- package/build/video/blendmodes.d.ts +1 -106
- package/build/video/blendmodes.d.ts.map +1 -1
- package/build/video/buffer/index.d.ts +1 -39
- package/build/video/buffer/index.d.ts.map +1 -1
- package/build/video/buffer/vertex.d.ts +1 -82
- package/build/video/buffer/vertex.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +2 -23
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/canvas_factory.d.ts +1 -24
- package/build/video/canvas_factory.d.ts.map +1 -1
- package/build/video/effects/blendEffect.d.ts +0 -54
- package/build/video/effects/blendEffect.d.ts.map +1 -1
- package/build/video/effects/colorMatrix.d.ts +0 -10
- package/build/video/effects/colorMatrix.d.ts.map +1 -1
- package/build/video/effects/glsl_realization.d.ts +1 -17
- package/build/video/effects/glsl_realization.d.ts.map +1 -1
- package/build/video/effects/mesh_splice.d.ts +2 -0
- package/build/video/effects/mesh_splice.d.ts.map +1 -0
- package/build/video/effects/radialGradient.d.ts +0 -1
- package/build/video/effects/radialGradient.d.ts.map +1 -1
- package/build/video/effects/shadereffect.d.ts +12 -241
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/effects/wgsl/layout.d.ts +1 -27
- package/build/video/effects/wgsl/layout.d.ts.map +1 -1
- package/build/video/effects/wgsl/parse.d.ts +1 -8
- package/build/video/effects/wgsl/parse.d.ts.map +1 -1
- package/build/video/effects/wgsl/scaffold.d.ts +1 -42
- package/build/video/effects/wgsl/scaffold.d.ts.map +1 -1
- package/build/video/effects/wgsl_realization.d.ts +1 -82
- package/build/video/effects/wgsl_realization.d.ts.map +1 -1
- package/build/video/gpu/batcher.d.ts +1 -13
- package/build/video/gpu/batcher.d.ts.map +1 -1
- package/build/video/gpu/instancerecord.d.ts +1 -163
- package/build/video/gpu/instancerecord.d.ts.map +1 -1
- package/build/video/gpu/meshchunk.d.ts +1 -48
- package/build/video/gpu/meshchunk.d.ts.map +1 -1
- package/build/video/gpu/meshvertex.d.ts +1 -53
- package/build/video/gpu/meshvertex.d.ts.map +1 -1
- package/build/video/gpu/primitives.d.ts +1 -59
- package/build/video/gpu/primitives.d.ts.map +1 -1
- package/build/video/gpu/quadcorners.d.ts +1 -10
- package/build/video/gpu/quadcorners.d.ts.map +1 -1
- package/build/video/gpu/textureslots.d.ts +1 -121
- package/build/video/gpu/textureslots.d.ts.map +1 -1
- package/build/video/gpu/texturestore.d.ts +1 -138
- package/build/video/gpu/texturestore.d.ts.map +1 -1
- package/build/video/gpu/topology.d.ts.map +1 -1
- package/build/video/gpu/vertexformat.d.ts +0 -28
- package/build/video/gpu/vertexformat.d.ts.map +1 -1
- package/build/video/gradient.d.ts +15 -77
- package/build/video/gradient.d.ts.map +1 -1
- package/build/video/renderer.d.ts +21 -102
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/renderstate.d.ts +0 -51
- package/build/video/renderstate.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts +0 -10
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts +1 -82
- package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
- package/build/video/rendertarget/webglrendertarget.d.ts +1 -64
- package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/webgpurendertarget.d.ts +0 -8
- package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -1
- package/build/video/texture/atlas.d.ts +1 -75
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/texture/cache.d.ts +0 -136
- package/build/video/texture/cache.d.ts.map +1 -1
- package/build/video/texture/frametexture.d.ts +1 -71
- package/build/video/texture/frametexture.d.ts.map +1 -1
- package/build/video/texture/noise_texture2d.d.ts +101 -77
- package/build/video/texture/noise_texture2d.d.ts.map +1 -1
- package/build/video/texture/parser/aseprite.d.ts +1 -8
- package/build/video/texture/parser/aseprite.d.ts.map +1 -1
- package/build/video/texture/parser/spritesheet.d.ts +1 -8
- package/build/video/texture/parser/spritesheet.d.ts.map +1 -1
- package/build/video/texture/parser/texturepacker.d.ts +1 -8
- package/build/video/texture/parser/texturepacker.d.ts.map +1 -1
- package/build/video/texture/resource.d.ts +0 -9
- package/build/video/texture/resource.d.ts.map +1 -1
- package/build/video/texture/texture2d.d.ts +0 -11
- package/build/video/texture/texture2d.d.ts.map +1 -1
- package/build/video/utils/autodetect.d.ts +1 -5
- package/build/video/utils/autodetect.d.ts.map +1 -1
- package/build/video/webgl/batchers/batcher.d.ts +0 -55
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts +0 -14
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +0 -72
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +0 -89
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +14 -343
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/primitive_batcher.d.ts +0 -10
- package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts +0 -30
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/index.d.ts +1 -36
- package/build/video/webgl/buffer/index.d.ts.map +1 -1
- package/build/video/webgl/buffer/instance_buffer.d.ts +1 -53
- package/build/video/webgl/buffer/instance_buffer.d.ts.map +1 -1
- package/build/video/webgl/buffer/retained_geometry.d.ts +1 -81
- package/build/video/webgl/buffer/retained_geometry.d.ts.map +1 -1
- package/build/video/webgl/buffer/uniformblock.d.ts +1 -80
- package/build/video/webgl/buffer/uniformblock.d.ts.map +1 -1
- package/build/video/webgl/buffer/vertexstate.d.ts +1 -100
- package/build/video/webgl/buffer/vertexstate.d.ts.map +1 -1
- package/build/video/webgl/glshader.d.ts +7 -51
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/lighting/pack3d.d.ts +1 -47
- package/build/video/webgl/lighting/pack3d.d.ts.map +1 -1
- package/build/video/webgl/lighting/std140.d.ts +1 -109
- package/build/video/webgl/lighting/std140.d.ts.map +1 -1
- package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts +1 -103
- package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts.map +1 -1
- package/build/video/webgl/shaders/multitexture-lit.d.ts +1 -26
- package/build/video/webgl/shaders/multitexture-lit.d.ts.map +1 -1
- package/build/video/webgl/shaders/multitexture.d.ts +1 -9
- package/build/video/webgl/shaders/multitexture.d.ts.map +1 -1
- package/build/video/webgl/texture/store.d.ts +1 -50
- package/build/video/webgl/texture/store.d.ts.map +1 -1
- package/build/video/webgl/utils/attributes.d.ts +1 -11
- package/build/video/webgl/utils/attributes.d.ts.map +1 -1
- package/build/video/webgl/utils/maxtextures.d.ts +1 -36
- package/build/video/webgl/utils/maxtextures.d.ts.map +1 -1
- package/build/video/webgl/utils/precision.d.ts +1 -14
- package/build/video/webgl/utils/precision.d.ts.map +1 -1
- package/build/video/webgl/utils/program.d.ts +1 -5
- package/build/video/webgl/utils/program.d.ts.map +1 -1
- package/build/video/webgl/utils/samplercache.d.ts +1 -68
- package/build/video/webgl/utils/samplercache.d.ts.map +1 -1
- package/build/video/webgl/utils/string.d.ts +1 -21
- package/build/video/webgl/utils/string.d.ts.map +1 -1
- package/build/video/webgl/utils/topology.d.ts +1 -23
- package/build/video/webgl/utils/topology.d.ts.map +1 -1
- package/build/video/webgl/utils/uniforms.d.ts +1 -25
- package/build/video/webgl/utils/uniforms.d.ts.map +1 -1
- package/build/video/webgl/utils/vertexformat.d.ts +1 -26
- package/build/video/webgl/utils/vertexformat.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts +22 -285
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts +0 -6
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_quad_batcher.d.ts +0 -8
- package/build/video/webgpu/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/mesh_batcher.d.ts +7 -231
- package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/quad_batcher.d.ts +0 -82
- package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgpu/buffer/arena.d.ts +1 -63
- package/build/video/webgpu/buffer/arena.d.ts.map +1 -1
- package/build/video/webgpu/buffer/instance_buffer.d.ts +1 -64
- package/build/video/webgpu/buffer/instance_buffer.d.ts.map +1 -1
- package/build/video/webgpu/buffer/retained_geometry.d.ts +1 -54
- package/build/video/webgpu/buffer/retained_geometry.d.ts.map +1 -1
- package/build/video/webgpu/buffer/uniformring.d.ts +1 -67
- package/build/video/webgpu/buffer/uniformring.d.ts.map +1 -1
- package/build/video/webgpu/effect_binding.d.ts +1 -16
- package/build/video/webgpu/effect_binding.d.ts.map +1 -1
- package/build/video/webgpu/pipeline/bindgroups.d.ts +1 -32
- package/build/video/webgpu/pipeline/bindgroups.d.ts.map +1 -1
- package/build/video/webgpu/pipeline/cache.d.ts +1 -163
- package/build/video/webgpu/pipeline/cache.d.ts.map +1 -1
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts +1 -87
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts.map +1 -1
- package/build/video/webgpu/shaders/mesh-instanced.d.ts +1 -43
- package/build/video/webgpu/shaders/mesh-instanced.d.ts.map +1 -1
- package/build/video/webgpu/texture/compressed.d.ts +1 -32
- package/build/video/webgpu/texture/compressed.d.ts.map +1 -1
- package/build/video/webgpu/texture/frametexture.d.ts +1 -62
- package/build/video/webgpu/texture/frametexture.d.ts.map +1 -1
- package/build/video/webgpu/texture/store.d.ts +1 -147
- package/build/video/webgpu/texture/store.d.ts.map +1 -1
- package/build/video/webgpu/webgpu_renderer.d.ts +1 -88
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +5 -4
- package/skills/melonjs/SKILL.md +1 -1
- package/skills/melonjs-3d/SKILL.md +453 -5
- package/skills/melonjs-3d-assets/SKILL.md +164 -6
- package/skills/melonjs-audio/SKILL.md +38 -0
- package/skills/melonjs-camera-and-drawing/SKILL.md +49 -0
- package/skills/melonjs-effects-and-shaders/SKILL.md +95 -2
- package/skills/melonjs-loading-assets/SKILL.md +127 -2
- package/skills/melonjs-performance/SKILL.md +60 -1
- package/skills/melonjs-physics/SKILL.md +78 -0
- package/skills/melonjs-renderables/SKILL.md +63 -1
- package/skills/melonjs-renderer-backends/SKILL.md +19 -0
- package/skills/melonjs-scenes-and-state/SKILL.md +56 -0
- package/skills/melonjs-tilemaps/SKILL.md +31 -11
- package/skills/melonjs-ui-and-text/SKILL.md +131 -117
|
@@ -6,6 +6,96 @@ license: MIT
|
|
|
6
6
|
|
|
7
7
|
# UI, HUD and text
|
|
8
8
|
|
|
9
|
+
## Outlined text: the stroke eats into the glyph
|
|
10
|
+
|
|
11
|
+
`Text` draws `fillText` and then `strokeText`, so the outline lands **on top of
|
|
12
|
+
the fill** and is centred on the glyph edge — half of it inward. On a small or
|
|
13
|
+
chunky face a `lineWidth` of 3 leaves the letters solid black. Keep it to 1,
|
|
14
|
+
and raise the font size rather than the stroke.
|
|
15
|
+
|
|
16
|
+
The stroke used to cost you the top row of pixels as well, and a display face
|
|
17
|
+
whose glyphs overshoot the nominal ascent did the same on its own: the render
|
|
18
|
+
box was sized from the line height alone, with no allowance for either. **That
|
|
19
|
+
is fixed** — the bake is padded by the ink's real extent and the blit shifts
|
|
20
|
+
back by the same amount, so nothing is clipped and the reported bounds are
|
|
21
|
+
unchanged. Write the string you mean:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
new Text(x, y, { font: "Display", lineWidth: 1, lineHeight: 1.45, text: "" });
|
|
25
|
+
hud.setText("SCORE 100");
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If you have a label carrying a leading `\n` to buy headroom, that workaround is
|
|
29
|
+
now dead weight — drop it, and take the line height back off the position you
|
|
30
|
+
shifted it by.
|
|
31
|
+
|
|
32
|
+
## Gradient text
|
|
33
|
+
|
|
34
|
+
`fillStyle` takes a `Gradient` as well as a colour — the same object
|
|
35
|
+
`Renderer#setColor` accepts, built the way the canvas API builds one:
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
const ramp = renderer.createLinearGradient(0, 0, 0, 24); // top to bottom
|
|
39
|
+
ramp.addColorStop(0, "#fffdf0");
|
|
40
|
+
ramp.addColorStop(1, "#f0a020");
|
|
41
|
+
|
|
42
|
+
new Text(x, y, { font: "Display", size: 24, fillStyle: ramp });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Coordinates are the label's own bake: `(0, 0)` is the top-left of the render
|
|
46
|
+
box, so the ramp above runs down one line. A multi-line label **restarts it on
|
|
47
|
+
every line**, reading like one `Text` per line — you do not have to author the
|
|
48
|
+
gradient over the block height. Pass `gradientPerLine: false` for a single ramp
|
|
49
|
+
spanning the whole block, which is what a plain canvas does and what a
|
|
50
|
+
deliberate fade across a two-line title wants.
|
|
51
|
+
|
|
52
|
+
The ramp colours the **fill only** — `Text` strokes in a separate pass, so
|
|
53
|
+
an outline keeps its own colour without any luminance trickery — and it works on
|
|
54
|
+
Canvas2D, which a post effect does not. `fillStyle.alpha` still gates the fill,
|
|
55
|
+
and the property still reads back as a `Color`.
|
|
56
|
+
|
|
57
|
+
## BitmapText: `size` is a RATIO, not pixels
|
|
58
|
+
|
|
59
|
+
The trap when moving over from `Text`:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
new Text(x, y, { font: "Arial", size: 24, text: "SCORE" }); // 24 pixels
|
|
63
|
+
new BitmapText(x, y, { font: "arial", size: 24, text: "SCORE" }); // 24 TIMES
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`size` scales the font's authored size, so `1` is native and `2` is double —
|
|
67
|
+
`resize(scale)` and `set(textAlign, scale)` take the same ratio. Whole numbers
|
|
68
|
+
keep pixel art crisp; fractional ones resample the page image.
|
|
69
|
+
|
|
70
|
+
It has **no stroke** — there is no `strokeStyle` or `lineWidth` here, which is
|
|
71
|
+
part of why it stays sharp. Colour comes from the tint instead:
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
const score = new BitmapText(8, 8, {
|
|
75
|
+
font: "arial", text: "1000", fillStyle: "#ffd700",
|
|
76
|
+
});
|
|
77
|
+
score.fillStyle = "#ff4040"; // recolour at any time
|
|
78
|
+
score.fillStyle = new Color(255, 255, 255); // UNTINTED, not "white text"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`fillStyle` is `Renderable#tint` under another name: white is the *absence* of a
|
|
82
|
+
tint and every other colour tints away from it, so author the page in white to
|
|
83
|
+
keep every colour available to you.
|
|
84
|
+
|
|
85
|
+
Load the descriptor as `binary` and its page as `image` under the **same name**.
|
|
86
|
+
Both BMFont flavours — text (`.fnt`) and XML — are auto-detected, so an `.xml`
|
|
87
|
+
descriptor loads as-is:
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
loader.preload([
|
|
91
|
+
{ name: "arial", type: "binary", src: "data/font/arial.fnt" },
|
|
92
|
+
{ name: "arial", type: "image", src: "data/font/arial.png" },
|
|
93
|
+
]);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Reach for it over `Text` when the text is mostly static, has to stay crisp at
|
|
97
|
+
integer scales, or wants recolouring without a re-bake.
|
|
98
|
+
|
|
9
99
|
## The HUD pattern
|
|
10
100
|
|
|
11
101
|
A HUD is a `floating` container at a high z, built once and re-added:
|
|
@@ -39,137 +129,61 @@ Three things matter here:
|
|
|
39
129
|
real accessor is `depth` (an alias for `pos.z`); `addChild(child, z)` sets it
|
|
40
130
|
for you.
|
|
41
131
|
|
|
42
|
-
|
|
132
|
+
### Buttons: extend the handlers, do not bind listeners
|
|
43
133
|
|
|
44
|
-
|
|
134
|
+
`UISpriteElement` is a `Sprite` that already registers itself for pointer
|
|
135
|
+
events, so a button is made by overriding methods rather than by wiring
|
|
136
|
+
`registerPointerEvent`:
|
|
45
137
|
|
|
46
|
-
|
|
47
|
-
|
|
138
|
+
| handler | fires | returns |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| `onClick(event)` | pressed | `false` to stop the event propagating |
|
|
141
|
+
| `onRelease(event)` | pressed and released | `false` to stop propagating |
|
|
142
|
+
| `onOver(event)` | pointer enters | — |
|
|
143
|
+
| `onOut(event)` | pointer leaves | — |
|
|
144
|
+
| `onHold()` | pressed and held | — |
|
|
48
145
|
|
|
49
146
|
```js
|
|
50
|
-
class
|
|
147
|
+
class MuteButton extends UISpriteElement {
|
|
51
148
|
constructor(x, y) {
|
|
52
|
-
super(x, y, { image: atlas, region: "
|
|
149
|
+
super(x, y, { image: atlas, region: "speaker.png" });
|
|
150
|
+
this.setOpacity(0.5);
|
|
151
|
+
}
|
|
152
|
+
onOver() { this.setOpacity(1.0); }
|
|
153
|
+
onOut() { this.setOpacity(0.5); }
|
|
154
|
+
onClick() {
|
|
155
|
+
audio.muteAll();
|
|
156
|
+
return false; // consumed — do not fall through to the world
|
|
53
157
|
}
|
|
54
|
-
onClick() { state.change(state.PLAY); return false; }
|
|
55
|
-
onOver() { this.setOpacity(1.0); }
|
|
56
|
-
onOut() { this.setOpacity(0.8); }
|
|
57
|
-
onRelease() { return false; }
|
|
58
158
|
}
|
|
59
159
|
```
|
|
60
160
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
| `UITextButton` | a `BitmapText` label on a `RoundRect` background — it needs a **bitmap** font, not a `fontface` |
|
|
66
|
-
| `Draggable` / `DropTarget` | drag-and-drop; `dropTarget.setCheckMethod(dropTarget.CHECKMETHOD_CONTAINS)` to require containment instead of overlap |
|
|
67
|
-
|
|
68
|
-
The callbacks to override are `onClick`, `onOver`, `onOut`, `onRelease` and
|
|
69
|
-
`onHold`; `UIBaseElement` adds `onMove` while dragging. Returning `false` from
|
|
70
|
-
`onClick` / `onRelease` stops the event propagating further.
|
|
71
|
-
|
|
72
|
-
## Text
|
|
73
|
-
|
|
74
|
-
```js
|
|
75
|
-
new Text(x, y, {
|
|
76
|
-
font: "Arial",
|
|
77
|
-
size: 32,
|
|
78
|
-
fillStyle: "#FFFFFF",
|
|
79
|
-
textAlign: "center",
|
|
80
|
-
textBaseline: "middle",
|
|
81
|
-
text: "Score: 0",
|
|
82
|
-
wordWrapWidth: 400, // enables wrapping
|
|
83
|
-
});
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
`text` accepts a string or an array of lines. Update with `setText()`.
|
|
87
|
-
|
|
88
|
-
**Custom web fonts must be preloaded** with the `"fontface"` asset type:
|
|
89
|
-
|
|
90
|
-
```js
|
|
91
|
-
{ name: "PressStart2P", type: "fontface", src: "data/font/PressStart2P.ttf" }
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Drawing before the font has loaded silently renders in a fallback font — the
|
|
95
|
-
layout looks subtly wrong rather than failing.
|
|
96
|
-
|
|
97
|
-
## `BitmapText`
|
|
98
|
-
|
|
99
|
-
For pixel-perfect text that scales without antialiasing, and for text drawn in
|
|
100
|
-
volume: every `BitmapText` sharing a font draws glyph quads from that one page
|
|
101
|
-
image, so they batch together. Each `Text` instead owns a private canvas
|
|
102
|
-
texture (re-rasterised whenever it changes), so a screenful of them is a
|
|
103
|
-
screenful of distinct textures.
|
|
104
|
-
|
|
105
|
-
```js
|
|
106
|
-
await loader.preload([
|
|
107
|
-
{ name: "PressStart2P", type: "image", src: "data/font/font.png" },
|
|
108
|
-
{ name: "PressStart2P", type: "binary", src: "data/font/font.fnt" },
|
|
109
|
-
]);
|
|
110
|
-
|
|
111
|
-
new BitmapText(x, y, {
|
|
112
|
-
font: "PressStart2P",
|
|
113
|
-
size: 2, // a scale ratio, not a pixel size
|
|
114
|
-
text: "GAME OVER",
|
|
115
|
-
});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
It needs **both** assets, and by default they must share the **same asset
|
|
119
|
-
name** — `settings.font` resolves the image *and*, unless you pass
|
|
120
|
-
`settings.fontData`, the descriptor. Registering the descriptor under a
|
|
121
|
-
different name (`"…-fnt"`) is the usual mistake; either use one name for both,
|
|
122
|
-
or pass `fontData: "PressStart2P-fnt"` explicitly.
|
|
123
|
-
|
|
124
|
-
The descriptor is AngelCode BMFont in either flavour — the text `.fnt` form or
|
|
125
|
-
the XML form — auto-detected, so an `.xml` export loads as-is.
|
|
126
|
-
|
|
127
|
-
## Never draw text through the raw context
|
|
161
|
+
The pointer still has to reach it: a renderable with `isKinematic = true` — the
|
|
162
|
+
default on a plain `Renderable` — is skipped by the broadphase and receives
|
|
163
|
+
nothing. `UISpriteElement` and `UIBaseElement` clear it for you; anything else
|
|
164
|
+
you make clickable has to clear it itself.
|
|
128
165
|
|
|
129
|
-
|
|
130
|
-
// ✗ works on Canvas only — getContext() returns the GL/GPU context on the
|
|
131
|
-
// GPU backends, and neither has fillText
|
|
132
|
-
app.renderer.getContext().fillText("hi", 10, 10);
|
|
133
|
-
|
|
134
|
-
// ✓
|
|
135
|
-
world.addChild(new Text(10, 10, { text: "hi", /* … */ }));
|
|
136
|
-
```
|
|
166
|
+
### In a 3D scene, a HUD needs a SMALL depth
|
|
137
167
|
|
|
138
|
-
`
|
|
139
|
-
|
|
140
|
-
the call throws `TypeError: … .fillText is not a function`, so this fails loudly
|
|
141
|
-
— but only on the machines that picked a GPU backend, which under `video.AUTO`
|
|
142
|
-
is most of them and probably not yours.
|
|
168
|
+
`floating` opts a renderable out of the camera transform. It does **not** opt it
|
|
169
|
+
out of the depth sort, and the two sorts read z differently:
|
|
143
170
|
|
|
144
|
-
|
|
171
|
+
| container `sortOn` | ordered by | on top |
|
|
172
|
+
| --- | --- | --- |
|
|
173
|
+
| `"z"` (default, 2D) | `pos.z` | **highest** z |
|
|
174
|
+
| `"depth"` (what `Camera3d` sets) | distance from the camera | **nearest** the camera |
|
|
145
175
|
|
|
146
|
-
`
|
|
147
|
-
|
|
176
|
+
Under `"depth"` a floating child is ordered by `|pos.z|` alone — its `pos.x/y`
|
|
177
|
+
are screen pixels, not a place in the world, and the camera does not move
|
|
178
|
+
relative to it. So the *magnitude* is the distance, and the sign is ignored:
|
|
148
179
|
|
|
149
180
|
```js
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
181
|
+
world.addChild(hud, -150); // small -> in front of the whole scene
|
|
182
|
+
world.addChild(backdrop, -10000); // large -> behind the whole scene
|
|
183
|
+
world.addChild(backdrop, 100000); // equally far: sign does not matter
|
|
153
184
|
```
|
|
154
185
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
## Symptom → cause
|
|
160
|
-
|
|
161
|
-
| symptom | cause |
|
|
162
|
-
|---|---|
|
|
163
|
-
| HUD scrolls away with the camera | missing `floating = true` on the container |
|
|
164
|
-
| HUD drawn under the game | `this.z = …` instead of `addChild(hud, z)` |
|
|
165
|
-
| hand-rolled button never responds | `isKinematic` left `true` — use `UISpriteElement` |
|
|
166
|
-
| text renders in the wrong font | web font not preloaded as `"fontface"` |
|
|
167
|
-
| `BitmapText` renders nothing | the `.fnt` / image pair was loaded under two different asset names |
|
|
168
|
-
| `TypeError: … .fillText is not a function` | drawn via `getContext()` under a GPU backend |
|
|
169
|
-
| `UIContainer is not defined` | no such class — use `Container` or `UIBaseElement` |
|
|
170
|
-
| UI misplaced after a window resize | no `CANVAS_ONRESIZE` relayout |
|
|
171
|
-
|
|
172
|
-
## Related skills
|
|
173
|
-
|
|
174
|
-
- `melonjs-input` — the `isKinematic` requirement in full
|
|
175
|
-
- `melonjs-renderables` — `floating`, draw order, containers
|
|
186
|
+
Give a HUD the huge z that would put it on top in 2D and it lands at the far end
|
|
187
|
+
of the level instead, with the scenery drawing over it. Both shipped idioms are
|
|
188
|
+
the same rule: afterBurner's HUD sits at `-150`, and the glTF, Billboard, Night
|
|
189
|
+
City and Instanced Forest examples park a floating sky at `-10000` or `100000`.
|