melonjs 20.7.0 → 20.9.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 +7 -3
- package/build/application/application.d.ts +66 -8
- package/build/application/application.d.ts.map +1 -1
- package/build/application/defaultApplicationSettings.d.ts +6 -0
- package/build/application/defaultApplicationSettings.d.ts.map +1 -1
- package/build/application/header.d.ts.map +1 -1
- package/build/application/resize.d.ts +25 -0
- package/build/application/resize.d.ts.map +1 -1
- package/build/application/scaleMethods.d.ts +13 -3
- package/build/application/scaleMethods.d.ts.map +1 -1
- package/build/application/settings.d.ts +144 -5
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/audio.d.ts +29 -5
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/autopause.d.ts +36 -0
- package/build/audio/autopause.d.ts.map +1 -0
- package/build/audio/backend/engine.d.ts +10 -1
- package/build/audio/backend/engine.d.ts.map +1 -1
- package/build/audio/backend/sound.d.ts +0 -1
- package/build/audio/backend/sound.d.ts.map +1 -1
- package/build/audio/backend/spatial.d.ts.map +1 -1
- package/build/audio/context.d.ts +35 -0
- package/build/audio/context.d.ts.map +1 -0
- package/build/audio/playback.d.ts.map +1 -1
- package/build/audio/procedural.d.ts.map +1 -1
- package/build/audio/spatial.d.ts +87 -0
- package/build/audio/spatial.d.ts.map +1 -0
- package/build/audio/state.d.ts +1 -0
- package/build/audio/state.d.ts.map +1 -1
- package/build/audio/types.d.ts +46 -6
- package/build/audio/types.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +95 -8
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/camera/effects/fade_effect.d.ts.map +1 -1
- package/build/camera/effects/mask_effect.d.ts.map +1 -1
- package/build/camera/effects/shake_effect.d.ts.map +1 -1
- package/build/geometries/box3d.d.ts +25 -7
- package/build/geometries/box3d.d.ts.map +1 -1
- package/build/geometries/ellipse.d.ts +15 -1
- package/build/geometries/ellipse.d.ts.map +1 -1
- package/build/geometries/line.d.ts +1 -1
- package/build/geometries/line.d.ts.map +1 -1
- package/build/geometries/point.d.ts +1 -1
- package/build/geometries/point.d.ts.map +1 -1
- package/build/geometries/polygon.d.ts +15 -1
- package/build/geometries/polygon.d.ts.map +1 -1
- package/build/geometries/rectangle.d.ts +1 -1
- package/build/geometries/rectangle.d.ts.map +1 -1
- package/build/geometries/roundrect.d.ts +1 -1
- package/build/geometries/roundrect.d.ts.map +1 -1
- package/build/geometries/sphere.d.ts +36 -7
- package/build/geometries/sphere.d.ts.map +1 -1
- package/build/index.d.ts +16 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +38172 -33633
- package/build/index.js.map +4 -4
- package/build/input/gamepad.d.ts +129 -3
- package/build/input/gamepad.d.ts.map +1 -1
- package/build/input/pointerevent.d.ts +8 -0
- package/build/input/pointerevent.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts +20 -33
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/gltf/GLTFScene.d.ts +40 -1
- package/build/level/gltf/GLTFScene.d.ts.map +1 -1
- package/build/level/level.d.ts +35 -0
- package/build/level/level.d.ts.map +1 -1
- package/build/level/tiled/TMXLayer.d.ts +5 -2
- package/build/level/tiled/TMXLayer.d.ts.map +1 -1
- package/build/level/tiled/TMXObject.d.ts +0 -1
- package/build/level/tiled/TMXObjectFactory.d.ts +3 -2
- package/build/level/tiled/TMXObjectFactory.d.ts.map +1 -1
- package/build/level/tiled/TMXTile.d.ts +2 -1
- package/build/level/tiled/TMXTile.d.ts.map +1 -1
- package/build/level/tiled/TMXTileMap.d.ts +7 -4
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/level/tiled/TMXTileset.d.ts +1 -1
- package/build/level/tiled/TMXTileset.d.ts.map +1 -1
- package/build/level/tiled/TMXTilesetGroup.d.ts +5 -0
- package/build/level/tiled/TMXTilesetGroup.d.ts.map +1 -1
- package/build/level/tiled/factories/shape.d.ts +0 -1
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts +6 -5
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts +5 -0
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +5 -7
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +5 -0
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXRenderer.d.ts +19 -4
- package/build/level/tiled/renderer/TMXRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/autodetect.d.ts +0 -4
- package/build/level/tiled/renderer/autodetect.d.ts.map +1 -1
- package/build/loader/cache.d.ts +220 -0
- package/build/loader/cache.d.ts.map +1 -1
- package/build/loader/loader.d.ts +20 -340
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/loadingscreen.d.ts +1 -2
- package/build/loader/loadingscreen.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts +115 -0
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/loader/parsers/shader.d.ts +0 -2
- package/build/math/color.d.ts +28 -5
- package/build/math/color.d.ts.map +1 -1
- package/build/math/matrix2d.d.ts +1 -1
- package/build/math/matrix2d.d.ts.map +1 -1
- package/build/math/matrix3d.d.ts +1 -1
- package/build/math/matrix3d.d.ts.map +1 -1
- package/build/math/observableVector2d.d.ts +14 -2
- package/build/math/observableVector2d.d.ts.map +1 -1
- package/build/math/observableVector3d.d.ts +15 -1
- package/build/math/observableVector3d.d.ts.map +1 -1
- package/build/math/vector2d.d.ts +31 -1
- package/build/math/vector2d.d.ts.map +1 -1
- package/build/math/vector3d.d.ts +38 -1
- package/build/math/vector3d.d.ts.map +1 -1
- package/build/math/vertex.d.ts.map +1 -1
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/particles/particle.d.ts +29 -2
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +104 -0
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +9 -1
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/bounds.d.ts +1 -1
- package/build/physics/bounds.d.ts.map +1 -1
- package/build/physics/broadphase/octree.d.ts +24 -0
- package/build/physics/broadphase/octree.d.ts.map +1 -1
- package/build/physics/broadphase/quadtree.d.ts +31 -0
- package/build/physics/broadphase/quadtree.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +17 -2
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts +0 -1
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/sat.d.ts +0 -7
- package/build/physics/builtin/sat3d.d.ts +46 -0
- package/build/physics/builtin/sat3d.d.ts.map +1 -1
- package/build/physics/response.d.ts +45 -62
- package/build/physics/response.d.ts.map +1 -1
- package/build/pool.d.ts +4 -0
- package/build/pool.d.ts.map +1 -1
- package/build/renderable/collectable.d.ts +6 -1
- package/build/renderable/collectable.d.ts.map +1 -1
- package/build/renderable/colorlayer.d.ts +17 -4
- package/build/renderable/colorlayer.d.ts.map +1 -1
- package/build/renderable/container.d.ts +23 -17
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/entity/entity.d.ts +12 -16
- package/build/renderable/entity/entity.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts +1 -1
- package/build/renderable/groundshadow.d.ts +1 -0
- package/build/renderable/groundshadow.d.ts.map +1 -1
- package/build/renderable/imagelayer.d.ts +12 -5
- package/build/renderable/imagelayer.d.ts.map +1 -1
- package/build/renderable/instanced_mesh.d.ts +56 -7
- package/build/renderable/instanced_mesh.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +369 -4
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/nineslicesprite.d.ts +3 -13
- package/build/renderable/nineslicesprite.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +129 -28
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +7 -20
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +31 -16
- package/build/renderable/sprite3d.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +76 -5
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/bitmaptextdata.d.ts +1 -5
- package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
- package/build/renderable/text/glypheffect.d.ts +44 -0
- package/build/renderable/text/glypheffect.d.ts.map +1 -0
- package/build/renderable/text/text.d.ts +22 -3
- 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/trail.d.ts +0 -1
- package/build/renderable/trail.d.ts.map +1 -1
- package/build/renderable/trail3d.d.ts +174 -0
- package/build/renderable/trail3d.d.ts.map +1 -0
- package/build/renderable/trigger.d.ts +28 -5
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/renderable/ui/panelpaint.d.ts +5 -0
- package/build/renderable/ui/panelpaint.d.ts.map +1 -0
- package/build/renderable/ui/progressbar.d.ts +192 -0
- package/build/renderable/ui/progressbar.d.ts.map +1 -0
- package/build/renderable/ui/uibaseelement.d.ts +48 -3
- package/build/renderable/ui/uibaseelement.d.ts.map +1 -1
- package/build/renderable/ui/uipanel.d.ts +245 -0
- package/build/renderable/ui/uipanel.d.ts.map +1 -0
- package/build/renderable/ui/uispriteelement.d.ts +19 -3
- package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
- package/build/renderable/ui/uitextbutton.d.ts +30 -1
- package/build/renderable/ui/uitextbutton.d.ts.map +1 -1
- package/build/state/state.d.ts.map +1 -1
- package/build/system/bootstrap.d.ts.map +1 -1
- package/build/system/legacy_pool.d.ts +24 -4
- package/build/system/legacy_pool.d.ts.map +1 -1
- package/build/system/pool.d.ts +15 -8
- package/build/system/pool.d.ts.map +1 -1
- package/build/tweens/tween.d.ts +50 -3
- package/build/tweens/tween.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +34 -23
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/effects/blendEffect.d.ts +0 -1
- package/build/video/effects/bloom.d.ts +72 -0
- package/build/video/effects/bloom.d.ts.map +1 -0
- package/build/video/effects/blur.d.ts +3 -2
- package/build/video/effects/blur.d.ts.map +1 -1
- package/build/video/effects/chromaticAberration.d.ts +3 -2
- package/build/video/effects/chromaticAberration.d.ts.map +1 -1
- package/build/video/effects/colorMatrix.d.ts +3 -2
- package/build/video/effects/colorMatrix.d.ts.map +1 -1
- package/build/video/effects/desaturate.d.ts +10 -2
- package/build/video/effects/desaturate.d.ts.map +1 -1
- package/build/video/effects/dissolve.d.ts +3 -2
- package/build/video/effects/dissolve.d.ts.map +1 -1
- package/build/video/effects/dropShadow.d.ts +3 -2
- package/build/video/effects/dropShadow.d.ts.map +1 -1
- package/build/video/effects/flash.d.ts +3 -2
- package/build/video/effects/flash.d.ts.map +1 -1
- package/build/video/effects/glow.d.ts +3 -2
- package/build/video/effects/glow.d.ts.map +1 -1
- package/build/video/effects/hologram.d.ts +3 -2
- package/build/video/effects/hologram.d.ts.map +1 -1
- package/build/video/effects/invert.d.ts +10 -2
- package/build/video/effects/invert.d.ts.map +1 -1
- package/build/video/effects/outline.d.ts +3 -2
- package/build/video/effects/outline.d.ts.map +1 -1
- package/build/video/effects/pixelate.d.ts +3 -2
- package/build/video/effects/pixelate.d.ts.map +1 -1
- package/build/video/effects/radialGradient.d.ts +8 -3
- package/build/video/effects/radialGradient.d.ts.map +1 -1
- package/build/video/effects/scanline.d.ts +3 -2
- package/build/video/effects/scanline.d.ts.map +1 -1
- package/build/video/effects/sepia.d.ts +10 -2
- package/build/video/effects/sepia.d.ts.map +1 -1
- package/build/video/effects/shadereffect.d.ts +10 -4
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/effects/shine.d.ts +3 -2
- package/build/video/effects/shine.d.ts.map +1 -1
- package/build/video/effects/tintPulse.d.ts +3 -7
- package/build/video/effects/tintPulse.d.ts.map +1 -1
- package/build/video/effects/tonemap.d.ts +121 -0
- package/build/video/effects/tonemap.d.ts.map +1 -0
- package/build/video/effects/vignette.d.ts +3 -2
- package/build/video/effects/vignette.d.ts.map +1 -1
- package/build/video/effects/wave.d.ts +3 -7
- package/build/video/effects/wave.d.ts.map +1 -1
- package/build/video/gpu/batcher.d.ts +8 -2
- package/build/video/gpu/batcher.d.ts.map +1 -1
- package/build/video/gpu/vertexformat.d.ts +26 -0
- package/build/video/gpu/vertexformat.d.ts.map +1 -1
- package/build/video/gradient.d.ts +1 -1
- package/build/video/gradient.d.ts.map +1 -1
- package/build/video/renderer.d.ts +111 -7
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/renderstate.d.ts +2 -0
- package/build/video/renderstate.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts +3 -4
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts +0 -1
- package/build/video/rendertarget/rendertarget.d.ts +12 -5
- package/build/video/rendertarget/rendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/webglrendertarget.d.ts +0 -1
- package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/webgpurendertarget.d.ts +24 -14
- package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -1
- package/build/video/texture/atlas.d.ts +2 -1
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/texture/cache.d.ts +1 -3
- package/build/video/texture/frametexture.d.ts +0 -1
- package/build/video/texture/frametexture.d.ts.map +1 -1
- package/build/video/texture/noise_texture2d.d.ts +1 -0
- package/build/video/texture/noise_texture2d.d.ts.map +1 -1
- package/build/video/texture/texture2d.d.ts +6 -0
- package/build/video/texture/texture2d.d.ts.map +1 -1
- package/build/video/utils/autodetect.d.ts +0 -2
- package/build/video/webgl/batchers/batcher.d.ts +0 -9
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +2 -0
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +4 -2
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +0 -3
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts +4 -0
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/index.d.ts +0 -1
- package/build/video/webgl/buffer/retained_geometry.d.ts +0 -1
- package/build/video/webgl/glshader.d.ts +5 -3
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts +0 -4
- package/build/video/webgl/texture/store.d.ts +0 -1
- package/build/video/webgl/webgl_renderer.d.ts +63 -24
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/mesh_batcher.d.ts +0 -3
- package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/quad_batcher.d.ts +0 -2
- package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts +0 -2
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts.map +1 -1
- package/build/video/webgpu/pipeline/cache.d.ts.map +1 -1
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts +0 -2
- package/build/video/webgpu/texture/frametexture.d.ts +0 -2
- package/build/video/webgpu/texture/frametexture.d.ts.map +1 -1
- package/build/video/webgpu/texture/store.d.ts +0 -1
- package/build/video/webgpu/webgpu_renderer.d.ts +7 -75
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +2 -2
- package/skills/AGENTS.md +1 -1
- package/skills/melonjs/SKILL.md +2 -0
- package/skills/melonjs-3d/SKILL.md +454 -22
- package/skills/melonjs-3d-assets/SKILL.md +111 -10
- package/skills/melonjs-audio/SKILL.md +229 -8
- package/skills/melonjs-camera-and-drawing/SKILL.md +127 -1
- package/skills/melonjs-display-and-scaling/SKILL.md +273 -0
- package/skills/melonjs-effects-and-shaders/SKILL.md +341 -29
- package/skills/melonjs-events/SKILL.md +8 -6
- package/skills/melonjs-input/SKILL.md +147 -7
- package/skills/melonjs-math/SKILL.md +313 -0
- package/skills/melonjs-particles-and-trails/SKILL.md +189 -13
- package/skills/melonjs-performance/SKILL.md +131 -23
- package/skills/melonjs-physics/SKILL.md +103 -28
- package/skills/melonjs-renderables/SKILL.md +8 -2
- package/skills/melonjs-scenes-and-state/SKILL.md +134 -3
- package/skills/melonjs-sprites-and-animation/SKILL.md +9 -4
- package/skills/melonjs-tilemaps/SKILL.md +40 -12
- package/skills/melonjs-ui-and-text/SKILL.md +546 -7
- package/build/level/gltf/srgb.d.ts +0 -20
- package/build/level/gltf/srgb.d.ts.map +0 -1
|
@@ -4,7 +4,36 @@ import Container from "../container.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* This is a basic clickable and draggable container which you can use in your game UI.
|
|
6
6
|
* Use this for example if you want to display a panel that contains text, images or other UI elements.
|
|
7
|
+
*
|
|
8
|
+
* Regions under the pointer are asked in the order they are drawn, topmost
|
|
9
|
+
* first, and the walk carries on downwards until a handler returns `false`. An
|
|
10
|
+
* element that can overlap another one is therefore not opaque until it says
|
|
11
|
+
* so: by default a widget it covers still answers clicks and still lights up on
|
|
12
|
+
* hover. {@link UIBaseElement#onClick}, {@link UIBaseElement#onRelease} and
|
|
13
|
+
* {@link UIBaseElement#onOver} each consume by returning `false`.
|
|
7
14
|
* @category UI
|
|
15
|
+
* @example
|
|
16
|
+
* // a panel that is opaque to the pointer and comes to the front when picked
|
|
17
|
+
* class Panel extends UIBaseElement {
|
|
18
|
+
* onClick() {
|
|
19
|
+
* this.ancestor.moveToTop(this);
|
|
20
|
+
* return false;
|
|
21
|
+
* }
|
|
22
|
+
* // the frame the pointer crosses in
|
|
23
|
+
* onOver() {
|
|
24
|
+
* return false;
|
|
25
|
+
* }
|
|
26
|
+
* // and every frame after that, when the pointer is already inside and
|
|
27
|
+
* // `onOver` no longer fires
|
|
28
|
+
* onActivateEvent() {
|
|
29
|
+
* super.onActivateEvent();
|
|
30
|
+
* me.input.registerPointerEvent("pointermove", this, () => false);
|
|
31
|
+
* }
|
|
32
|
+
* onDeactivateEvent() {
|
|
33
|
+
* me.input.releasePointerEvent("pointermove", this);
|
|
34
|
+
* super.onDeactivateEvent();
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
8
37
|
*/
|
|
9
38
|
export default class UIBaseElement extends Container {
|
|
10
39
|
/**
|
|
@@ -65,12 +94,28 @@ export default class UIBaseElement extends Container {
|
|
|
65
94
|
*/
|
|
66
95
|
onMove(_event?: Pointer): void;
|
|
67
96
|
/**
|
|
68
|
-
* function called when the pointer is over the object
|
|
97
|
+
* function called when the pointer is over the object.
|
|
98
|
+
*
|
|
99
|
+
* Fires once, on the frame the pointer crosses into the element. To stay
|
|
100
|
+
* opaque for as long as the pointer rests on it, an element also wants a
|
|
101
|
+
* `"pointermove"` callback registered through
|
|
102
|
+
* {@link input.registerPointerEvent} returning `false`, since by then the
|
|
103
|
+
* pointer is already inside and this no longer runs.
|
|
69
104
|
* @param _event - the event object
|
|
105
|
+
* @returns return false if we need to stop propagating the event, so that an
|
|
106
|
+
* element covered by this one does not also light up on hover
|
|
70
107
|
*/
|
|
71
|
-
onOver(_event?: Pointer): void;
|
|
108
|
+
onOver(_event?: Pointer): boolean | void;
|
|
72
109
|
/**
|
|
73
|
-
* function called when the pointer is leaving the object area
|
|
110
|
+
* function called when the pointer is leaving the object area.
|
|
111
|
+
*
|
|
112
|
+
* Fires when the pointer leaves the element's bounds, and also when it is
|
|
113
|
+
* still inside them but something drawn above has consumed the move, since
|
|
114
|
+
* the pointer is then over that instead.
|
|
115
|
+
*
|
|
116
|
+
* Unlike {@link UIBaseElement#onOver} this one cannot consume the event, on
|
|
117
|
+
* purpose: an element that suppressed its own leave would stay in its hover
|
|
118
|
+
* state after the pointer had gone.
|
|
74
119
|
* @param _event - the event object
|
|
75
120
|
*/
|
|
76
121
|
onOut(_event?: Pointer): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uibaseelement.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uibaseelement.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"uibaseelement.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uibaseelement.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAS;IACnD;;;;;OAKG;IACM,QAAQ,UAAQ;IAEzB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;IAGlB,WAAW,EAAE,MAAM,CAAC;IAGpB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;IAEjC;;;;;OAKG;gBACS,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM;IA+CxD;;;;OAIG;IAEH,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAuClC;;;OAGG;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAI9B;;;;;;;;;;;OAWG;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI;IAuBxC;;;;;;;;;;;OAWG;IAEH,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAmB7B;;;;OAIG;IAEH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAkBpC;;;OAGG;IACH,MAAM,IAAI,IAAI;CA4Dd"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import type Camera2d from "../../camera/camera2d.ts";
|
|
2
|
+
import type { Matrix3d } from "../../math/matrix3d.ts";
|
|
3
|
+
import type { Vector3d } from "../../math/vector3d.ts";
|
|
4
|
+
import type Renderer from "../../video/renderer.js";
|
|
5
|
+
import type { Paint } from "./panelpaint.ts";
|
|
6
|
+
import UIBaseElement from "./uibaseelement.ts";
|
|
7
|
+
/**
|
|
8
|
+
* Everything {@link UIPanel} takes.
|
|
9
|
+
*/
|
|
10
|
+
export interface UIPanelSettings {
|
|
11
|
+
/** the panel's width, in pixels */
|
|
12
|
+
width: number;
|
|
13
|
+
/** the panel's height, in pixels */
|
|
14
|
+
height: number;
|
|
15
|
+
/**
|
|
16
|
+
* The fill behind the children; `null` leaves it transparent.
|
|
17
|
+
*
|
|
18
|
+
* NOT `backgroundColor`, which a `Container` already has and which does
|
|
19
|
+
* something else entirely: that one is handed to `clearColor` and wipes
|
|
20
|
+
* the whole render target, so a panel setting it would repaint the
|
|
21
|
+
* screen. The name here matches {@link ProgressBarSettings} instead.
|
|
22
|
+
*/
|
|
23
|
+
fillColor?: Paint | null;
|
|
24
|
+
/** drawn around the edge; `null` for none */
|
|
25
|
+
borderColor?: Paint | null;
|
|
26
|
+
/** how thick that border is */
|
|
27
|
+
borderWidth?: number;
|
|
28
|
+
/** corner radius; `0` is square */
|
|
29
|
+
radius?: number;
|
|
30
|
+
/**
|
|
31
|
+
* How far the panel drifts up and down, in pixels. `0`, the default,
|
|
32
|
+
* leaves it still.
|
|
33
|
+
*
|
|
34
|
+
* See {@link UIPanel#bobAmplitude}.
|
|
35
|
+
*/
|
|
36
|
+
bobAmplitude?: number;
|
|
37
|
+
/**
|
|
38
|
+
* How long one full up and down cycle takes, in milliseconds.
|
|
39
|
+
*
|
|
40
|
+
* See {@link UIPanel#bobPeriod}.
|
|
41
|
+
*/
|
|
42
|
+
bobPeriod?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the panel swallows pointer events aimed at what is behind it.
|
|
45
|
+
*
|
|
46
|
+
* `true` by default, which is what a dialog wants: a click on the panel,
|
|
47
|
+
* or on the dimmed scene it covers, must not reach the game underneath.
|
|
48
|
+
* Children are unaffected either way, because the dispatcher asks a child
|
|
49
|
+
* before the container holding it.
|
|
50
|
+
*
|
|
51
|
+
* Set `false` for a panel that is only a backdrop, such as a HUD frame
|
|
52
|
+
* drawn over a playfield that still has to receive clicks.
|
|
53
|
+
*/
|
|
54
|
+
blocking?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A rectangular surface with a background, an optional border and children.
|
|
58
|
+
*
|
|
59
|
+
* The thing every menu, dialog and HUD frame starts by writing: a rounded
|
|
60
|
+
* rectangle, a fill, an outline, and some labels on top. One example in this
|
|
61
|
+
* repository had three of them, each repeating the same half dozen renderer
|
|
62
|
+
* calls, and each repeating the same correction for the way `setColor` folds
|
|
63
|
+
* the global alpha in. That correction is the reason this is a widget rather
|
|
64
|
+
* than a snippet: it is easy to leave out, and leaving it out does not fail,
|
|
65
|
+
* it just renders a panel at the wrong opacity.
|
|
66
|
+
*
|
|
67
|
+
* It is a {@link UIBaseElement}, so it is a container that carries pointer
|
|
68
|
+
* events, and children added to it are drawn over its background and are
|
|
69
|
+
* asked about a click before it is.
|
|
70
|
+
*
|
|
71
|
+
* It is floating, as every UI element is, and where it lands in the paint
|
|
72
|
+
* order is the depth it is added at. In a world sorted on `"depth"`, which
|
|
73
|
+
* is every `Camera3d` scene, that depth is read the other way round from
|
|
74
|
+
* the 2D habit: a floating child is ranked by `|pos.z|` there and the
|
|
75
|
+
* SMALLER magnitude draws on top, so a panel added at 9000 to sit above
|
|
76
|
+
* everything sits behind everything instead, and a dialog there wants a
|
|
77
|
+
* small depth, 0 or 1.
|
|
78
|
+
* @example
|
|
79
|
+
* import { UIPanel, Text } from "melonjs";
|
|
80
|
+
*
|
|
81
|
+
* const panel = new UIPanel(cx - 200, cy - 120, {
|
|
82
|
+
* width: 400,
|
|
83
|
+
* height: 240,
|
|
84
|
+
* fillColor: "#0a1526",
|
|
85
|
+
* borderColor: "rgba(130, 200, 240, 0.55)",
|
|
86
|
+
* borderWidth: 2,
|
|
87
|
+
* radius: 14,
|
|
88
|
+
* });
|
|
89
|
+
* // positioned relative to the panel, not to the screen
|
|
90
|
+
* panel.addChild(new Text(200, 24, { text: "PAUSED", textAlign: "center" }));
|
|
91
|
+
* app.world.addChild(panel);
|
|
92
|
+
* @category UI
|
|
93
|
+
*/
|
|
94
|
+
export default class UIPanel extends UIBaseElement {
|
|
95
|
+
/** the fill behind the children; `null` leaves it transparent */
|
|
96
|
+
fillColor: Paint | null;
|
|
97
|
+
/** drawn around the edge; `null` for none */
|
|
98
|
+
borderColor: Paint | null;
|
|
99
|
+
/** how thick that border is */
|
|
100
|
+
borderWidth: number;
|
|
101
|
+
/** corner radius; `0` is square */
|
|
102
|
+
radius: number;
|
|
103
|
+
/** whether it swallows pointer events aimed at what is behind it */
|
|
104
|
+
blocking: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* How far the panel drifts up and down, in pixels. `0`, the default,
|
|
107
|
+
* leaves it still.
|
|
108
|
+
*
|
|
109
|
+
* The slow float an idle dialogue or pause panel has in a lot of games,
|
|
110
|
+
* which is there so a screen waiting for input does not look frozen. It
|
|
111
|
+
* is a sine, so this is the distance to either extreme and the panel
|
|
112
|
+
* covers twice it over a cycle; 2 to 4 is the usual range, and it starts
|
|
113
|
+
* by rising rather than sinking.
|
|
114
|
+
*
|
|
115
|
+
* Do not go much below 2. The renderer snaps a translation to whole
|
|
116
|
+
* pixels, truncating, so an amplitude of 1 spends most of the cycle
|
|
117
|
+
* reading as 0 and the panel twitches rather than drifts.
|
|
118
|
+
*
|
|
119
|
+
* The panel is CLICKABLE where it is drawn: the offset goes into
|
|
120
|
+
* {@link UIPanel#getAbsolutePosition}, which is what the bounds pipeline
|
|
121
|
+
* reads, so the hit area of the panel and of every widget inside it
|
|
122
|
+
* follows the float at any depth. `pos` is deliberately left alone, so a
|
|
123
|
+
* caller still reads and writes the resting place rather than a value
|
|
124
|
+
* that moves under them.
|
|
125
|
+
*
|
|
126
|
+
* The bounds are rebuilt only on the frames the offset actually changes,
|
|
127
|
+
* so a panel with no bob costs nothing.
|
|
128
|
+
* @default 0
|
|
129
|
+
*/
|
|
130
|
+
bobAmplitude: number;
|
|
131
|
+
/**
|
|
132
|
+
* How long one full up and down cycle takes, in milliseconds.
|
|
133
|
+
*
|
|
134
|
+
* Anything at or below zero turns the bob off rather than dividing by it.
|
|
135
|
+
* That is not politeness: the offset would be `NaN`, and one `translate`
|
|
136
|
+
* by `NaN` writes it into the transform, where every batched vertex under
|
|
137
|
+
* it inherits the poison and the GPU clips the lot away. A panel that
|
|
138
|
+
* silently vanished would be a long way from an obviously bad period.
|
|
139
|
+
* @default 2000
|
|
140
|
+
*/
|
|
141
|
+
bobPeriod: number;
|
|
142
|
+
/**
|
|
143
|
+
* @param x - position of the panel's left edge
|
|
144
|
+
* @param y - position of the panel's top edge
|
|
145
|
+
* @param settings - see {@link UIPanelSettings}
|
|
146
|
+
*/
|
|
147
|
+
constructor(x: number, y: number, settings: UIPanelSettings);
|
|
148
|
+
/**
|
|
149
|
+
* Advance the bob.
|
|
150
|
+
* @param dt - time since the last frame, in milliseconds
|
|
151
|
+
* @returns whether the panel needs redrawing
|
|
152
|
+
*/
|
|
153
|
+
update(dt: number): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Draw the fill, the border, and then the children over both.
|
|
156
|
+
* @param renderer - the renderer to draw with
|
|
157
|
+
* @param viewport - the camera being drawn through, passed to the children
|
|
158
|
+
*/
|
|
159
|
+
draw(renderer: Renderer, viewport?: Camera2d): void;
|
|
160
|
+
/**
|
|
161
|
+
* Where the panel IS, bob included.
|
|
162
|
+
*
|
|
163
|
+
* THE hook that makes a floating panel honest. Both bounds paths funnel
|
|
164
|
+
* through this one method, and a child's absolute position is the sum of
|
|
165
|
+
* the chain above it, so adding the offset here reaches the panel's own
|
|
166
|
+
* hit area and every descendant's, at any depth, without any of them
|
|
167
|
+
* knowing a bob exists.
|
|
168
|
+
*
|
|
169
|
+
* Not `currentTransform`, which was the obvious guess: that reaches a
|
|
170
|
+
* renderable's OWN bounds and not its children's, so a bobbing panel's
|
|
171
|
+
* swallow rectangle would drift off the widgets sitting in it. And not a
|
|
172
|
+
* write to `pos`, which would reach everything correctly but silently
|
|
173
|
+
* overwrite a caller's own write on the very next frame.
|
|
174
|
+
*
|
|
175
|
+
* {@link Particle} overrides this method for the same reason, its
|
|
176
|
+
* placement not being in its `pos` chain either.
|
|
177
|
+
* @returns the absolute position, offset by the bob
|
|
178
|
+
*/
|
|
179
|
+
getAbsolutePosition(): Vector3d;
|
|
180
|
+
/**
|
|
181
|
+
* The matrix form of the same offset.
|
|
182
|
+
*
|
|
183
|
+
* Without it `getWorldTransform()` and `getAbsolutePosition()` disagree
|
|
184
|
+
* about a bobbing panel, and the contract on those two says that for a
|
|
185
|
+
* `Container` they coincide.
|
|
186
|
+
* @param out - matrix to write into
|
|
187
|
+
* @returns `out`, for chaining
|
|
188
|
+
*/
|
|
189
|
+
protected getLocalTransform(out: Matrix3d): Matrix3d;
|
|
190
|
+
/**
|
|
191
|
+
* Resize this panel's bounds, and refresh its children's.
|
|
192
|
+
*
|
|
193
|
+
* `Container` does those two jobs in ONE loop, both gated on
|
|
194
|
+
* `enableChildBoundsUpdate`, and a panel wants exactly one of them. The
|
|
195
|
+
* flag is off here so that a label overhanging the edge cannot grow the
|
|
196
|
+
* rectangle a blocking panel swallows clicks inside, and turning it off
|
|
197
|
+
* took the other job with it: a child's bounds are absolute, worked out
|
|
198
|
+
* once through `getAbsolutePosition()` and then cached, so moving the
|
|
199
|
+
* panel left every child's HIT AREA behind at the old place while the
|
|
200
|
+
* whole panel drew at the new one. A dialog slid or snapped into position
|
|
201
|
+
* after it was built had buttons that only answered where they used to
|
|
202
|
+
* be.
|
|
203
|
+
*
|
|
204
|
+
* This costs nothing per frame: `pos` calls `updateBounds` when it is
|
|
205
|
+
* written, so the walk happens when the panel actually moves.
|
|
206
|
+
* @param absolute - update in world absolute coordinates
|
|
207
|
+
* @returns this panel's bounds
|
|
208
|
+
*/
|
|
209
|
+
updateBounds(absolute?: boolean): import("../../index.ts").Bounds;
|
|
210
|
+
/**
|
|
211
|
+
* Consume a click on the panel itself, unless told not to.
|
|
212
|
+
*
|
|
213
|
+
* Returning `false` is how {@link UIBaseElement} consumes. A child is
|
|
214
|
+
* asked before the container holding it, so this only ever sees a click
|
|
215
|
+
* that missed every one of them, which for a dialog means a click on its
|
|
216
|
+
* own background and should go no further.
|
|
217
|
+
* @returns false while {@link UIPanel#blocking}
|
|
218
|
+
*/
|
|
219
|
+
onClick(): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Consume the release that follows a click on the panel, unless told not
|
|
222
|
+
* to.
|
|
223
|
+
*
|
|
224
|
+
* The three handlers consume independently. Taking the press and leaving
|
|
225
|
+
* the release is half a block: the pointer-up still reaches whatever is
|
|
226
|
+
* under the dialog, so a button there completes an interaction it never
|
|
227
|
+
* began.
|
|
228
|
+
* @returns false while {@link UIPanel#blocking}
|
|
229
|
+
*/
|
|
230
|
+
onRelease(): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Consume a hover on the panel itself, unless told not to.
|
|
233
|
+
*
|
|
234
|
+
* Without this a widget UNDER a dialog keeps lighting up as the pointer
|
|
235
|
+
* crosses the panel covering it.
|
|
236
|
+
* @returns false while {@link UIPanel#blocking}
|
|
237
|
+
*/
|
|
238
|
+
onOver(): boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Hand back what the painter borrowed.
|
|
241
|
+
* @ignore
|
|
242
|
+
*/
|
|
243
|
+
onDestroyEvent(): void;
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=uipanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uipanel.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uipanel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACzB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,CAA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AAO;IAI3B;;;;;;;;;OASG;IACM,SAAS,IAAI,OAAO;IAI7B;;;;;;OAMG;IACM,MAAM,IAAI,OAAO;IAI1B;;;OAGG;IACM,cAAc;CAIvB"}
|
|
@@ -74,12 +74,28 @@ export default class UISpriteElement extends Sprite {
|
|
|
74
74
|
*/
|
|
75
75
|
onClick(_event?: Pointer): boolean;
|
|
76
76
|
/**
|
|
77
|
-
* function called when the pointer is over the object
|
|
77
|
+
* function called when the pointer is over the object.
|
|
78
|
+
*
|
|
79
|
+
* Fires once, on the frame the pointer crosses into the element. To stay
|
|
80
|
+
* opaque for as long as the pointer rests on it, an element also wants a
|
|
81
|
+
* `"pointermove"` callback registered through
|
|
82
|
+
* {@link input.registerPointerEvent} returning `false`, since by then the
|
|
83
|
+
* pointer is already inside and this no longer runs.
|
|
78
84
|
* @param _event - the event object
|
|
85
|
+
* @returns return false if we need to stop propagating the event, so that an
|
|
86
|
+
* element covered by this one does not also light up on hover
|
|
79
87
|
*/
|
|
80
|
-
onOver(_event?: Pointer): void;
|
|
88
|
+
onOver(_event?: Pointer): boolean | void;
|
|
81
89
|
/**
|
|
82
|
-
* function called when the pointer is leaving the object area
|
|
90
|
+
* function called when the pointer is leaving the object area.
|
|
91
|
+
*
|
|
92
|
+
* Fires when the pointer leaves the element's bounds, and also when it is
|
|
93
|
+
* still inside them but something drawn above has consumed the move, since
|
|
94
|
+
* the pointer is then over that instead.
|
|
95
|
+
*
|
|
96
|
+
* Unlike {@link UISpriteElement#onOver} this one cannot consume the event, on
|
|
97
|
+
* purpose: an element that suppressed its own leave would stay in its hover
|
|
98
|
+
* state after the pointer had gone.
|
|
83
99
|
* @param _event - the event object
|
|
84
100
|
*/
|
|
85
101
|
onOut(_event?: Pointer): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uispriteelement.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uispriteelement.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,0BAA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F,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IAyC7C;;;;OAIG;IAEH,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAelC;;;;;;;;;;;OAWG;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI;IAgBxC;;;;;;;;;;;OAWG;IAEH,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAmB7B;;;;OAIG;IAEH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAkBpC;;;OAGG;IACH,MAAM,IAAI,IAAI;CAyCd"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type Camera2d from "../../camera/camera2d.ts";
|
|
2
2
|
import { RoundRect } from "../../geometries/roundrect.ts";
|
|
3
|
+
import type Pointer from "../../input/pointer.ts";
|
|
3
4
|
import type { Bounds } from "../../physics/bounds.ts";
|
|
4
5
|
import type Renderer from "../../video/renderer.js";
|
|
5
6
|
import BitmapText from "../text/bitmaptext.js";
|
|
@@ -8,6 +9,7 @@ interface UITextButtonSettings {
|
|
|
8
9
|
font?: string;
|
|
9
10
|
size?: number;
|
|
10
11
|
text?: string;
|
|
12
|
+
/** see {@link UITextButton.bindKey} */
|
|
11
13
|
bindKey?: string | number;
|
|
12
14
|
hoverOffColor?: string;
|
|
13
15
|
hoverOnColor?: string;
|
|
@@ -25,9 +27,31 @@ interface UITextButtonSettings {
|
|
|
25
27
|
*/
|
|
26
28
|
export default class UITextButton extends UIBaseElement {
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
30
|
+
* Keyboard shortcut: an input.KEY keycode or an existing input action name.
|
|
31
|
+
* A press calls onClick() and its matching release calls onRelease(), both
|
|
32
|
+
* without a pointer event. Shortcuts are active only while the button is
|
|
33
|
+
* activated and never change global key bindings. The first input to press
|
|
34
|
+
* owns the button until released; shortcuts do not start pointer dragging
|
|
35
|
+
* or tap-and-hold.
|
|
36
|
+
*
|
|
37
|
+
* `isClickable` gates the PRESS, not the release: a button disabled while
|
|
38
|
+
* its key is held still releases when that key comes up, so it cannot be
|
|
39
|
+
* left stuck down.
|
|
40
|
+
*
|
|
41
|
+
* **Losing focus or being removed cancels a held press WITHOUT calling
|
|
42
|
+
* `onRelease()`.** The press was abandoned rather than completed, so the
|
|
43
|
+
* button returns to its released state silently. Code that treats the pair
|
|
44
|
+
* as press and depress, firing a weapon on click and stopping on release,
|
|
45
|
+
* needs to stop on {@link event.BLUR} too or it will still be firing when
|
|
46
|
+
* the window comes back.
|
|
47
|
+
* @default -1
|
|
29
48
|
*/
|
|
30
49
|
bindKey: string | number;
|
|
50
|
+
private keyboardKey;
|
|
51
|
+
private keyboardActive;
|
|
52
|
+
private readonly keyDown;
|
|
53
|
+
private readonly keyUp;
|
|
54
|
+
private readonly cancelKeyboardPress;
|
|
31
55
|
/**
|
|
32
56
|
* The css value of a color to be used if the pointer is not hovering over the button
|
|
33
57
|
*/
|
|
@@ -95,6 +119,11 @@ export default class UITextButton extends UIBaseElement {
|
|
|
95
119
|
* world.addChild(new PlayButton(15,200));
|
|
96
120
|
*/
|
|
97
121
|
constructor(x: number, y: number, settings: UITextButtonSettings);
|
|
122
|
+
onActivateEvent(): void;
|
|
123
|
+
onDeactivateEvent(): void;
|
|
124
|
+
clicked(event: Pointer): boolean | void;
|
|
125
|
+
release(event: Pointer): boolean | void;
|
|
126
|
+
pointerMove(event: Pointer): void;
|
|
98
127
|
draw(renderer: Renderer, viewport?: Camera2d): void;
|
|
99
128
|
}
|
|
100
129
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uitextbutton.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uitextbutton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,0B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,IAAI;IAqB7C;;;OAGG;kBACU,OAAO,GAAW,IAAI;IAkBnC;;;OAGG;oBACY,OAAO,GAAW,IAAI;IAiBrC;;;OAGG;mBACW,OAAO,GAAW,IAAI;IAmBpC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;qBACc,MAAM,UAAS,OAAO,GAAW,OAAO,CAAC,IAAI,CAAC;IAkC/D;;;OAGG;iBACU,OAAO;IAIpB;;;OAGG;gBACS,OAAO;IAInB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;iBACU,MAAM,SAAS,KAAK,UAAS,OAAO,GAAW,IAAI;IAchE;;;;;OAKG;kBACU,MAAM,GAAY,KAAK,GAAG,SAAS;IAQhD;;;;OAIG;eACQ,KAAK,GAAG,SAAS;IAI5B;;;;;;;;;;;;;;;;;;OAkBG;uBAEM,MAAM,GAAG,MAAM,SAChB,MAAM,aACH,MAAM,UAEb,OAAO,0BAA0B,EAAE,OAAO,GAC1C,OAAO,0BAA0B,EAAE,OAAO,GAC3C,IAAI;IAOP;;;;OAIG;2BACoB,MAAM,UAAU,OAAO,GAAG,IAAI;IAIrD;;;;;;;;;OASG;oBAEO,MAAM,gBACF,OAAO,gBACN,OAAO,EAAE,GACrB,IAAI;IA0GP;;;;OAIG;uBACgB,MAAM,GAAG,OAAO;CAGnC,CAAC;AACF,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/system/bootstrap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/system/bootstrap.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,eAAO,IAAI,WAAW,SAAQ,CAAC;AAE/B;;;;;;GAMG;AACH,wBAAgB,IAAI,SAmDnB"}
|
|
@@ -27,6 +27,17 @@ declare const pool: ObjectPool;
|
|
|
27
27
|
* which means, that on level loading the engine will try to instantiate every object
|
|
28
28
|
* found in the map, based on the user defined name in each Object Properties<br>
|
|
29
29
|
* <img src="../images/object_properties.png"/><br>
|
|
30
|
+
*
|
|
31
|
+
* **Superseded by the typed pools.** `createPool` arrived in 18.0.0 and does
|
|
32
|
+
* the same job without the string keys: `getPool("tween")`, `getPool("text")`
|
|
33
|
+
* and the rest are typed, so a wrong name is a compile error rather than a
|
|
34
|
+
* throw, and a pool can be created for any class with `createPool`. For
|
|
35
|
+
* registering a class so a Tiled map can name it, use
|
|
36
|
+
* {@link registerTiledObjectClass}, which is what this now delegates to.
|
|
37
|
+
*
|
|
38
|
+
* The engine itself no longer uses this pool for anything.
|
|
39
|
+
* @deprecated since 18.0.0, use {@link getPool} / `createPool`, and
|
|
40
|
+
* {@link registerTiledObjectClass} for Tiled classes
|
|
30
41
|
* @see {@link pool} the default global instance of ObjectPool
|
|
31
42
|
*/
|
|
32
43
|
declare class ObjectPool {
|
|
@@ -76,7 +87,7 @@ declare class ObjectPool {
|
|
|
76
87
|
/**
|
|
77
88
|
* Pull a new instance of the requested object (if added into the object pool)
|
|
78
89
|
* @param {string} name - as used in {@link pool.register}
|
|
79
|
-
* @param {...*}
|
|
90
|
+
* @param {...*} args - arguments to be passed when instantiating/reinitializing the object
|
|
80
91
|
* @returns {object} the instance of the requested object
|
|
81
92
|
* @example
|
|
82
93
|
* me.pool.register("bullet", BulletEntity, true);
|
|
@@ -94,7 +105,7 @@ declare class ObjectPool {
|
|
|
94
105
|
* app.world.removeChild(enemy);
|
|
95
106
|
* app.world.removeChild(bullet);
|
|
96
107
|
*/
|
|
97
|
-
pull(name: string, ...args
|
|
108
|
+
pull(name: string, ...args: any[]): object;
|
|
98
109
|
/**
|
|
99
110
|
* purge the object pool from any inactive object <br>
|
|
100
111
|
* Object pooling must be enabled for this function to work<br>
|
|
@@ -106,9 +117,18 @@ declare class ObjectPool {
|
|
|
106
117
|
* Object pooling for the object class must be enabled,
|
|
107
118
|
* and object must have been instantiated using {@link pull},
|
|
108
119
|
* otherwise this function won't work
|
|
109
|
-
*
|
|
120
|
+
*
|
|
121
|
+
* Reports failure by RETURNING FALSE. It used to throw by default, and
|
|
122
|
+
* nothing at the call site made that visible: a class that was never
|
|
123
|
+
* registered, or registered without recycling, aborted whatever was
|
|
124
|
+
* running. Both of the internal uses removed in 20.7.0 failed that way,
|
|
125
|
+
* inside a `destroy()` that had already recycled other state, which left
|
|
126
|
+
* a half-torn-down object to die later somewhere unrelated. Pass
|
|
127
|
+
* `throwOnError` to opt back in where a missed registration is a bug you
|
|
128
|
+
* want to hear about immediately.
|
|
110
129
|
* @param {object} obj - instance to be recycled
|
|
111
|
-
* @param {boolean} [throwOnError=
|
|
130
|
+
* @param {boolean} [throwOnError=false] - throw an exception instead of returning false
|
|
131
|
+
* @throws when the object cannot be recycled AND `throwOnError` is true
|
|
112
132
|
* @returns {boolean} true if the object was successfully recycled in the object pool
|
|
113
133
|
*/
|
|
114
134
|
push(obj: object, throwOnError?: boolean): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy_pool.d.ts","sourceRoot":"","sources":["../../src/system/legacy_pool.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"legacy_pool.d.ts","sourceRoot":"","sources":["../../src/system/legacy_pool.js"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,kEAEC;;AA4QD;;;;;;;;;;;;;;GAcG;AACH,+BAA8B;AAvP9B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAEE,gBAAqB;IACrB,yBAAyB;IAEzB;;;;;;;;;;;;;;OAcG;IACH,mBARU,OAAO,CAQY;IAG9B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,oBAhBW,MAAM,YACN,MAAM,cACN,OAAO,QAuCjB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,WAnBW,MAAM,WACH,GAAC,EAAA,GACF,MAAM,CAuClB;IAED;;;;OAIG;IACH,cAOC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,UALW,MAAM,iBACN,OAAO,GAEL,OAAO,CAiBnB;IAED;;;;OAIG;IACH,aAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;;;OAUG;IACH,cAPW,MAAM,GACJ,OAAO,CAcnB;IAED;;;OAGG;IACH,oBAFa,MAAM,CAIlB;CACD"}
|
package/build/system/pool.d.ts
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
export interface Pool<T, A extends unknown[]> {
|
|
1
|
+
export interface Pool<T extends object, A extends unknown[]> {
|
|
2
2
|
get(...args: A): T;
|
|
3
3
|
release(object: T): void;
|
|
4
4
|
purge(): void;
|
|
5
5
|
size(): number;
|
|
6
6
|
used(): number;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
type Release = (() => void) | undefined;
|
|
10
|
-
export interface CreatePoolOptions<T, A extends unknown[]> {
|
|
8
|
+
export interface CreatePoolOptions<T extends object, A extends unknown[]> {
|
|
11
9
|
instance: T;
|
|
12
|
-
reset?:
|
|
13
|
-
release?:
|
|
10
|
+
reset?: ((...args: A) => void) | undefined;
|
|
11
|
+
release?: (() => void) | undefined;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Register a pool instance to the pool registry.
|
|
15
|
+
*
|
|
16
|
+
* Public because `pool.js` re-exports it. Marked internal it was stripped
|
|
17
|
+
* from the declarations while that re-export kept naming it, which left the
|
|
18
|
+
* public `pool` module exporting something no longer declared.
|
|
19
|
+
* @param key - the name this pool is reachable by
|
|
20
|
+
* @param pool - the pool instance to register under it
|
|
21
|
+
*/
|
|
22
|
+
export declare const registerPool: (key: string, pool: Pool<any, any[]>) => void;
|
|
23
|
+
export declare const createPool: <T extends object, A extends unknown[]>(options: (...args: A) => CreatePoolOptions<T, A>) => Pool<T, A>;
|
|
17
24
|
//# sourceMappingURL=pool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/system/pool.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/system/pool.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,EAAE;IAC1D,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,MAAM,CAAC;IACf,IAAI,IAAI,MAAM,CAAC;CACf;AAKD,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,EAAE;IACvE,QAAQ,EAAE,CAAC,CAAC;IAIZ,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC3C,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CACnC;AAKD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,EAAE,MAAM,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,SAE/D,CAAC;AAuEF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,EAAE,EAC/D,SAAS,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,KAC9C,IAAI,CAAC,CAAC,EAAE,CAAC,CAyGX,CAAC"}
|
package/build/tweens/tween.d.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { EasingFunction } from "./easing.js";
|
|
2
2
|
import { InterpolationFunction } from "./interpolation.js";
|
|
3
|
+
/**
|
|
4
|
+
* Called once when a tween starts, with `this` bound to the tweened object.
|
|
5
|
+
* @see Tween#onStart
|
|
6
|
+
*/
|
|
7
|
+
export type OnStartCallback<T> = (this: T) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Called on every tween step with the eased progress in `[0, 1]`, and `this`
|
|
10
|
+
* bound to the tweened object.
|
|
11
|
+
* @see Tween#onUpdate
|
|
12
|
+
*/
|
|
13
|
+
export type OnUpdateCallback<T> = (this: T, value: number) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Called once when a tween finishes, with `this` bound to the tweened object.
|
|
16
|
+
* @see Tween#onComplete
|
|
17
|
+
*/
|
|
18
|
+
export type OnCompleteCallback<T> = (this: T) => void;
|
|
3
19
|
/**
|
|
4
20
|
* A tweening engine for smoothly interpolating object properties over time.
|
|
5
21
|
* Based on <a href="https://github.com/sole/Tween.js">tween.js</a> with
|
|
@@ -140,12 +156,43 @@ export default class Tween {
|
|
|
140
156
|
onComplete(onCompleteCallback: OnCompleteCallback<object>): this;
|
|
141
157
|
/**
|
|
142
158
|
* Available easing functions, accessed via `Tween.Easing`.
|
|
143
|
-
*
|
|
144
|
-
*
|
|
159
|
+
*
|
|
160
|
+
* Eleven families, each providing `In`, `Out` and `InOut`. `In` applies the
|
|
161
|
+
* curve at the start, `Out` at the end, and `InOut` at both. `Out` is what
|
|
162
|
+
* most UI wants: the value arrives decisively rather than creeping in.
|
|
163
|
+
*
|
|
164
|
+
* | family | shape | reach for it when |
|
|
165
|
+
* | --- | --- | --- |
|
|
166
|
+
* | `Linear.None` | no curve at all | the value IS the progress, e.g. a loading bar |
|
|
167
|
+
* | `Quadratic` `Cubic` `Quartic` `Quintic` | progressively sharper power curves | general motion; higher powers start slower and finish harder |
|
|
168
|
+
* | `Sinusoidal` | gentlest of all | a drift or a breath that should not call attention |
|
|
169
|
+
* | `Exponential` | extreme, near-instant at one end | something that snaps |
|
|
170
|
+
* | `Circular` | hard, like the quarter of a circle | a mechanical slide |
|
|
171
|
+
* | `Back` | **overshoots past the target and settles back** | impact: a stamp, a button press, anything that should land rather than arrive |
|
|
172
|
+
* | `Elastic` | overshoots repeatedly, oscillating | springy, cartoon motion |
|
|
173
|
+
* | `Bounce` | lands and bounces, settling | something falling onto a surface |
|
|
174
|
+
*
|
|
175
|
+
* `Back` and `Elastic` overshoot, so the value LEAVES the range between
|
|
176
|
+
* your start and end: clamp anything that cannot take it, an opacity or a
|
|
177
|
+
* colour channel in particular. Note the direction of the overshoot follows
|
|
178
|
+
* the direction of travel, so a value tweened DOWN to its target overshoots
|
|
179
|
+
* below it.
|
|
180
|
+
* @see https://easings.net/ for a visual reference of every curve
|
|
145
181
|
* @example
|
|
146
182
|
* me.Tween.Easing.Quadratic.InOut
|
|
147
183
|
* me.Tween.Easing.Bounce.Out
|
|
148
184
|
* me.Tween.Easing.Elastic.In
|
|
185
|
+
* @example
|
|
186
|
+
* // a stamp: scale falls to 1 and springs through it
|
|
187
|
+
* const driver = { scale: 5 };
|
|
188
|
+
* new me.Tween(driver)
|
|
189
|
+
* .to({ scale: 1 }, { duration: 420 })
|
|
190
|
+
* .easing(me.Tween.Easing.Back.Out)
|
|
191
|
+
* .onUpdate(() => {
|
|
192
|
+
* label.currentTransform.identity();
|
|
193
|
+
* label.scale(driver.scale);
|
|
194
|
+
* })
|
|
195
|
+
* .start();
|
|
149
196
|
*/
|
|
150
197
|
static get Easing(): {
|
|
151
198
|
Linear: {
|
|
@@ -216,5 +263,5 @@ export default class Tween {
|
|
|
216
263
|
CatmullRom: (v: number[], k: number) => number;
|
|
217
264
|
};
|
|
218
265
|
}
|
|
219
|
-
export declare const tweenPool: import("../
|
|
266
|
+
export declare const tweenPool: import("../index.ts").Pool<Tween, [obj: object]>;
|
|
220
267
|
//# sourceMappingURL=tween.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tween.d.ts","sourceRoot":"","sources":["../../src/tweens/tween.ts"],"names":[],"mappings":"AAWA,OAAO,EAAU,cAAc,EAA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