melonjs 19.6.0 → 19.7.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 +5 -4
- package/build/application/application.d.ts +34 -2
- package/build/application/application.d.ts.map +1 -1
- package/build/application/settings.d.ts +37 -1
- package/build/application/settings.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +59 -7
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +335 -0
- package/build/camera/camera3d.d.ts.map +1 -0
- package/build/camera/frustum.d.ts +162 -0
- package/build/camera/frustum.d.ts.map +1 -0
- package/build/const.d.ts +30 -3
- package/build/const.d.ts.map +1 -1
- package/build/geometries/sphere.d.ts +105 -0
- package/build/geometries/sphere.d.ts.map +1 -0
- package/build/index.d.ts +6 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +27489 -24693
- package/build/index.js.map +4 -4
- package/build/input/keyboard.d.ts.map +1 -1
- package/build/input/pointerevent.d.ts.map +1 -1
- package/build/lang/deprecated.d.ts +18 -0
- package/build/lang/deprecated.d.ts.map +1 -1
- package/build/loader/loadingscreen.d.ts +8 -0
- package/build/loader/loadingscreen.d.ts.map +1 -1
- package/build/loader/parsers/mtl.d.ts.map +1 -1
- package/build/loader/parsers/obj.d.ts.map +1 -1
- package/build/math/color.d.ts +43 -5
- package/build/math/color.d.ts.map +1 -1
- package/build/math/math.d.ts +44 -0
- package/build/math/math.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 +14 -2
- package/build/math/observableVector3d.d.ts.map +1 -1
- package/build/math/vector2d.d.ts +16 -2
- package/build/math/vector2d.d.ts.map +1 -1
- package/build/math/vector3d.d.ts +16 -2
- package/build/math/vector3d.d.ts.map +1 -1
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +77 -0
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/broadphase/aabb3d.d.ts +115 -0
- package/build/physics/broadphase/aabb3d.d.ts.map +1 -0
- package/build/physics/broadphase/broadphase.d.ts +74 -0
- package/build/physics/broadphase/broadphase.d.ts.map +1 -0
- package/build/physics/broadphase/factory.d.ts +30 -0
- package/build/physics/broadphase/factory.d.ts.map +1 -0
- package/build/physics/broadphase/octree.d.ts +325 -0
- package/build/physics/broadphase/octree.d.ts.map +1 -0
- package/build/physics/broadphase/quadtree.d.ts +184 -0
- package/build/physics/broadphase/quadtree.d.ts.map +1 -0
- package/build/physics/builtin/body.d.ts +7 -3
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts +6 -1
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/raycast.d.ts.map +1 -1
- package/build/physics/world.d.ts +15 -4
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/container.d.ts +51 -5
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +85 -10
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +9 -4
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/state/stage.d.ts +8 -0
- package/build/state/stage.d.ts.map +1 -1
- package/build/state/state.d.ts.map +1 -1
- package/build/system/device.d.ts +196 -310
- package/build/system/device.d.ts.map +1 -1
- package/build/system/event.d.ts +49 -0
- package/build/system/event.d.ts.map +1 -1
- package/build/system/fullscreen.d.ts +16 -0
- package/build/system/fullscreen.d.ts.map +1 -0
- package/build/system/platform.d.ts +32 -4
- package/build/system/platform.d.ts.map +1 -1
- package/build/system/timer.d.ts.map +1 -1
- package/build/utils/function.d.ts +7 -1
- package/build/utils/function.d.ts.map +1 -1
- package/build/utils/types.d.ts +5 -0
- package/build/utils/types.d.ts.map +1 -1
- package/build/video/buffer/vertex.d.ts +19 -4
- package/build/video/buffer/vertex.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +4 -4
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/canvas_factory.d.ts +25 -0
- package/build/video/canvas_factory.d.ts.map +1 -0
- package/build/video/renderer.d.ts +89 -15
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/renderstate.d.ts +12 -0
- package/build/video/renderstate.d.ts.map +1 -1
- package/build/video/rendertarget/rendertarget.d.ts +3 -1
- package/build/video/rendertarget/rendertarget.d.ts.map +1 -1
- package/build/video/texture/cache.d.ts +5 -0
- package/build/video/texture/cache.d.ts.map +1 -1
- package/build/video/texture/resource.d.ts +22 -14
- package/build/video/texture/resource.d.ts.map +1 -1
- package/build/video/video.d.ts +3 -1
- package/build/video/video.d.ts.map +1 -1
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +9 -0
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +45 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts +2 -2
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts +2 -2
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/package.json +3 -2
- package/build/physics/builtin/quadtree.d.ts +0 -112
- package/build/physics/builtin/quadtree.d.ts.map +0 -1
package/build/system/device.d.ts
CHANGED
|
@@ -1,12 +1,157 @@
|
|
|
1
|
+
import * as device_platform from "./platform.ts";
|
|
1
2
|
/**
|
|
2
3
|
* used by [un]watchDeviceOrientation()
|
|
3
4
|
* @ignore
|
|
4
5
|
*/
|
|
5
|
-
export function onDeviceRotate(e:
|
|
6
|
+
export declare function onDeviceRotate(e: DeviceOrientationEvent): void;
|
|
7
|
+
/**
|
|
8
|
+
* the device platform type
|
|
9
|
+
*/
|
|
10
|
+
export declare const platform: typeof device_platform;
|
|
11
|
+
/**
|
|
12
|
+
* True if the browser supports Touch Events
|
|
13
|
+
*/
|
|
14
|
+
export declare const touchEvent: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* True if the browser supports Pointer Events
|
|
17
|
+
*/
|
|
18
|
+
export declare const pointerEvent = true;
|
|
19
|
+
/**
|
|
20
|
+
* Touch capabilities (support either Touch or Pointer events)
|
|
21
|
+
*/
|
|
22
|
+
export declare const touch: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* the maximum number of simultaneous touch contact points are supported by the current device.
|
|
25
|
+
* @example
|
|
26
|
+
* if (me.device.maxTouchPoints > 1) {
|
|
27
|
+
* // device supports multi-touch
|
|
28
|
+
* }
|
|
29
|
+
*/
|
|
30
|
+
export declare const maxTouchPoints: number;
|
|
31
|
+
/**
|
|
32
|
+
* W3C standard wheel events
|
|
33
|
+
*/
|
|
34
|
+
export declare const wheel: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Browser pointerlock api support
|
|
37
|
+
*/
|
|
38
|
+
export declare const hasPointerLockSupport: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Browser device orientation
|
|
41
|
+
*/
|
|
42
|
+
export declare const hasDeviceOrientation = true;
|
|
43
|
+
/**
|
|
44
|
+
* Supports the ScreenOrientation API
|
|
45
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/onchange
|
|
46
|
+
*/
|
|
47
|
+
export declare const screenOrientation: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Browser accelerometer capabilities
|
|
50
|
+
*/
|
|
51
|
+
export declare const hasAccelerometer = true;
|
|
52
|
+
export { hasFullscreenSupport, isFullscreen } from "./fullscreen.ts";
|
|
53
|
+
/**
|
|
54
|
+
* Device WebAudio Support
|
|
55
|
+
*/
|
|
56
|
+
export declare const hasWebAudio = true;
|
|
57
|
+
/**
|
|
58
|
+
* Device HTML5Audio Support
|
|
59
|
+
*/
|
|
60
|
+
export declare const hasHTML5Audio: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Returns true if the browser/device has audio capabilities.
|
|
63
|
+
*/
|
|
64
|
+
export declare const sound = true;
|
|
65
|
+
/**
|
|
66
|
+
* Device Video Support
|
|
67
|
+
*/
|
|
68
|
+
export declare const hasVideo: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Browser Local Storage capabilities <br>
|
|
71
|
+
* (this flag will be set to false if cookies are blocked)
|
|
72
|
+
*/
|
|
73
|
+
export declare const localStorage: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* equals to true if the device browser supports OffScreenCanvas.
|
|
76
|
+
*/
|
|
77
|
+
export declare const offscreenCanvas: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Browser Base64 decoding capability
|
|
80
|
+
*/
|
|
81
|
+
export declare const nativeBase64: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* a string representing the preferred language of the user, usually the language of the browser UI.
|
|
84
|
+
* (will default to "en" if the information is not available)
|
|
85
|
+
* @see http://www.w3schools.com/tags/ref_language_codes.asp
|
|
86
|
+
*/
|
|
87
|
+
export declare const language: string;
|
|
88
|
+
/**
|
|
89
|
+
* Ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device.
|
|
90
|
+
*/
|
|
91
|
+
export declare const devicePixelRatio: number;
|
|
92
|
+
/**
|
|
93
|
+
* equals to true if a mobile device.
|
|
94
|
+
* (Android | iPhone | iPad | iPod | any UA matching `Mobi`)
|
|
95
|
+
*/
|
|
96
|
+
export declare const isMobile: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* contains the g-force acceleration along the x-axis.
|
|
99
|
+
* @see device.watchAccelerometer
|
|
100
|
+
*/
|
|
101
|
+
export declare let accelerationX: number;
|
|
102
|
+
/**
|
|
103
|
+
* contains the g-force acceleration along the y-axis.
|
|
104
|
+
* @see device.watchAccelerometer
|
|
105
|
+
*/
|
|
106
|
+
export declare let accelerationY: number;
|
|
107
|
+
/**
|
|
108
|
+
* contains the g-force acceleration along the z-axis.
|
|
109
|
+
* @see device.watchAccelerometer
|
|
110
|
+
*/
|
|
111
|
+
export declare let accelerationZ: number;
|
|
112
|
+
/**
|
|
113
|
+
* Device orientation Gamma property. Gives angle on tilting a portrait held phone left or right
|
|
114
|
+
* @see device.watchDeviceOrientation
|
|
115
|
+
*/
|
|
116
|
+
export declare let gamma: number;
|
|
117
|
+
/**
|
|
118
|
+
* Device orientation Beta property. Gives angle on tilting a portrait held phone forward or backward
|
|
119
|
+
* @see device.watchDeviceOrientation
|
|
120
|
+
*/
|
|
121
|
+
export declare let beta: number;
|
|
122
|
+
/**
|
|
123
|
+
* Device orientation Alpha property. Gives angle based on the rotation of the phone around its z axis.
|
|
124
|
+
* The z-axis is perpendicular to the phone, facing out from the center of the screen.
|
|
125
|
+
* @see device.watchDeviceOrientation
|
|
126
|
+
*/
|
|
127
|
+
export declare let alpha: number;
|
|
128
|
+
/**
|
|
129
|
+
* Specify whether to automatically bring the window to the front.
|
|
130
|
+
*
|
|
131
|
+
* Read this binding to inspect the current value; the write surface
|
|
132
|
+
* is {@link setAutoFocus} — direct assignment via the ESM namespace
|
|
133
|
+
* (`me.device.autoFocus = false`) always threw a `TypeError`, since
|
|
134
|
+
* namespace imports are read-only externally regardless of `let` /
|
|
135
|
+
* `const`. The setter is the only way to mutate the flag from
|
|
136
|
+
* user code.
|
|
137
|
+
* @default true
|
|
138
|
+
*/
|
|
139
|
+
export declare let autoFocus: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Update the {@link autoFocus} flag.
|
|
142
|
+
* Mirrors the `enableSwipe` / similar function-setter shape used
|
|
143
|
+
* elsewhere in this module — the engine's "bring the window to
|
|
144
|
+
* the front on visibility restore" behaviour can be toggled via
|
|
145
|
+
* `me.device.setAutoFocus(false)`.
|
|
146
|
+
* @param enable - `true` to keep the default focus-on-restore behaviour, `false` to opt out
|
|
147
|
+
* @example
|
|
148
|
+
* // disable the auto-focus-on-restore behaviour
|
|
149
|
+
* me.device.setAutoFocus(false);
|
|
150
|
+
*/
|
|
151
|
+
export declare function setAutoFocus(enable: boolean): void;
|
|
6
152
|
/**
|
|
7
153
|
* specify a function to execute when the Device is fully loaded and ready
|
|
8
|
-
* @
|
|
9
|
-
* @param {Function} fn - the function to be executed
|
|
154
|
+
* @param fn - the function to be executed
|
|
10
155
|
* @example
|
|
11
156
|
* // small game skeleton
|
|
12
157
|
* let game = {
|
|
@@ -48,165 +193,124 @@ export function onDeviceRotate(e: any): void;
|
|
|
48
193
|
* @deprecated since 18.3.0 — no longer needed when using {@link Application} as entry point.
|
|
49
194
|
* @category Application
|
|
50
195
|
*/
|
|
51
|
-
export function onReady(fn:
|
|
196
|
+
export declare function onReady(fn: () => void): void;
|
|
52
197
|
/**
|
|
53
198
|
* Register blur/focus and visibility change event handlers.
|
|
54
199
|
* Called once during boot to emit BLUR/FOCUS events when the
|
|
55
200
|
* window or tab gains/loses focus.
|
|
56
|
-
* @memberof device
|
|
57
201
|
* @ignore
|
|
58
202
|
*/
|
|
59
|
-
export function initVisibilityEvents(): void;
|
|
203
|
+
export declare function initVisibilityEvents(): void;
|
|
60
204
|
/**
|
|
61
205
|
* enable/disable swipe on WebView.
|
|
62
|
-
* @
|
|
63
|
-
* @param {boolean} [enable=true] - enable or disable swipe.
|
|
64
|
-
* @category Application
|
|
65
|
-
*/
|
|
66
|
-
export function enableSwipe(enable?: boolean): void;
|
|
67
|
-
/**
|
|
68
|
-
* Returns true if the browser/device is in full screen mode.
|
|
69
|
-
* @memberof device
|
|
70
|
-
* @returns {boolean}
|
|
206
|
+
* @param [enable=true] - enable or disable swipe.
|
|
71
207
|
* @category Application
|
|
72
208
|
*/
|
|
73
|
-
export function
|
|
74
|
-
|
|
75
|
-
* Triggers a fullscreen request. Requires fullscreen support from the browser/device.
|
|
76
|
-
* @memberof device
|
|
77
|
-
* @param {Element} [element] - the element to be set in full-screen mode.
|
|
78
|
-
* @example
|
|
79
|
-
* // add a keyboard shortcut to toggle Fullscreen mode on/off
|
|
80
|
-
* me.input.bindKey(me.input.KEY.F, "toggleFullscreen");
|
|
81
|
-
* me.event.on(me.event.KEYDOWN, function (action, keyCode, edge) {
|
|
82
|
-
* // toggle fullscreen on/off
|
|
83
|
-
* if (action === "toggleFullscreen") {
|
|
84
|
-
* me.device.requestFullscreen();
|
|
85
|
-
* } else {
|
|
86
|
-
* me.device.exitFullscreen();
|
|
87
|
-
* }
|
|
88
|
-
* });
|
|
89
|
-
* @category Application
|
|
90
|
-
*/
|
|
91
|
-
export function requestFullscreen(element?: Element): void;
|
|
209
|
+
export declare function enableSwipe(enable?: boolean): void;
|
|
210
|
+
export { exitFullscreen, requestFullscreen } from "../lang/deprecated.js";
|
|
92
211
|
/**
|
|
93
212
|
* Return a string representing the orientation of the device screen.
|
|
94
213
|
* It can be "any", "natural", "landscape", "portrait", "portrait-primary", "portrait-secondary", "landscape-primary", "landscape-secondary"
|
|
95
|
-
* @memberof device
|
|
96
214
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation
|
|
97
|
-
* @returns
|
|
215
|
+
* @returns the screen orientation
|
|
98
216
|
* @category Application
|
|
99
217
|
*/
|
|
100
|
-
export function getScreenOrientation(): string;
|
|
218
|
+
export declare function getScreenOrientation(): string;
|
|
101
219
|
/**
|
|
102
220
|
* locks the device screen into the specified orientation.<br>
|
|
103
221
|
* This method only works for installed Web apps or for Web pages in full-screen mode.
|
|
104
|
-
* @memberof device
|
|
105
222
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
|
|
106
|
-
* @param
|
|
107
|
-
* @returns
|
|
223
|
+
* @param orientation - The orientation into which to lock the screen.
|
|
224
|
+
* @returns true if the orientation was unsuccessfully locked
|
|
108
225
|
* @category Application
|
|
109
226
|
*/
|
|
110
|
-
export function lockOrientation(orientation: string | string[]): boolean;
|
|
227
|
+
export declare function lockOrientation(orientation: string | string[]): boolean;
|
|
111
228
|
/**
|
|
112
229
|
* unlocks the device screen into the specified orientation.<br>
|
|
113
230
|
* This method only works for installed Web apps or for Web pages in full-screen mode.
|
|
114
|
-
* @memberof device
|
|
115
231
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
|
|
116
|
-
* @returns
|
|
232
|
+
* @returns true if the orientation was unsuccessfully unlocked
|
|
117
233
|
* @category Application
|
|
118
234
|
*/
|
|
119
|
-
export function unlockOrientation(): boolean;
|
|
235
|
+
export declare function unlockOrientation(): boolean;
|
|
120
236
|
/**
|
|
121
237
|
* return true if the device screen orientation is in Portrait mode
|
|
122
|
-
* @memberof device
|
|
123
|
-
* @returns {boolean}
|
|
124
238
|
* @category Application
|
|
125
239
|
*/
|
|
126
|
-
export function isPortrait(): boolean;
|
|
240
|
+
export declare function isPortrait(): boolean;
|
|
127
241
|
/**
|
|
128
242
|
* return true if the device screen orientation is in Portrait mode
|
|
129
|
-
* @memberof device
|
|
130
|
-
* @returns {boolean}
|
|
131
243
|
* @category Application
|
|
132
244
|
*/
|
|
133
|
-
export function isLandscape(): boolean;
|
|
245
|
+
export declare function isLandscape(): boolean;
|
|
134
246
|
/**
|
|
135
247
|
* return the device storage
|
|
136
|
-
* @memberof device
|
|
137
248
|
* @see save
|
|
138
|
-
* @param
|
|
139
|
-
* @returns
|
|
249
|
+
* @param [type="local"] - storage type (currently only `"local"` is supported)
|
|
250
|
+
* @returns a reference to the device storage
|
|
140
251
|
* @category Application
|
|
141
252
|
*/
|
|
142
|
-
export function getStorage(type?: string):
|
|
253
|
+
export declare function getStorage(type?: string): Record<string, unknown>;
|
|
143
254
|
/**
|
|
144
255
|
* return the parent DOM element for the given parent name or HTMLElement object
|
|
145
|
-
* @
|
|
146
|
-
* @
|
|
147
|
-
* @returns {HTMLElement} the parent Element
|
|
256
|
+
* @param element - the parent element name or a HTMLElement object
|
|
257
|
+
* @returns the parent Element
|
|
148
258
|
* @category Application
|
|
149
259
|
*/
|
|
150
|
-
export function getParentElement(element: string | HTMLElement): HTMLElement;
|
|
260
|
+
export declare function getParentElement(element: string | HTMLElement): HTMLElement;
|
|
151
261
|
/**
|
|
152
262
|
* return the DOM element for the given element name or HTMLElement object
|
|
153
|
-
* @
|
|
154
|
-
* @
|
|
155
|
-
* @returns {HTMLElement} the corresponding DOM Element or null if not existing
|
|
263
|
+
* @param element - the parent element name or a HTMLElement object
|
|
264
|
+
* @returns the corresponding DOM Element (falls back to `document.body` when the lookup fails or the input isn't an HTMLElement)
|
|
156
265
|
* @category Application
|
|
157
266
|
*/
|
|
158
|
-
export function getElement(element: string | HTMLElement): HTMLElement;
|
|
267
|
+
export declare function getElement(element: string | HTMLElement): HTMLElement;
|
|
159
268
|
/**
|
|
160
269
|
* returns the size of the given HTMLElement and its position relative to the viewport
|
|
161
270
|
* <br><img src="images/element-box-diagram.png"/>
|
|
162
|
-
* @memberof device
|
|
163
271
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRect
|
|
164
|
-
* @param
|
|
165
|
-
* @returns
|
|
272
|
+
* @param element - an HTMLElement object
|
|
273
|
+
* @returns the size and position of the element relatively to the viewport
|
|
166
274
|
* @category Application
|
|
167
275
|
*/
|
|
168
|
-
export function getElementBounds(element: string | HTMLElement): DOMRect;
|
|
276
|
+
export declare function getElementBounds(element: string | HTMLElement): DOMRect;
|
|
169
277
|
/**
|
|
170
278
|
* returns the size of the given HTMLElement Parent and its position relative to the viewport
|
|
171
279
|
* <br><img src="images/element-box-diagram.png"/>
|
|
172
|
-
* @memberof device
|
|
173
280
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRect
|
|
174
|
-
* @param
|
|
175
|
-
* @returns
|
|
281
|
+
* @param element - an HTMLElement object
|
|
282
|
+
* @returns the size and position of the given element parent relative to the viewport
|
|
176
283
|
* @category Application
|
|
177
284
|
*/
|
|
178
|
-
export function getParentBounds(element: string | HTMLElement): DOMRect;
|
|
285
|
+
export declare function getParentBounds(element: string | HTMLElement): DOMRect;
|
|
179
286
|
/**
|
|
180
287
|
* returns true if the device supports WebGL
|
|
181
|
-
* @
|
|
182
|
-
* @param
|
|
183
|
-
* @
|
|
184
|
-
* @returns {boolean} true if WebGL is supported
|
|
288
|
+
* @param [options] - context creation options
|
|
289
|
+
* @param [options.failIfMajorPerformanceCaveat=true] - If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
|
|
290
|
+
* @returns true if WebGL is supported
|
|
185
291
|
* @category Application
|
|
186
292
|
*/
|
|
187
|
-
export function isWebGLSupported(options?: {
|
|
188
|
-
failIfMajorPerformanceCaveat?: boolean
|
|
293
|
+
export declare function isWebGLSupported(options?: {
|
|
294
|
+
failIfMajorPerformanceCaveat?: boolean;
|
|
189
295
|
}): boolean;
|
|
190
296
|
/**
|
|
191
297
|
* Makes a request to bring this device window to the front.
|
|
192
|
-
* @memberof device
|
|
193
298
|
* @example
|
|
194
299
|
* if (clicked) {
|
|
195
300
|
* me.device.focus();
|
|
196
301
|
* }
|
|
197
302
|
* @category Application
|
|
198
303
|
*/
|
|
199
|
-
export function focus(): void;
|
|
304
|
+
export declare function focus(): void;
|
|
200
305
|
/**
|
|
201
306
|
* Enable monitor of the device accelerator to detect the amount of physical force of acceleration the device is receiving.
|
|
202
307
|
* (one some device a first user gesture will be required before calling this function)
|
|
203
|
-
* @memberof device
|
|
204
308
|
* @see device.accelerationX
|
|
205
309
|
* @see device.accelerationY
|
|
206
310
|
* @see device.accelerationZ
|
|
207
|
-
* @
|
|
208
|
-
* @
|
|
209
|
-
* @returns
|
|
311
|
+
* @see http://www.mobilexweb.com/samples/ball.html
|
|
312
|
+
* @see http://www.mobilexweb.com/blog/safari-ios-accelerometer-websockets-html5
|
|
313
|
+
* @returns false if not supported or permission not granted by the user
|
|
210
314
|
* @example
|
|
211
315
|
* // try to enable device accelerometer event on user gesture
|
|
212
316
|
* me.input.registerPointerEvent("pointerleave", app.viewport, function() {
|
|
@@ -219,21 +323,19 @@ export function focus(): void;
|
|
|
219
323
|
* });
|
|
220
324
|
* @category Application
|
|
221
325
|
*/
|
|
222
|
-
export function watchAccelerometer(): boolean;
|
|
326
|
+
export declare function watchAccelerometer(): boolean;
|
|
223
327
|
/**
|
|
224
328
|
* unwatch Accelerometer event
|
|
225
|
-
* @memberof device
|
|
226
329
|
* @category Application
|
|
227
330
|
*/
|
|
228
|
-
export function unwatchAccelerometer(): void;
|
|
331
|
+
export declare function unwatchAccelerometer(): void;
|
|
229
332
|
/**
|
|
230
333
|
* Enable monitor of the device orientation to detect the current orientation of the device as compared to the Earth coordinate frame.
|
|
231
334
|
* (one some device a first user gesture will be required before calling this function)
|
|
232
|
-
* @memberof device
|
|
233
335
|
* @see device.alpha
|
|
234
336
|
* @see device.beta
|
|
235
337
|
* @see device.gamma
|
|
236
|
-
* @returns
|
|
338
|
+
* @returns false if not supported or permission not granted by the user
|
|
237
339
|
* @example
|
|
238
340
|
* // try to enable device orientation event on user gesture
|
|
239
341
|
* me.input.registerPointerEvent("pointerleave", app.viewport, function() {
|
|
@@ -246,20 +348,18 @@ export function unwatchAccelerometer(): void;
|
|
|
246
348
|
* });
|
|
247
349
|
* @category Application
|
|
248
350
|
*/
|
|
249
|
-
export function watchDeviceOrientation(): boolean;
|
|
351
|
+
export declare function watchDeviceOrientation(): boolean;
|
|
250
352
|
/**
|
|
251
353
|
* unwatch Device orientation event
|
|
252
|
-
* @memberof device
|
|
253
354
|
* @category Application
|
|
254
355
|
*/
|
|
255
|
-
export function unwatchDeviceOrientation(): void;
|
|
356
|
+
export declare function unwatchDeviceOrientation(): void;
|
|
256
357
|
/**
|
|
257
358
|
* the vibrate method pulses the vibration hardware on the device, <br>
|
|
258
359
|
* If the device doesn't support vibration, this method has no effect. <br>
|
|
259
360
|
* If a vibration pattern is already in progress when this method is called,
|
|
260
361
|
* the previous pattern is halted and the new one begins instead.
|
|
261
|
-
* @
|
|
262
|
-
* @param {number|number[]} pattern - pattern of vibration and pause intervals
|
|
362
|
+
* @param pattern - pattern of vibration and pause intervals
|
|
263
363
|
* @example
|
|
264
364
|
* // vibrate for 1000 ms
|
|
265
365
|
* me.device.vibrate(1000);
|
|
@@ -271,226 +371,12 @@ export function unwatchDeviceOrientation(): void;
|
|
|
271
371
|
* me.device.vibrate(0);
|
|
272
372
|
* @category Application
|
|
273
373
|
*/
|
|
274
|
-
export function vibrate(pattern: number | number[]): void;
|
|
374
|
+
export declare function vibrate(pattern: number | number[]): void;
|
|
275
375
|
/**
|
|
276
376
|
* detect if the given video format is supported
|
|
277
|
-
* @
|
|
278
|
-
* @
|
|
279
|
-
* @returns {boolean} return true if the given video format is supported
|
|
377
|
+
* @param codec - the video format to check for support
|
|
378
|
+
* @returns return true if the given video format is supported
|
|
280
379
|
* @category Application
|
|
281
380
|
*/
|
|
282
|
-
export function hasVideoFormat(codec: "h264" | "h265" | "ogg" | "mp4" | "m4v" | "webm" | "vp9" | "hls"): boolean;
|
|
283
|
-
/**
|
|
284
|
-
* the device platform type
|
|
285
|
-
* @memberof device
|
|
286
|
-
* @readonly
|
|
287
|
-
* @type {device.platform}
|
|
288
|
-
*/
|
|
289
|
-
export const platform: device.platform;
|
|
290
|
-
/**
|
|
291
|
-
* True if the browser supports Touch Events
|
|
292
|
-
* @memberof device
|
|
293
|
-
* @type {boolean}
|
|
294
|
-
* @readonly
|
|
295
|
-
*/
|
|
296
|
-
export const touchEvent: boolean;
|
|
297
|
-
/**
|
|
298
|
-
* True if the browser supports Pointer Events
|
|
299
|
-
* @memberof device
|
|
300
|
-
* @type {boolean}
|
|
301
|
-
* @readonly
|
|
302
|
-
*/
|
|
303
|
-
export const pointerEvent: boolean;
|
|
304
|
-
/**
|
|
305
|
-
* Touch capabilities (support either Touch or Pointer events)
|
|
306
|
-
* @memberof device
|
|
307
|
-
* @type {boolean}
|
|
308
|
-
* @readonly
|
|
309
|
-
*/
|
|
310
|
-
export const touch: boolean;
|
|
311
|
-
/**
|
|
312
|
-
* the maximum number of simultaneous touch contact points are supported by the current device.
|
|
313
|
-
* @memberof device
|
|
314
|
-
* @type {number}
|
|
315
|
-
* @readonly
|
|
316
|
-
* @example
|
|
317
|
-
* if (me.device.maxTouchPoints > 1) {
|
|
318
|
-
* // device supports multi-touch
|
|
319
|
-
* }
|
|
320
|
-
*/
|
|
321
|
-
export const maxTouchPoints: number;
|
|
322
|
-
/**
|
|
323
|
-
* W3C standard wheel events
|
|
324
|
-
* @memberof device
|
|
325
|
-
* @type {boolean}
|
|
326
|
-
* @readonly
|
|
327
|
-
*/
|
|
328
|
-
export const wheel: boolean;
|
|
329
|
-
/**
|
|
330
|
-
* Browser pointerlock api support
|
|
331
|
-
* @memberof device
|
|
332
|
-
* @type {boolean}
|
|
333
|
-
* @readonly
|
|
334
|
-
*/
|
|
335
|
-
export const hasPointerLockSupport: boolean;
|
|
336
|
-
/**
|
|
337
|
-
* Browser device orientation
|
|
338
|
-
* @memberof device
|
|
339
|
-
* @readonly
|
|
340
|
-
* @type {boolean}
|
|
341
|
-
*/
|
|
342
|
-
export const hasDeviceOrientation: boolean;
|
|
343
|
-
/**
|
|
344
|
-
* Supports the ScreenOrientation API
|
|
345
|
-
* @memberof device
|
|
346
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/onchange
|
|
347
|
-
* @type {boolean}
|
|
348
|
-
* @readonly
|
|
349
|
-
*/
|
|
350
|
-
export const screenOrientation: boolean;
|
|
351
|
-
/**
|
|
352
|
-
* Browser accelerometer capabilities
|
|
353
|
-
* @memberof device
|
|
354
|
-
* @readonly
|
|
355
|
-
* @type {boolean}
|
|
356
|
-
*/
|
|
357
|
-
export const hasAccelerometer: boolean;
|
|
358
|
-
/**
|
|
359
|
-
* Browser full screen support
|
|
360
|
-
* @memberof device
|
|
361
|
-
* @type {boolean}
|
|
362
|
-
* @readonly
|
|
363
|
-
*/
|
|
364
|
-
export const hasFullscreenSupport: boolean;
|
|
365
|
-
/**
|
|
366
|
-
* Device WebAudio Support
|
|
367
|
-
* @memberof device
|
|
368
|
-
* @type {boolean}
|
|
369
|
-
* @readonly
|
|
370
|
-
*/
|
|
371
|
-
export const hasWebAudio: boolean;
|
|
372
|
-
/**
|
|
373
|
-
* Device HTML5Audio Support
|
|
374
|
-
* @memberof device
|
|
375
|
-
* @type {boolean}
|
|
376
|
-
* @readonly
|
|
377
|
-
*/
|
|
378
|
-
export const hasHTML5Audio: boolean;
|
|
379
|
-
/**
|
|
380
|
-
* Returns true if the browser/device has audio capabilities.
|
|
381
|
-
* @memberof device
|
|
382
|
-
* @type {boolean}
|
|
383
|
-
* @readonly
|
|
384
|
-
*/
|
|
385
|
-
export const sound: boolean;
|
|
386
|
-
/**
|
|
387
|
-
* Device Video Support
|
|
388
|
-
* @memberof device
|
|
389
|
-
* @type {boolean}
|
|
390
|
-
* @readonly
|
|
391
|
-
*/
|
|
392
|
-
export const hasVideo: boolean;
|
|
393
|
-
/**
|
|
394
|
-
* Browser Local Storage capabilities <br>
|
|
395
|
-
* (this flag will be set to false if cookies are blocked)
|
|
396
|
-
* @memberof device
|
|
397
|
-
* @readonly
|
|
398
|
-
* @type {boolean}
|
|
399
|
-
*/
|
|
400
|
-
export const localStorage: boolean;
|
|
401
|
-
/**
|
|
402
|
-
* equals to true if the device browser supports OffScreenCanvas.
|
|
403
|
-
* @memberof device
|
|
404
|
-
* @type {boolean}
|
|
405
|
-
* @readonly
|
|
406
|
-
*/
|
|
407
|
-
export const offscreenCanvas: boolean;
|
|
408
|
-
/**
|
|
409
|
-
* Browser Base64 decoding capability
|
|
410
|
-
* @memberof device
|
|
411
|
-
* @type {boolean}
|
|
412
|
-
* @readonly
|
|
413
|
-
*/
|
|
414
|
-
export const nativeBase64: boolean;
|
|
415
|
-
/**
|
|
416
|
-
* a string representing the preferred language of the user, usually the language of the browser UI.
|
|
417
|
-
* (will default to "en" if the information is not available)
|
|
418
|
-
* @memberof device
|
|
419
|
-
* @type {string}
|
|
420
|
-
* @readonly
|
|
421
|
-
* @see http://www.w3schools.com/tags/ref_language_codes.asp
|
|
422
|
-
*/
|
|
423
|
-
export const language: string;
|
|
424
|
-
/**
|
|
425
|
-
* Ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device.
|
|
426
|
-
* @memberof device
|
|
427
|
-
* @type {number}
|
|
428
|
-
* @readonly
|
|
429
|
-
*/
|
|
430
|
-
export const devicePixelRatio: number;
|
|
431
|
-
/**
|
|
432
|
-
* equals to true if a mobile device.
|
|
433
|
-
* (Android | iPhone | iPad | iPod | BlackBerry | Windows Phone | Kindle)
|
|
434
|
-
* @memberof device
|
|
435
|
-
* @type {boolean}
|
|
436
|
-
* @readonly
|
|
437
|
-
*/
|
|
438
|
-
export const isMobile: boolean;
|
|
439
|
-
/**
|
|
440
|
-
* contains the g-force acceleration along the x-axis.
|
|
441
|
-
* @memberof device
|
|
442
|
-
* @type {number}
|
|
443
|
-
* @readonly
|
|
444
|
-
* @see device.watchAccelerometer
|
|
445
|
-
*/
|
|
446
|
-
export let accelerationX: number;
|
|
447
|
-
/**
|
|
448
|
-
* contains the g-force acceleration along the y-axis.
|
|
449
|
-
* @memberof device
|
|
450
|
-
* @type {number}
|
|
451
|
-
* @readonly
|
|
452
|
-
* @see device.watchAccelerometer
|
|
453
|
-
*/
|
|
454
|
-
export let accelerationY: number;
|
|
455
|
-
/**
|
|
456
|
-
* contains the g-force acceleration along the z-axis.
|
|
457
|
-
* @memberof device
|
|
458
|
-
* @type {number}
|
|
459
|
-
* @readonly
|
|
460
|
-
* @see device.watchAccelerometer
|
|
461
|
-
*/
|
|
462
|
-
export let accelerationZ: number;
|
|
463
|
-
/**
|
|
464
|
-
* Device orientation Gamma property. Gives angle on tilting a portrait held phone left or right
|
|
465
|
-
* @memberof device
|
|
466
|
-
* @type {number}
|
|
467
|
-
* @readonly
|
|
468
|
-
* @see device.watchDeviceOrientation
|
|
469
|
-
*/
|
|
470
|
-
export let gamma: number;
|
|
471
|
-
/**
|
|
472
|
-
* Device orientation Beta property. Gives angle on tilting a portrait held phone forward or backward
|
|
473
|
-
* @memberof device
|
|
474
|
-
* @type {number}
|
|
475
|
-
* @readonly
|
|
476
|
-
* @see device.watchDeviceOrientation
|
|
477
|
-
*/
|
|
478
|
-
export let beta: number;
|
|
479
|
-
/**
|
|
480
|
-
* Device orientation Alpha property. Gives angle based on the rotation of the phone around its z axis.
|
|
481
|
-
* The z-axis is perpendicular to the phone, facing out from the center of the screen.
|
|
482
|
-
* @memberof device
|
|
483
|
-
* @type {number}
|
|
484
|
-
* @readonly
|
|
485
|
-
* @see device.watchDeviceOrientation
|
|
486
|
-
*/
|
|
487
|
-
export let alpha: number;
|
|
488
|
-
/**
|
|
489
|
-
* Specify whether to automatically bring the window to the front
|
|
490
|
-
* @memberof device
|
|
491
|
-
* @type {boolean}
|
|
492
|
-
* @default true
|
|
493
|
-
*/
|
|
494
|
-
export let autoFocus: boolean;
|
|
495
|
-
export function exitFullscreen(): void;
|
|
381
|
+
export declare function hasVideoFormat(codec: "h264" | "h265" | "ogg" | "mp4" | "m4v" | "webm" | "vp9" | "hls"): boolean;
|
|
496
382
|
//# sourceMappingURL=device.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/system/device.
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/system/device.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,eAAe,MAAM,eAAe,CAAC;AA+FjD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,sBAAsB,QAIvD;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,wBAAkB,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,UAAU,SAA+B,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,YAAY,OAA4B,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,KAAK,SACsD,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,QAIvB,CAAC;AAEL;;GAEG;AACH,eAAO,MA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