melonjs 20.12.0 → 20.14.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 +66 -22
- package/build/application/application.d.ts +6 -1
- package/build/application/application.d.ts.map +1 -1
- package/build/application/header.d.ts.map +1 -1
- package/build/application/resize.d.ts.map +1 -1
- package/build/application/settings.d.ts +13 -8
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/audio.d.ts +8 -4
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/backend/engine.d.ts.map +1 -1
- package/build/audio/playback.d.ts +2 -2
- package/build/audio/playback.d.ts.map +1 -1
- package/build/audio/spatial.d.ts.map +1 -1
- package/build/audio/types.d.ts +15 -5
- package/build/audio/types.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +12 -9
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +11 -8
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/camera/effects/fade_effect.d.ts.map +1 -1
- package/build/geometries/ellipse.d.ts +3 -0
- package/build/geometries/ellipse.d.ts.map +1 -1
- package/build/geometries/line.d.ts.map +1 -1
- package/build/geometries/path2d.d.ts +9 -8
- package/build/geometries/path2d.d.ts.map +1 -1
- package/build/geometries/polygon.d.ts +2 -1
- package/build/geometries/polygon.d.ts.map +1 -1
- package/build/index.d.ts +14 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +50215 -45051
- package/build/index.js.map +4 -4
- package/build/input/gamepad.d.ts.map +1 -1
- package/build/input/keyboard.d.ts.map +1 -1
- package/build/input/pointerevent.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/level.d.ts.map +1 -1
- package/build/level/tiled/TMXLayer.d.ts +50 -15
- package/build/level/tiled/TMXLayer.d.ts.map +1 -1
- package/build/level/tiled/TMXTileMap.d.ts +14 -4
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/level/tiled/TMXTileset.d.ts.map +1 -1
- package/build/level/tiled/TMXUtils.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +1 -0
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXRenderer.d.ts +7 -3
- package/build/level/tiled/renderer/TMXRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXStaggeredRenderer.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts +55 -0
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/cache.d.ts +146 -97
- package/build/loader/cache.d.ts.map +1 -1
- package/build/loader/internal-types.d.ts +69 -0
- package/build/loader/internal-types.d.ts.map +1 -0
- package/build/loader/loader.d.ts +589 -253
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/audio.d.ts.map +1 -1
- package/build/loader/parsers/fontface.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/loader/parsers/tmx.d.ts.map +1 -1
- package/build/math/color.d.ts +4 -0
- package/build/math/color.d.ts.map +1 -1
- package/build/math/math.d.ts +6 -1
- package/build/math/math.d.ts.map +1 -1
- package/build/math/noise.d.ts +16 -16
- package/build/math/noise.d.ts.map +1 -1
- package/build/math/observableVector2d.d.ts +6 -6
- package/build/math/observableVector2d.d.ts.map +1 -1
- package/build/math/observableVector3d.d.ts +8 -8
- package/build/math/observableVector3d.d.ts.map +1 -1
- package/build/particles/emitter.d.ts +15 -3
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/particles/particle.d.ts +6 -0
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +22 -5
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +64 -25
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +23 -4
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts +25 -3
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/raycast.d.ts.map +1 -1
- package/build/physics/world.d.ts +40 -10
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/container.d.ts +41 -6
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/draggable.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts.map +1 -1
- package/build/renderable/instanced_mesh.d.ts +16 -14
- package/build/renderable/instanced_mesh.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +62 -5
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +4 -2
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +12 -3
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts +147 -4
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/renderable/text/textmetrics.d.ts +10 -2
- package/build/renderable/text/textmetrics.d.ts.map +1 -1
- package/build/renderable/text/textstyle.d.ts.map +1 -1
- package/build/renderable/trigger.d.ts +5 -0
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/renderable/ui/panelpaint.d.ts +5 -1
- package/build/renderable/ui/panelpaint.d.ts.map +1 -1
- package/build/renderable/ui/progressbar.d.ts +267 -95
- package/build/renderable/ui/progressbar.d.ts.map +1 -1
- package/build/renderable/ui/uibaseelement.d.ts +443 -50
- package/build/renderable/ui/uibaseelement.d.ts.map +1 -1
- package/build/renderable/ui/uicheckbox.d.ts +383 -0
- package/build/renderable/ui/uicheckbox.d.ts.map +1 -0
- package/build/renderable/ui/uifocus.d.ts +6 -0
- package/build/renderable/ui/uifocus.d.ts.map +1 -0
- package/build/renderable/ui/uilabel.d.ts +31 -0
- package/build/renderable/ui/uilabel.d.ts.map +1 -0
- package/build/renderable/ui/uipanel.d.ts +589 -116
- package/build/renderable/ui/uipanel.d.ts.map +1 -1
- package/build/renderable/ui/uiskin.d.ts +25 -0
- package/build/renderable/ui/uiskin.d.ts.map +1 -0
- package/build/renderable/ui/uislider.d.ts +518 -0
- package/build/renderable/ui/uislider.d.ts.map +1 -0
- package/build/renderable/ui/uispriteelement.d.ts +161 -85
- package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
- package/build/renderable/ui/uitextbutton.d.ts +369 -63
- package/build/renderable/ui/uitextbutton.d.ts.map +1 -1
- package/build/state/stage.d.ts.map +1 -1
- package/build/system/device.d.ts +11 -2
- package/build/system/device.d.ts.map +1 -1
- package/build/system/fullscreen.d.ts.map +1 -1
- package/build/system/pool.d.ts.map +1 -1
- package/build/system/save.d.ts +2 -1
- package/build/system/save.d.ts.map +1 -1
- package/build/tweens/tween.d.ts +5 -2
- package/build/tweens/tween.d.ts.map +1 -1
- package/build/utils/fetchdata.d.ts.map +1 -1
- package/build/utils/utils.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +16 -19
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/canvas_factory.d.ts.map +1 -1
- package/build/video/effects/shadereffect.d.ts +127 -0
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/renderer.d.ts +20 -4
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/renderstate.d.ts +26 -3
- package/build/video/renderstate.d.ts.map +1 -1
- package/build/video/utils/tessellation.d.ts +11 -0
- package/build/video/utils/tessellation.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts +3 -6
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgpu/webgpu_renderer.d.ts +3 -6
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/melonjs/SKILL.md +41 -17
- package/skills/melonjs-20-migration/SKILL.md +50 -7
- package/skills/melonjs-3d/SKILL.md +138 -38
- package/skills/melonjs-3d-assets/SKILL.md +83 -33
- package/skills/melonjs-audio/SKILL.md +62 -19
- package/skills/melonjs-camera-and-drawing/SKILL.md +135 -8
- package/skills/melonjs-deployment/SKILL.md +92 -14
- package/skills/melonjs-display-and-scaling/SKILL.md +8 -3
- package/skills/melonjs-effects-and-shaders/SKILL.md +47 -15
- package/skills/melonjs-events/SKILL.md +6 -3
- package/skills/melonjs-getting-started/SKILL.md +6 -2
- package/skills/melonjs-input/SKILL.md +102 -16
- package/skills/melonjs-lighting/SKILL.md +13 -1
- package/skills/melonjs-loading-assets/SKILL.md +255 -39
- package/skills/melonjs-math/SKILL.md +26 -8
- package/skills/melonjs-particles-and-trails/SKILL.md +77 -9
- package/skills/melonjs-performance/SKILL.md +18 -8
- package/skills/melonjs-physics/SKILL.md +435 -128
- package/skills/melonjs-plugins/SKILL.md +50 -11
- package/skills/melonjs-renderables/SKILL.md +31 -7
- package/skills/melonjs-renderer-backends/SKILL.md +38 -17
- package/skills/melonjs-scenes-and-state/SKILL.md +45 -5
- package/skills/melonjs-sprites-and-animation/SKILL.md +37 -2
- package/skills/melonjs-tilemaps/SKILL.md +149 -17
- package/skills/melonjs-ui-and-text/SKILL.md +674 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uipanel.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uipanel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"uipanel.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uipanel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI;IAsCrE;;;;;OAKG;IACM,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IASpC;;;OAGG;IACM,eAAe,IAAI,IAAI;IAUhC;;;OAGG;IACM,iBAAiB,IAAI,IAAI;IAQlC;;;;;;;;OAQG;IACM,OAAO,IAAI,OAAO;IAI3B;;;;;;;;;OASG;IACM,SAAS,IAAI,OAAO;IAI7B;;;;;;OAMG;IACM,MAAM,IAAI,OAAO;IAI1B;;;OAGG;IACM,cAAc;CAOvB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TextureAtlas } from "../../video/texture/atlas.js";
|
|
2
|
+
/**
|
|
3
|
+
* What every widget skin shares: the atlas its regions come from, and how
|
|
4
|
+
* much of each region's edge is kept unscaled when it is stretched.
|
|
5
|
+
*
|
|
6
|
+
* A region drawn bigger than its art is drawn as a nine-slice: the corners
|
|
7
|
+
* keep their size and the edges and middle stretch, so a 190 pixel wide
|
|
8
|
+
* button image makes a button of any width.
|
|
9
|
+
* @category UI
|
|
10
|
+
*/
|
|
11
|
+
export interface UISkin {
|
|
12
|
+
/** the atlas the regions are read from */
|
|
13
|
+
atlas: TextureAtlas;
|
|
14
|
+
/**
|
|
15
|
+
* the width of a corner kept unscaled, in pixels; a quarter of the
|
|
16
|
+
* region's width by default
|
|
17
|
+
*/
|
|
18
|
+
insetx?: number;
|
|
19
|
+
/**
|
|
20
|
+
* the height of a corner kept unscaled, in pixels; a quarter of the
|
|
21
|
+
* region's height by default
|
|
22
|
+
*/
|
|
23
|
+
insety?: number;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=uiskin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uiskin.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uiskin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAGjE;;;;;;;;GAQG;AACH,MAAM,WAAW,MAAM;IACtB,0CAA0C;IAC1C,KAAK,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
import type Camera2d from "../../camera/camera2d.ts";
|
|
2
|
+
import type Pointer from "../../input/pointer.ts";
|
|
3
|
+
import type Renderer from "../../video/renderer.js";
|
|
4
|
+
import type { Paint } from "./panelpaint.ts";
|
|
5
|
+
import type { UIJuiceSettings } from "./uibaseelement.ts";
|
|
6
|
+
import UIBaseElement from "./uibaseelement.ts";
|
|
7
|
+
import type { UINavAction } from "./uifocus.ts";
|
|
8
|
+
import type { UILabel } from "./uilabel.ts";
|
|
9
|
+
import type { UISkin } from "./uiskin.ts";
|
|
10
|
+
/**
|
|
11
|
+
* The art of a skinned {@link UISlider}: atlas regions for the track, the
|
|
12
|
+
* filled part of the track and the thumb.
|
|
13
|
+
*
|
|
14
|
+
* The track and the fill are stretched as nine-slices along the slider's
|
|
15
|
+
* {@link UISliderSettings#length}, and keep the region's thickness across
|
|
16
|
+
* it unless `trackThickness` is set. The thumb is drawn at its region's
|
|
17
|
+
* size. A disabled slider is drawn at half opacity. Every region named is
|
|
18
|
+
* looked up when the slider is built, so a misspelt name throws there.
|
|
19
|
+
* @category UI
|
|
20
|
+
* @example
|
|
21
|
+
* // a track and a thumb; no fill
|
|
22
|
+
* const skin = { atlas, track: "grey_sliderHorizontal", thumb: "blue_sliderDown" };
|
|
23
|
+
*/
|
|
24
|
+
export interface UISliderSkin extends UISkin {
|
|
25
|
+
/** the region for the whole track */
|
|
26
|
+
track: string;
|
|
27
|
+
/**
|
|
28
|
+
* the region for the part of the track from the low end to the thumb;
|
|
29
|
+
* not drawn if left out
|
|
30
|
+
*/
|
|
31
|
+
fill?: string;
|
|
32
|
+
/** the region for the thumb */
|
|
33
|
+
thumb: string;
|
|
34
|
+
/**
|
|
35
|
+
* the region for the thumb under the pointer or while dragged; `thumb`
|
|
36
|
+
* if left out
|
|
37
|
+
*/
|
|
38
|
+
thumbHover?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The settings {@link UISlider} takes. All are optional.
|
|
42
|
+
*
|
|
43
|
+
* The colour settings are for the drawn look and are ignored when a `skin`
|
|
44
|
+
* is given.
|
|
45
|
+
* @category UI
|
|
46
|
+
*/
|
|
47
|
+
export interface UISliderSettings extends UIJuiceSettings {
|
|
48
|
+
/**
|
|
49
|
+
* the lowest value; `min` and `max` are swapped if given the wrong way
|
|
50
|
+
* round
|
|
51
|
+
* @default 0
|
|
52
|
+
*/
|
|
53
|
+
min?: number;
|
|
54
|
+
/**
|
|
55
|
+
* the highest value
|
|
56
|
+
* @default 1
|
|
57
|
+
*/
|
|
58
|
+
max?: number;
|
|
59
|
+
/**
|
|
60
|
+
* the interval values snap to, counted from `min`; `0` for no snapping
|
|
61
|
+
* @default 0
|
|
62
|
+
*/
|
|
63
|
+
step?: number;
|
|
64
|
+
/**
|
|
65
|
+
* the starting value, snapped to `step` and clamped to the range; `min`
|
|
66
|
+
* by default
|
|
67
|
+
*/
|
|
68
|
+
value?: number;
|
|
69
|
+
/**
|
|
70
|
+
* which way it slides; a vertical slider has its highest value at the
|
|
71
|
+
* top. Fixed once built.
|
|
72
|
+
* @default "horizontal"
|
|
73
|
+
*/
|
|
74
|
+
orientation?: "horizontal" | "vertical";
|
|
75
|
+
/**
|
|
76
|
+
* the length of the track, in pixels: its width on a horizontal slider,
|
|
77
|
+
* its height on a vertical one
|
|
78
|
+
* @default 200
|
|
79
|
+
*/
|
|
80
|
+
length?: number;
|
|
81
|
+
/**
|
|
82
|
+
* the thickness of the track, in pixels; with a skin, the track region's
|
|
83
|
+
* thickness by default
|
|
84
|
+
* @default 6
|
|
85
|
+
*/
|
|
86
|
+
trackThickness?: number;
|
|
87
|
+
/**
|
|
88
|
+
* the diameter of the round thumb, in pixels (drawn look; a skin's thumb
|
|
89
|
+
* keeps its region's size)
|
|
90
|
+
* @default 20
|
|
91
|
+
*/
|
|
92
|
+
thumbSize?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Called with the new value on every change the user makes, while
|
|
95
|
+
* dragging too. Never called when `value` is set from code. See
|
|
96
|
+
* {@link UISlider#onChange}.
|
|
97
|
+
*/
|
|
98
|
+
onChange?: (value: number, slider: UISlider) => void;
|
|
99
|
+
/**
|
|
100
|
+
* Called with the final value once the user lets go, and after each
|
|
101
|
+
* wheel or key step. Never called when `value` is set from code. See
|
|
102
|
+
* {@link UISlider#onChangeEnd}.
|
|
103
|
+
*/
|
|
104
|
+
onChangeEnd?: (value: number, slider: UISlider) => void;
|
|
105
|
+
/**
|
|
106
|
+
* whether it answers input; a disabled slider is drawn at half opacity
|
|
107
|
+
* @default true
|
|
108
|
+
*/
|
|
109
|
+
enabled?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* a caption drawn above the track: at the left on a horizontal slider,
|
|
112
|
+
* centred on a vertical one
|
|
113
|
+
*/
|
|
114
|
+
label?: string;
|
|
115
|
+
/**
|
|
116
|
+
* show the value as text: at the right end of the caption row on a
|
|
117
|
+
* horizontal slider, below the track on a vertical one
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
showValue?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* How the value text is written, given the value and the ratio (where
|
|
123
|
+
* the value is between `min` and `max`, 0 to 1). By default, the value
|
|
124
|
+
* with as many decimals as `step` has, or 2 decimals with no step.
|
|
125
|
+
* @example
|
|
126
|
+
* valueFormat: (value, ratio) => `${Math.round(ratio * 100)}%`
|
|
127
|
+
*/
|
|
128
|
+
valueFormat?: (value: number, ratio: number) => string;
|
|
129
|
+
/**
|
|
130
|
+
* a CSS font family, or the name of a loaded bitmap font
|
|
131
|
+
* @default "sans-serif"
|
|
132
|
+
*/
|
|
133
|
+
font?: string;
|
|
134
|
+
/**
|
|
135
|
+
* the text height of the caption and the value, in pixels
|
|
136
|
+
* @default 16
|
|
137
|
+
*/
|
|
138
|
+
fontSize?: number;
|
|
139
|
+
/**
|
|
140
|
+
* the colour of the caption and the value
|
|
141
|
+
* @default "#000000"
|
|
142
|
+
*/
|
|
143
|
+
labelFillStyle?: string;
|
|
144
|
+
/**
|
|
145
|
+
* the track (drawn look)
|
|
146
|
+
* @default "#00000033"
|
|
147
|
+
*/
|
|
148
|
+
trackColor?: Paint;
|
|
149
|
+
/**
|
|
150
|
+
* the part of the track from the low end to the thumb (drawn look)
|
|
151
|
+
* @default "#2a7de1"
|
|
152
|
+
*/
|
|
153
|
+
fillColor?: Paint;
|
|
154
|
+
/**
|
|
155
|
+
* the thumb (drawn look)
|
|
156
|
+
* @default "#ffffff"
|
|
157
|
+
*/
|
|
158
|
+
thumbColor?: Paint;
|
|
159
|
+
/**
|
|
160
|
+
* the thumb under the pointer or while dragged (drawn look)
|
|
161
|
+
* @default "#e4eefb"
|
|
162
|
+
*/
|
|
163
|
+
thumbHoverColor?: Paint;
|
|
164
|
+
/**
|
|
165
|
+
* the thumb's outline (drawn look)
|
|
166
|
+
* @default "#2a7de1"
|
|
167
|
+
*/
|
|
168
|
+
thumbBorderColor?: Paint;
|
|
169
|
+
/**
|
|
170
|
+
* the thickness of the thumb's outline, in pixels (drawn look); `0` for
|
|
171
|
+
* none
|
|
172
|
+
* @default 2
|
|
173
|
+
*/
|
|
174
|
+
thumbBorderWidth?: number;
|
|
175
|
+
/** draw it from atlas regions instead of the drawn look */
|
|
176
|
+
skin?: UISliderSkin;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* A slider: the player picks a number by moving a thumb along a track. Use
|
|
180
|
+
* it for settings with a range, such as volume, mouse sensitivity or
|
|
181
|
+
* brightness.
|
|
182
|
+
*
|
|
183
|
+
* ## Range and value
|
|
184
|
+
* The value is {@link UISlider#value}, between {@link UISlider#min} and
|
|
185
|
+
* {@link UISlider#max} (0 and 1 by default). With a {@link UISlider#step}
|
|
186
|
+
* it snaps to that interval; `step: 1` gives whole numbers. `min`, `max`
|
|
187
|
+
* and `step` can be changed later: the value is clamped and snapped again,
|
|
188
|
+
* silently. {@link UISlider#ratio} is where the value is in the range, from
|
|
189
|
+
* 0 to 1.
|
|
190
|
+
*
|
|
191
|
+
* ## Input
|
|
192
|
+
* - Drag the thumb. The drag keeps following the pointer when it leaves
|
|
193
|
+
* the slider, until the button or finger is released.
|
|
194
|
+
* - Click or tap the track: the thumb jumps there, and can be dragged on.
|
|
195
|
+
* - The mouse wheel over the slider moves it one step (a hundredth of the
|
|
196
|
+
* range with no `step`).
|
|
197
|
+
* - With the focus ({@link UIBaseElement#focus}), the arrow keys or the
|
|
198
|
+
* D-pad step it: left and right on a horizontal slider, up and down on a
|
|
199
|
+
* vertical one. A step is `step`, or a twentieth of the range without
|
|
200
|
+
* one.
|
|
201
|
+
*
|
|
202
|
+
* ## onChange and onChangeEnd
|
|
203
|
+
* `onChange` is called on every change the user makes, many times during a
|
|
204
|
+
* drag: use it for live feedback, such as setting the volume. `onChangeEnd`
|
|
205
|
+
* is called once when the user lets go, and after each wheel or key step:
|
|
206
|
+
* use it for work that should not run on every frame of a drag, such as
|
|
207
|
+
* saving settings or playing a test sound. Neither is called when `value`
|
|
208
|
+
* is set from code, so restoring saved settings does not trigger them.
|
|
209
|
+
*
|
|
210
|
+
* ## Text
|
|
211
|
+
* `label` is a caption drawn above the track. `showValue` adds the value as
|
|
212
|
+
* text, written by `valueFormat(value, ratio)`. The default format shows
|
|
213
|
+
* as many decimals as `step` has: `step: 1` shows "7", `step: 0.1` shows
|
|
214
|
+
* "0.7", and no step shows "0.70". On a horizontal slider the caption and
|
|
215
|
+
* the value share the row above the track, and the value moves below the
|
|
216
|
+
* track when the two would run into each other. `labelText` changes the
|
|
217
|
+
* caption later; the slider resizes to fit its texts.
|
|
218
|
+
*
|
|
219
|
+
* ## Look
|
|
220
|
+
* Drawn with shapes by default: a rounded track, a filled part up to the
|
|
221
|
+
* thumb, and a round thumb, coloured by `trackColor`, `fillColor`,
|
|
222
|
+
* `thumbColor`, `thumbHoverColor` and `thumbBorderColor`. Or pass a
|
|
223
|
+
* {@link UISliderSkin} of atlas regions (`track`, `fill`, `thumb`,
|
|
224
|
+
* `thumbHover`).
|
|
225
|
+
*
|
|
226
|
+
* ## In a scrolling panel
|
|
227
|
+
* Inside a scrolling {@link UIPanel}, a drag that starts on the slider
|
|
228
|
+
* moves the slider, not the panel.
|
|
229
|
+
* @category UI
|
|
230
|
+
* @example
|
|
231
|
+
* // a volume slider wired to the audio, saved when the user lets go
|
|
232
|
+
* save.add({ volume: 1 });
|
|
233
|
+
* const volume = new UISlider(40, 80, {
|
|
234
|
+
* label: "Volume",
|
|
235
|
+
* value: save.volume,
|
|
236
|
+
* onChange: (v) => audio.setVolume(v),
|
|
237
|
+
* onChangeEnd: (v) => {
|
|
238
|
+
* save.volume = v;
|
|
239
|
+
* },
|
|
240
|
+
* });
|
|
241
|
+
* panel.addChild(volume);
|
|
242
|
+
* @example
|
|
243
|
+
* // a whole number from 1 to 10, shown as "1" ... "10"
|
|
244
|
+
* const sensitivity = new UISlider(40, 140, {
|
|
245
|
+
* label: "Sensitivity",
|
|
246
|
+
* min: 1,
|
|
247
|
+
* max: 10,
|
|
248
|
+
* step: 1,
|
|
249
|
+
* value: 5,
|
|
250
|
+
* showValue: true,
|
|
251
|
+
* });
|
|
252
|
+
* @example
|
|
253
|
+
* // vertical: highest value at the top
|
|
254
|
+
* const brightness = new UISlider(300, 40, {
|
|
255
|
+
* orientation: "vertical",
|
|
256
|
+
* length: 150,
|
|
257
|
+
* label: "Light",
|
|
258
|
+
* showValue: true,
|
|
259
|
+
* value: 0.8,
|
|
260
|
+
* });
|
|
261
|
+
* @example
|
|
262
|
+
* // skinned from an atlas
|
|
263
|
+
* const music = new UISlider(40, 200, {
|
|
264
|
+
* length: 320,
|
|
265
|
+
* skin: { atlas, track: "grey_sliderHorizontal", thumb: "blue_sliderDown" },
|
|
266
|
+
* });
|
|
267
|
+
* @example
|
|
268
|
+
* // the value shown as a percentage
|
|
269
|
+
* const sfx = new UISlider(40, 260, {
|
|
270
|
+
* label: "Effects",
|
|
271
|
+
* showValue: true,
|
|
272
|
+
* valueFormat: (value, ratio) => `${Math.round(ratio * 100)}%`,
|
|
273
|
+
* });
|
|
274
|
+
* @example
|
|
275
|
+
* // in a scrolling panel: dragging the thumb does not scroll the panel
|
|
276
|
+
* const options = new UIPanel(20, 20, {
|
|
277
|
+
* width: 360,
|
|
278
|
+
* height: 200,
|
|
279
|
+
* layout: "column",
|
|
280
|
+
* padding: 12,
|
|
281
|
+
* scroll: "vertical",
|
|
282
|
+
* });
|
|
283
|
+
* options.addChild(new UISlider(0, 0, { label: "Music", length: 300 }));
|
|
284
|
+
* options.addChild(new UISlider(0, 0, { label: "Effects", length: 300 }));
|
|
285
|
+
*/
|
|
286
|
+
export default class UISlider extends UIBaseElement {
|
|
287
|
+
/**
|
|
288
|
+
* Called with the new value on every change the user makes: each move
|
|
289
|
+
* of a drag, a click on the track, a wheel or key step. Use it for live
|
|
290
|
+
* feedback. Not called when {@link UISlider#value} is set from code, nor
|
|
291
|
+
* when a move leaves the value unchanged.
|
|
292
|
+
* @example
|
|
293
|
+
* volume.onChange = (v) => audio.setVolume(v);
|
|
294
|
+
*/
|
|
295
|
+
onChange: ((value: number, slider: UISlider) => void) | undefined;
|
|
296
|
+
/**
|
|
297
|
+
* Called with the final value once the user lets go after changing it,
|
|
298
|
+
* and after each wheel or key step. Use it for work that should not run
|
|
299
|
+
* on every move of a drag: saving settings, playing a test sound. Not
|
|
300
|
+
* called when {@link UISlider#value} is set from code, nor when a drag
|
|
301
|
+
* ends where it began.
|
|
302
|
+
* @example
|
|
303
|
+
* sfx.onChangeEnd = (v) => {
|
|
304
|
+
* save.sfxVolume = v;
|
|
305
|
+
* audio.play("coin", { volume: v });
|
|
306
|
+
* };
|
|
307
|
+
*/
|
|
308
|
+
onChangeEnd: ((value: number, slider: UISlider) => void) | undefined;
|
|
309
|
+
/** the track (drawn look) */
|
|
310
|
+
trackColor: Paint;
|
|
311
|
+
/** the part of the track from the low end to the thumb (drawn look) */
|
|
312
|
+
fillColor: Paint;
|
|
313
|
+
/** the thumb (drawn look) */
|
|
314
|
+
thumbColor: Paint;
|
|
315
|
+
/** the thumb under the pointer or while dragged (drawn look) */
|
|
316
|
+
thumbHoverColor: Paint;
|
|
317
|
+
/** the thumb's outline (drawn look) */
|
|
318
|
+
thumbBorderColor: Paint;
|
|
319
|
+
/** the thickness of the thumb's outline, in pixels (drawn look) */
|
|
320
|
+
thumbBorderWidth: number;
|
|
321
|
+
/** which way it slides; set when it is built */
|
|
322
|
+
readonly orientation: "horizontal" | "vertical";
|
|
323
|
+
/** the atlas regions it is drawn from, or `undefined` for the drawn look */
|
|
324
|
+
readonly skin: UISliderSkin | undefined;
|
|
325
|
+
/**
|
|
326
|
+
* the caption's text object, or `undefined` without one; change the
|
|
327
|
+
* text through {@link UISlider#labelText}
|
|
328
|
+
*/
|
|
329
|
+
readonly label: UILabel | undefined;
|
|
330
|
+
/**
|
|
331
|
+
* the value's text object, or `undefined` without `showValue`; kept up
|
|
332
|
+
* to date by the slider
|
|
333
|
+
*/
|
|
334
|
+
readonly valueText: UILabel | undefined;
|
|
335
|
+
/** @ignore */
|
|
336
|
+
private _valueFormat;
|
|
337
|
+
/** whether the format is the default one, which follows the step */
|
|
338
|
+
private _defaultFormat;
|
|
339
|
+
/** @ignore */
|
|
340
|
+
private _min;
|
|
341
|
+
/** @ignore */
|
|
342
|
+
private _max;
|
|
343
|
+
/** @ignore */
|
|
344
|
+
private _step;
|
|
345
|
+
/** @ignore */
|
|
346
|
+
private _value;
|
|
347
|
+
/** @ignore */
|
|
348
|
+
private readonly _painter;
|
|
349
|
+
/** @ignore */
|
|
350
|
+
private readonly _skin;
|
|
351
|
+
/** the track, in the slider's coordinates */
|
|
352
|
+
private readonly _track;
|
|
353
|
+
/** where the thumb's centre can go, along the slider */
|
|
354
|
+
private _travelStart;
|
|
355
|
+
private readonly _travelLength;
|
|
356
|
+
/** the length along the slider, the track's thickness, and the band the thumb slides in */
|
|
357
|
+
private readonly _length;
|
|
358
|
+
private readonly _thickness;
|
|
359
|
+
private readonly _band;
|
|
360
|
+
/** the caption's text */
|
|
361
|
+
private _labelText;
|
|
362
|
+
/** the style of the caption and the value text */
|
|
363
|
+
private readonly _textStyle;
|
|
364
|
+
/** the thumb's size across and along the slider */
|
|
365
|
+
private readonly _thumbW;
|
|
366
|
+
private readonly _thumbH;
|
|
367
|
+
/** where the value text and the caption go, in the slider's coordinates */
|
|
368
|
+
private readonly _valueAt;
|
|
369
|
+
private readonly _labelAt;
|
|
370
|
+
/** whether a drag is going on */
|
|
371
|
+
private _dragging;
|
|
372
|
+
/** the pointer's distance from the thumb's centre when it was grabbed */
|
|
373
|
+
private _grab;
|
|
374
|
+
/** the value when the drag began */
|
|
375
|
+
private _dragFrom;
|
|
376
|
+
/** the pointer the drag follows */
|
|
377
|
+
private _dragPointer;
|
|
378
|
+
private readonly _onDragMove;
|
|
379
|
+
private readonly _onDragEnd;
|
|
380
|
+
private readonly _onWheel;
|
|
381
|
+
/**
|
|
382
|
+
* @param x - left edge
|
|
383
|
+
* @param y - top edge
|
|
384
|
+
* @param settings - see {@link UISliderSettings}
|
|
385
|
+
*/
|
|
386
|
+
constructor(x: number, y: number, settings?: UISliderSettings);
|
|
387
|
+
/**
|
|
388
|
+
* The lowest value. Setting it clamps and snaps the value into the new
|
|
389
|
+
* range without calling `onChange`; a `min` above `max` raises `max` to
|
|
390
|
+
* it.
|
|
391
|
+
*/
|
|
392
|
+
get min(): number;
|
|
393
|
+
set min(v: number);
|
|
394
|
+
/**
|
|
395
|
+
* The highest value. Setting it clamps and snaps the value into the new
|
|
396
|
+
* range without calling `onChange`; a `max` below `min` lowers `min` to
|
|
397
|
+
* it.
|
|
398
|
+
* @example
|
|
399
|
+
* // unlock more levels: the value keeps its place
|
|
400
|
+
* levelSelect.max = unlockedLevels;
|
|
401
|
+
*/
|
|
402
|
+
get max(): number;
|
|
403
|
+
set max(v: number);
|
|
404
|
+
/**
|
|
405
|
+
* The interval values snap to, counted from `min`; `0` for none.
|
|
406
|
+
* Setting it snaps the value to it without calling `onChange`, and, with
|
|
407
|
+
* the default `valueFormat`, changes the decimals shown to match.
|
|
408
|
+
*/
|
|
409
|
+
get step(): number;
|
|
410
|
+
set step(v: number);
|
|
411
|
+
/**
|
|
412
|
+
* Where the value is between {@link UISlider#min} and
|
|
413
|
+
* {@link UISlider#max}, from 0 to 1 (0 when the range is empty).
|
|
414
|
+
* Read only.
|
|
415
|
+
* @example
|
|
416
|
+
* // a 50..150 slider at 125 has a ratio of 0.75
|
|
417
|
+
* const percent = Math.round(slider.ratio * 100);
|
|
418
|
+
*/
|
|
419
|
+
get ratio(): number;
|
|
420
|
+
/**
|
|
421
|
+
* How the value text is written, given the value and the ratio (0 to
|
|
422
|
+
* 1). Setting it rewrites the value text and lays the slider out again
|
|
423
|
+
* for the widest text it can now show.
|
|
424
|
+
* @example
|
|
425
|
+
* slider.valueFormat = (value) => `${value} px`;
|
|
426
|
+
*/
|
|
427
|
+
get valueFormat(): (value: number, ratio: number) => string;
|
|
428
|
+
set valueFormat(format: (value: number, ratio: number) => string);
|
|
429
|
+
/**
|
|
430
|
+
* The caption's text, or `""` without one. Setting it makes a caption if
|
|
431
|
+
* there was none, and lays the slider out again for its width; a
|
|
432
|
+
* {@link UIPanel} holding it needs `relayout()` if the slider's size
|
|
433
|
+
* changes.
|
|
434
|
+
* @example
|
|
435
|
+
* volume.labelText = muted ? "Music (muted)" : "Music";
|
|
436
|
+
*/
|
|
437
|
+
get labelText(): string;
|
|
438
|
+
set labelText(value: string);
|
|
439
|
+
/**
|
|
440
|
+
* build the caption's text object
|
|
441
|
+
* @param text - the caption
|
|
442
|
+
* @returns the label
|
|
443
|
+
* @ignore
|
|
444
|
+
*/
|
|
445
|
+
private makeCaption;
|
|
446
|
+
/**
|
|
447
|
+
* Measure the caption and the widest value text, and place them, the
|
|
448
|
+
* track and the thumb's travel; resize the slider to fit. A horizontal
|
|
449
|
+
* slider puts the caption and the value on one row above the track, or
|
|
450
|
+
* the value below the track when the two do not fit side by side.
|
|
451
|
+
* @ignore
|
|
452
|
+
*/
|
|
453
|
+
private layoutText;
|
|
454
|
+
/**
|
|
455
|
+
* The current value, between {@link UISlider#min} and
|
|
456
|
+
* {@link UISlider#max}.
|
|
457
|
+
*
|
|
458
|
+
* Setting it snaps it to the step and clamps it to the range, and does
|
|
459
|
+
* NOT call `onChange` or `onChangeEnd`: restoring saved settings does not
|
|
460
|
+
* run the code a user's change would. A value that is not a finite
|
|
461
|
+
* number is ignored.
|
|
462
|
+
* @example
|
|
463
|
+
* // show the saved volume when the menu opens
|
|
464
|
+
* volume.value = save.volume;
|
|
465
|
+
*/
|
|
466
|
+
get value(): number;
|
|
467
|
+
set value(v: number);
|
|
468
|
+
/**
|
|
469
|
+
* Step with the arrow keys or the D-pad while it has the focus: left and
|
|
470
|
+
* right on a horizontal slider, up and down on a vertical one. A step is
|
|
471
|
+
* `step`, or a twentieth of the range without one, and calls `onChange`
|
|
472
|
+
* and `onChangeEnd`. The other two directions move the focus away.
|
|
473
|
+
* @param action - the direction pressed
|
|
474
|
+
* @returns true for the directions along the slider
|
|
475
|
+
*/
|
|
476
|
+
onNavigate(action: UINavAction): boolean;
|
|
477
|
+
/**
|
|
478
|
+
* Call off a press, and a drag in progress, without calling
|
|
479
|
+
* `onChangeEnd` or `onRelease`: `onCancel` runs instead. The value stays
|
|
480
|
+
* where the drag left it. Setting `enabled` to `false` mid-drag, or
|
|
481
|
+
* removing the slider, calls it.
|
|
482
|
+
*/
|
|
483
|
+
cancelPress(): void;
|
|
484
|
+
/**
|
|
485
|
+
* Whether the thumb is being dragged right now.
|
|
486
|
+
*/
|
|
487
|
+
get dragging(): boolean;
|
|
488
|
+
/** where the thumb's centre is, along the slider, in its coordinates */
|
|
489
|
+
private thumbCenter;
|
|
490
|
+
/**
|
|
491
|
+
* The pointer leaving does not end a drag; letting go does.
|
|
492
|
+
* @ignore
|
|
493
|
+
*/
|
|
494
|
+
release(event: Pointer): boolean | void;
|
|
495
|
+
/**
|
|
496
|
+
* Listen to the wheel while in the scene.
|
|
497
|
+
* @ignore
|
|
498
|
+
*/
|
|
499
|
+
onActivateEvent(): void;
|
|
500
|
+
/**
|
|
501
|
+
* Stop listening; the base class calls off a drag in progress, through
|
|
502
|
+
* {@link UISlider#cancelPress}.
|
|
503
|
+
* @ignore
|
|
504
|
+
*/
|
|
505
|
+
onDeactivateEvent(): void;
|
|
506
|
+
/**
|
|
507
|
+
* Draw the track, the fill, the thumb, then the text.
|
|
508
|
+
* @param renderer - the renderer to draw with
|
|
509
|
+
* @param viewport - the camera being drawn through
|
|
510
|
+
*/
|
|
511
|
+
draw(renderer: Renderer, viewport?: Camera2d): void;
|
|
512
|
+
/**
|
|
513
|
+
* Hand back what it borrowed.
|
|
514
|
+
* @ignore
|
|
515
|
+
*/
|
|
516
|
+
onDestroyEvent(): void;
|
|
517
|
+
}
|
|
518
|
+
//# sourceMappingURL=uislider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uislider.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uislider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAKrD,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAGlD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,aAIN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,E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