@kmamal/sdl 0.11.13 → 1.0.0-2
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/CHANGELOG.md +249 -0
- package/README.md +26 -2685
- package/binding.gyp +82 -65
- package/package.json +17 -11
- package/scripts/build-sdl.mjs +15 -7
- package/scripts/build.mjs +30 -15
- package/scripts/download-release.mjs +9 -6
- package/scripts/download-sdl.mjs +9 -6
- package/scripts/install.mjs +13 -5
- package/scripts/util/common.js +9 -1
- package/src/javascript/audio/audio-playback-stream.js +50 -0
- package/src/javascript/audio/audio-recording-stream.js +32 -0
- package/src/javascript/audio/{audio-instance.js → audio-stream.js} +35 -32
- package/src/javascript/audio/device.js +34 -6
- package/src/javascript/audio/format-helpers.js +26 -35
- package/src/javascript/audio/index.js +37 -26
- package/src/javascript/audio/prevent-exit.js +19 -9
- package/src/javascript/cleanup.js +19 -10
- package/src/javascript/enums.js +5 -0
- package/src/javascript/events/events-via-poll.js +25 -7
- package/src/javascript/events/index.js +274 -175
- package/src/javascript/gamepad/device.js +23 -0
- package/src/javascript/gamepad/gamepad-instance.js +209 -0
- package/src/javascript/gamepad/index.js +51 -0
- package/src/javascript/globals.js +8 -5
- package/src/javascript/helpers.js +34 -7
- package/src/javascript/index.js +5 -3
- package/src/javascript/joystick/device.js +5 -10
- package/src/javascript/joystick/index.js +7 -7
- package/src/javascript/joystick/joystick-instance.js +79 -42
- package/src/javascript/joystick/shared.js +88 -0
- package/src/javascript/keyboard/index.js +6 -4
- package/src/javascript/keyboard/key-mapping.js +70 -28
- package/src/javascript/mouse/index.js +21 -10
- package/src/javascript/sensor/devices.js +17 -0
- package/src/javascript/sensor/index.js +2 -16
- package/src/javascript/sensor/sensor-instance.js +20 -6
- package/src/javascript/touch/devices.js +17 -0
- package/src/javascript/touch/index.js +3 -7
- package/src/javascript/video/format-helpers.js +99 -0
- package/src/javascript/video/index.js +37 -5
- package/src/javascript/video/window.js +280 -134
- package/src/native/audio.cpp +182 -58
- package/src/native/audio.h +10 -5
- package/src/native/clipboard.cpp +22 -5
- package/src/native/cocoa-window.h +1 -0
- package/src/native/cocoa-window.mm +1 -1
- package/src/native/enums.cpp +91 -58
- package/src/native/events.cpp +437 -284
- package/src/native/events.h +18 -12
- package/src/native/gamepad.cpp +185 -0
- package/src/native/gamepad.h +27 -0
- package/src/native/global.cpp +173 -167
- package/src/native/global.h +0 -2
- package/src/native/joystick.cpp +287 -225
- package/src/native/joystick.h +7 -6
- package/src/native/keyboard.cpp +28 -8
- package/src/native/keyboard.h +4 -2
- package/src/native/module.cpp +14 -8
- package/src/native/mouse.cpp +54 -34
- package/src/native/mouse.h +0 -1
- package/src/native/power.cpp +10 -4
- package/src/native/power.h +1 -1
- package/src/native/sensor.cpp +52 -52
- package/src/native/sensor.h +1 -1
- package/src/native/touch.cpp +45 -24
- package/src/native/touch.h +1 -1
- package/src/native/video.cpp +115 -75
- package/src/native/video.h +5 -2
- package/src/native/window.cpp +406 -318
- package/src/native/window.h +3 -1
- package/src/types/helpers.d.ts +44 -19
- package/src/types/index.d.ts +343 -255
- package/scripts/util/fetch.js +0 -85
- package/src/javascript/audio/audio-playback-instance.js +0 -23
- package/src/javascript/audio/audio-recording-instance.js +0 -17
- package/src/javascript/controller/controller-instance.js +0 -160
- package/src/javascript/controller/device.js +0 -26
- package/src/javascript/controller/index.js +0 -33
- package/src/javascript/events/reconcile-audio-devices.js +0 -16
- package/src/javascript/events/reconcile-displays.js +0 -17
- package/src/javascript/events/reconcile-joystick-and-controller-devices.js +0 -40
- package/src/javascript/events/reconcile.js +0 -61
- package/src/javascript/video/display.js +0 -4
- package/src/native/controller.cpp +0 -192
- package/src/native/controller.h +0 -26
package/src/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events'
|
|
1
2
|
|
|
2
3
|
export namespace Events {
|
|
3
4
|
|
|
@@ -8,28 +9,37 @@ export namespace Events {
|
|
|
8
9
|
export namespace Display {
|
|
9
10
|
|
|
10
11
|
interface DisplayEvent extends BaseEvent {
|
|
11
|
-
readonly
|
|
12
|
+
readonly device: Sdl.Video.Display
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export interface Add extends DisplayEvent {
|
|
15
|
-
readonly type: '
|
|
16
|
-
readonly device: Sdl.Video.Display
|
|
16
|
+
readonly type: 'displayAdd'
|
|
17
17
|
}
|
|
18
18
|
export interface Remove extends DisplayEvent {
|
|
19
|
-
readonly type: '
|
|
20
|
-
readonly device: Sdl.Video.Display
|
|
19
|
+
readonly type: 'displayRemove'
|
|
21
20
|
}
|
|
22
21
|
export interface Orient extends DisplayEvent {
|
|
23
|
-
readonly type: '
|
|
24
|
-
readonly
|
|
25
|
-
readonly orientation: Sdl.Video.Orientation
|
|
22
|
+
readonly type: 'displayOrient'
|
|
23
|
+
readonly orientation: Sdl.Video.Orientation | null
|
|
26
24
|
}
|
|
27
25
|
export interface Move extends DisplayEvent {
|
|
28
|
-
readonly type: '
|
|
29
|
-
|
|
26
|
+
readonly type: 'displayMove'
|
|
27
|
+
}
|
|
28
|
+
export interface Scale extends DisplayEvent {
|
|
29
|
+
readonly type: 'displayScaleChange'
|
|
30
|
+
readonly scale: number | null
|
|
31
|
+
}
|
|
32
|
+
export interface Mode extends DisplayEvent {
|
|
33
|
+
readonly type: 'displayModeChange'
|
|
34
|
+
readonly format: Sdl.Video.Format | null
|
|
35
|
+
readonly frequency: number | null
|
|
36
|
+
readonly geometry: Sdl.Video.Display['geometry']
|
|
37
|
+
}
|
|
38
|
+
export interface Usable extends DisplayEvent {
|
|
39
|
+
readonly type: 'displayUsableChange'
|
|
30
40
|
}
|
|
31
41
|
|
|
32
|
-
export type Any = Add | Remove | Orient | Move
|
|
42
|
+
export type Any = Add | Remove | Orient | Move | Scale | Mode | Usable
|
|
33
43
|
|
|
34
44
|
}
|
|
35
45
|
|
|
@@ -40,18 +50,18 @@ export namespace Events {
|
|
|
40
50
|
interface KeyEvent extends WindowEvent {
|
|
41
51
|
readonly scancode: Sdl.Keyboard.Scancode
|
|
42
52
|
readonly key: Sdl.Keyboard.Key | null
|
|
43
|
-
readonly shift:
|
|
44
|
-
readonly ctrl:
|
|
45
|
-
readonly alt:
|
|
46
|
-
readonly super:
|
|
47
|
-
readonly altgr:
|
|
48
|
-
readonly capslock:
|
|
49
|
-
readonly numlock:
|
|
53
|
+
readonly shift: boolean
|
|
54
|
+
readonly ctrl: boolean
|
|
55
|
+
readonly alt: boolean
|
|
56
|
+
readonly super: boolean
|
|
57
|
+
readonly altgr: boolean
|
|
58
|
+
readonly capslock: boolean
|
|
59
|
+
readonly numlock: boolean
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
export interface KeyDown extends KeyEvent {
|
|
53
63
|
readonly type: 'keyDown'
|
|
54
|
-
readonly repeat:
|
|
64
|
+
readonly repeat: boolean
|
|
55
65
|
}
|
|
56
66
|
export interface KeyUp extends KeyEvent { readonly type: 'keyUp' }
|
|
57
67
|
|
|
@@ -64,9 +74,14 @@ export namespace Events {
|
|
|
64
74
|
readonly x: number
|
|
65
75
|
readonly y: number
|
|
66
76
|
readonly touch: boolean
|
|
77
|
+
readonly pen: boolean
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
export interface MouseMove extends MouseEvent {
|
|
80
|
+
export interface MouseMove extends MouseEvent {
|
|
81
|
+
readonly type: 'mouseMove'
|
|
82
|
+
readonly dx: number
|
|
83
|
+
readonly dy: number
|
|
84
|
+
}
|
|
70
85
|
|
|
71
86
|
interface MouseButtonEvent extends MouseEvent {
|
|
72
87
|
readonly button: number
|
|
@@ -82,12 +97,11 @@ export namespace Events {
|
|
|
82
97
|
readonly flipped: boolean
|
|
83
98
|
}
|
|
84
99
|
|
|
85
|
-
export interface MouseMove extends MouseEvent { readonly type: 'mouseMove' }
|
|
86
|
-
|
|
87
100
|
interface FingerEvent extends WindowEvent {
|
|
88
|
-
readonly device: Sdl.Touch.Device
|
|
89
|
-
readonly fingerId:
|
|
101
|
+
readonly device: Sdl.Touch.Device | null
|
|
102
|
+
readonly fingerId: bigint
|
|
90
103
|
readonly mouse: boolean
|
|
104
|
+
readonly pen: boolean
|
|
91
105
|
readonly x: number
|
|
92
106
|
readonly y: number
|
|
93
107
|
readonly pressure: number
|
|
@@ -95,6 +109,7 @@ export namespace Events {
|
|
|
95
109
|
|
|
96
110
|
export interface FingerDown extends FingerEvent { readonly type: 'fingerDown' }
|
|
97
111
|
export interface FingerUp extends FingerEvent { readonly type: 'fingerUp' }
|
|
112
|
+
export interface FingerCancel extends FingerEvent { readonly type: 'fingerCancel' }
|
|
98
113
|
|
|
99
114
|
export interface FingerMove extends FingerEvent {
|
|
100
115
|
readonly type: 'fingerMove'
|
|
@@ -122,7 +137,7 @@ export namespace Events {
|
|
|
122
137
|
}
|
|
123
138
|
export interface DisplayChange extends WindowEvent {
|
|
124
139
|
readonly type: 'displayChange'
|
|
125
|
-
readonly display: Sdl.Video.Display
|
|
140
|
+
readonly display: Sdl.Video.Display | null
|
|
126
141
|
}
|
|
127
142
|
export interface Focus extends WindowEvent { readonly type: 'focus' }
|
|
128
143
|
export interface Blur extends WindowEvent { readonly type: 'blur' }
|
|
@@ -156,6 +171,7 @@ export namespace Events {
|
|
|
156
171
|
| FingerDown
|
|
157
172
|
| FingerUp
|
|
158
173
|
| FingerMove
|
|
174
|
+
| FingerCancel
|
|
159
175
|
| Show
|
|
160
176
|
| Hide
|
|
161
177
|
| Expose
|
|
@@ -204,6 +220,8 @@ export namespace Events {
|
|
|
204
220
|
readonly ball: number
|
|
205
221
|
readonly x: number
|
|
206
222
|
readonly y: number
|
|
223
|
+
readonly dx: number
|
|
224
|
+
readonly dy: number
|
|
207
225
|
}
|
|
208
226
|
|
|
209
227
|
interface ButtonEvent extends JoystickEvent {
|
|
@@ -216,12 +234,12 @@ export namespace Events {
|
|
|
216
234
|
export interface HatMotion extends JoystickEvent {
|
|
217
235
|
readonly type: 'hatMotion'
|
|
218
236
|
readonly hat: number
|
|
219
|
-
readonly value: Sdl.Joystick.HatPosition
|
|
237
|
+
readonly value: Sdl.Joystick.HatPosition | null
|
|
220
238
|
}
|
|
221
239
|
|
|
222
240
|
export interface PowerUpdate extends JoystickEvent {
|
|
223
241
|
readonly type: 'powerUpdate'
|
|
224
|
-
readonly power: Sdl.Joystick.
|
|
242
|
+
readonly power: Sdl.Joystick.PowerInfo
|
|
225
243
|
}
|
|
226
244
|
|
|
227
245
|
export interface Close extends JoystickEvent { readonly type: 'close' }
|
|
@@ -252,36 +270,36 @@ export namespace Events {
|
|
|
252
270
|
|
|
253
271
|
}
|
|
254
272
|
|
|
255
|
-
export namespace
|
|
273
|
+
export namespace Gamepad {
|
|
256
274
|
|
|
257
|
-
interface
|
|
275
|
+
interface GamepadEvent extends BaseEvent {}
|
|
258
276
|
|
|
259
|
-
export interface AxisMotion extends
|
|
277
|
+
export interface AxisMotion extends GamepadEvent {
|
|
260
278
|
readonly type: 'axisMotion'
|
|
261
|
-
readonly axis: Sdl.
|
|
279
|
+
readonly axis: Sdl.Gamepad.Axis
|
|
262
280
|
readonly value: number
|
|
263
281
|
}
|
|
264
282
|
|
|
265
|
-
interface ButtonEvent extends
|
|
266
|
-
readonly button: Sdl.
|
|
283
|
+
interface ButtonEvent extends GamepadEvent {
|
|
284
|
+
readonly button: Sdl.Gamepad.Button
|
|
267
285
|
}
|
|
268
286
|
|
|
269
287
|
export interface ButtonDown extends ButtonEvent { readonly type: 'buttonDown' }
|
|
270
288
|
export interface ButtonUp extends ButtonEvent { readonly type: 'buttonUp' }
|
|
271
289
|
|
|
272
|
-
export interface PowerUpdate extends
|
|
290
|
+
export interface PowerUpdate extends GamepadEvent {
|
|
273
291
|
readonly type: 'powerUpdate'
|
|
274
|
-
readonly power: Sdl.Joystick.
|
|
292
|
+
readonly power: Sdl.Joystick.PowerInfo
|
|
275
293
|
}
|
|
276
294
|
|
|
277
|
-
export interface SteamHandleUpdate extends
|
|
295
|
+
export interface SteamHandleUpdate extends GamepadEvent {
|
|
278
296
|
readonly type: 'steamHandleUpdate'
|
|
279
297
|
readonly steamHandle: Buffer | null
|
|
280
298
|
}
|
|
281
299
|
|
|
282
|
-
export interface Remap extends
|
|
300
|
+
export interface Remap extends GamepadEvent { readonly type: 'remap' }
|
|
283
301
|
|
|
284
|
-
export interface Close extends
|
|
302
|
+
export interface Close extends GamepadEvent { readonly type: 'close' }
|
|
285
303
|
|
|
286
304
|
export type Any
|
|
287
305
|
= AxisMotion
|
|
@@ -310,10 +328,10 @@ export namespace Events {
|
|
|
310
328
|
|
|
311
329
|
}
|
|
312
330
|
|
|
313
|
-
export namespace
|
|
331
|
+
export namespace GamepadDevice {
|
|
314
332
|
|
|
315
333
|
interface DeviceEvent extends BaseEvent {
|
|
316
|
-
readonly device: Sdl.
|
|
334
|
+
readonly device: Sdl.Gamepad.Device
|
|
317
335
|
}
|
|
318
336
|
|
|
319
337
|
export interface Add extends DeviceEvent { readonly type: 'deviceAdd' }
|
|
@@ -377,22 +395,55 @@ export namespace Sdl {
|
|
|
377
395
|
readonly patch: number
|
|
378
396
|
}
|
|
379
397
|
}
|
|
380
|
-
readonly platform:
|
|
398
|
+
readonly platform:
|
|
399
|
+
| 'AIX'
|
|
400
|
+
| 'Android'
|
|
401
|
+
| 'Atari MiNT'
|
|
402
|
+
| 'BSDI'
|
|
403
|
+
| 'Emscripten'
|
|
404
|
+
| 'FreeBSD'
|
|
405
|
+
| 'GNU/Hurd'
|
|
406
|
+
| 'HP-UX'
|
|
407
|
+
| 'Haiku'
|
|
408
|
+
| 'Irix'
|
|
409
|
+
| 'Linux'
|
|
410
|
+
| 'Managarm'
|
|
411
|
+
| 'NetBSD'
|
|
412
|
+
| 'Nintendo 3DS'
|
|
413
|
+
| 'Nokia N-Gage'
|
|
414
|
+
| 'OS/2'
|
|
415
|
+
| 'OSF/1'
|
|
416
|
+
| 'OpenBSD'
|
|
417
|
+
| 'PlayStation 2'
|
|
418
|
+
| 'PlayStation Portable'
|
|
419
|
+
| 'PlayStation Vita'
|
|
420
|
+
| 'QNX Neutrino'
|
|
421
|
+
| 'RISC OS'
|
|
422
|
+
| 'Solaris'
|
|
423
|
+
| 'WinGDK'
|
|
424
|
+
| 'Windows'
|
|
425
|
+
| 'Xbox One'
|
|
426
|
+
| 'Xbox Series X|S'
|
|
427
|
+
| 'iOS'
|
|
428
|
+
| 'macOS'
|
|
429
|
+
| 'tvOS'
|
|
430
|
+
| 'visionOS'
|
|
431
|
+
| null
|
|
381
432
|
readonly drivers: {
|
|
382
433
|
readonly video: {
|
|
383
434
|
readonly all: string[]
|
|
384
|
-
readonly current: string
|
|
435
|
+
readonly current: string | null
|
|
385
436
|
}
|
|
386
437
|
readonly audio: {
|
|
387
438
|
readonly all: string[]
|
|
388
|
-
readonly current: string
|
|
439
|
+
readonly current: string | null
|
|
389
440
|
}
|
|
390
441
|
}
|
|
391
442
|
readonly initialized: {
|
|
392
443
|
readonly video: boolean
|
|
393
444
|
readonly audio: boolean
|
|
394
445
|
readonly joystick: boolean
|
|
395
|
-
readonly
|
|
446
|
+
readonly gamepad: boolean
|
|
396
447
|
readonly haptic: boolean
|
|
397
448
|
readonly sensor: boolean
|
|
398
449
|
}
|
|
@@ -408,9 +459,10 @@ export namespace Sdl {
|
|
|
408
459
|
|
|
409
460
|
export type Format
|
|
410
461
|
= 'rgb332'
|
|
411
|
-
| '
|
|
412
|
-
| '
|
|
413
|
-
| '
|
|
462
|
+
| 'xrgb4444'
|
|
463
|
+
| 'xbgr4444'
|
|
464
|
+
| 'xrgb1555'
|
|
465
|
+
| 'xbgr1555'
|
|
414
466
|
| 'argb4444'
|
|
415
467
|
| 'rgba4444'
|
|
416
468
|
| 'abgr4444'
|
|
@@ -423,19 +475,44 @@ export namespace Sdl {
|
|
|
423
475
|
| 'bgr565'
|
|
424
476
|
| 'rgb24'
|
|
425
477
|
| 'bgr24'
|
|
426
|
-
| '
|
|
478
|
+
| 'xrgb8888'
|
|
427
479
|
| 'rgbx8888'
|
|
428
|
-
| '
|
|
480
|
+
| 'xbgr8888'
|
|
429
481
|
| 'bgrx8888'
|
|
430
482
|
| 'argb8888'
|
|
431
483
|
| 'rgba8888'
|
|
432
484
|
| 'abgr8888'
|
|
433
485
|
| 'bgra8888'
|
|
434
486
|
| 'argb2101010'
|
|
487
|
+
| 'xrgb2101010'
|
|
488
|
+
| 'xbgr2101010'
|
|
489
|
+
| 'abgr2101010'
|
|
490
|
+
| 'rgb48'
|
|
491
|
+
| 'bgr48'
|
|
492
|
+
| 'rgba64'
|
|
493
|
+
| 'argb64'
|
|
494
|
+
| 'bgra64'
|
|
495
|
+
| 'abgr64'
|
|
496
|
+
| 'rgb48f'
|
|
497
|
+
| 'bgr48f'
|
|
498
|
+
| 'rgba64f'
|
|
499
|
+
| 'argb64f'
|
|
500
|
+
| 'bgra64f'
|
|
501
|
+
| 'abgr64f'
|
|
502
|
+
| 'rgb96f'
|
|
503
|
+
| 'bgr96f'
|
|
504
|
+
| 'rgba128f'
|
|
505
|
+
| 'argb128f'
|
|
506
|
+
| 'bgra128f'
|
|
507
|
+
| 'abgr128f'
|
|
435
508
|
| 'rgba32'
|
|
436
509
|
| 'argb32'
|
|
437
510
|
| 'bgra32'
|
|
438
511
|
| 'abgr32'
|
|
512
|
+
| 'rgbx32'
|
|
513
|
+
| 'xrgb32'
|
|
514
|
+
| 'bgrx32'
|
|
515
|
+
| 'xbgr32'
|
|
439
516
|
| 'yv12'
|
|
440
517
|
| 'iyuv'
|
|
441
518
|
| 'yuy2'
|
|
@@ -443,16 +520,17 @@ export namespace Sdl {
|
|
|
443
520
|
| 'yvyu'
|
|
444
521
|
| 'nv12'
|
|
445
522
|
| 'nv21'
|
|
523
|
+
| 'p010'
|
|
446
524
|
|
|
447
525
|
export type Scaling
|
|
448
526
|
= 'nearest'
|
|
449
527
|
| 'linear'
|
|
450
|
-
| 'best'
|
|
451
528
|
|
|
452
529
|
export interface Display {
|
|
530
|
+
readonly id: number
|
|
453
531
|
readonly name: string | null
|
|
454
|
-
readonly format: Format
|
|
455
|
-
readonly frequency: number
|
|
532
|
+
readonly format: Format | null
|
|
533
|
+
readonly frequency: number | null
|
|
456
534
|
readonly geometry: {
|
|
457
535
|
readonly x: number
|
|
458
536
|
readonly y: number
|
|
@@ -465,15 +543,11 @@ export namespace Sdl {
|
|
|
465
543
|
readonly width: number
|
|
466
544
|
readonly height: number
|
|
467
545
|
}
|
|
468
|
-
readonly
|
|
469
|
-
readonly horizontal: number
|
|
470
|
-
readonly vertical: number
|
|
471
|
-
readonly diagonal: number
|
|
472
|
-
} | null
|
|
546
|
+
readonly scale: number | null
|
|
473
547
|
readonly orientation: Orientation | null
|
|
474
548
|
}
|
|
475
549
|
|
|
476
|
-
export
|
|
550
|
+
export interface Window extends EventEmitter {
|
|
477
551
|
on (event: 'show', listener: (event: Events.Window.Show) => void): this
|
|
478
552
|
on (event: 'hide', listener: (event: Events.Window.Hide) => void): this
|
|
479
553
|
on (event: 'expose', listener: (event: Events.Window.Expose) => void): this
|
|
@@ -499,11 +573,13 @@ export namespace Sdl {
|
|
|
499
573
|
on (event: 'fingerDown', listener: (event: Events.Window.FingerDown) => void): this
|
|
500
574
|
on (event: 'fingerUp', listener: (event: Events.Window.FingerUp) => void): this
|
|
501
575
|
on (event: 'fingerMove', listener: (event: Events.Window.FingerMove) => void): this
|
|
576
|
+
on (event: 'fingerCancel', listener: (event: Events.Window.FingerCancel) => void): this
|
|
502
577
|
on (event: 'dropBegin', listener: (event: Events.Window.DropBegin) => void): this
|
|
503
578
|
on (event: 'dropText', listener: (event: Events.Window.DropText) => void): this
|
|
504
579
|
on (event: 'dropFile', listener: (event: Events.Window.DropFile) => void): this
|
|
505
580
|
on (event: 'dropComplete', listener: (event: Events.Window.DropComplete) => void): this
|
|
506
581
|
on (event: '*', listener: (type: string, event: Events.Window.Any) => void): this
|
|
582
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
507
583
|
|
|
508
584
|
readonly id: number
|
|
509
585
|
|
|
@@ -522,7 +598,7 @@ export namespace Sdl {
|
|
|
522
598
|
readonly pixelHeight: number
|
|
523
599
|
setSizeInPixels (pixelWidth: number, pixelHeight: number): void
|
|
524
600
|
|
|
525
|
-
readonly display: Display
|
|
601
|
+
readonly display: Display | null
|
|
526
602
|
|
|
527
603
|
readonly visible: boolean
|
|
528
604
|
show (show?: boolean): void
|
|
@@ -539,15 +615,18 @@ export namespace Sdl {
|
|
|
539
615
|
|
|
540
616
|
readonly alwaysOnTop: boolean
|
|
541
617
|
|
|
542
|
-
readonly accelerated: boolean
|
|
618
|
+
readonly accelerated: boolean | null
|
|
543
619
|
setAccelerated (accelerated: boolean): void
|
|
544
620
|
|
|
545
|
-
readonly vsync: boolean
|
|
621
|
+
readonly vsync: boolean | null
|
|
546
622
|
setVsync (vsync: boolean): void
|
|
547
623
|
|
|
548
624
|
readonly opengl: boolean
|
|
549
625
|
readonly webgpu: boolean
|
|
550
|
-
readonly native: {
|
|
626
|
+
readonly native: {
|
|
627
|
+
handle: Buffer | null,
|
|
628
|
+
subsystem: 'x11' | 'wayland' | null,
|
|
629
|
+
}
|
|
551
630
|
|
|
552
631
|
readonly maximized: boolean
|
|
553
632
|
maximize (): void
|
|
@@ -561,11 +640,11 @@ export namespace Sdl {
|
|
|
561
640
|
focus (): void
|
|
562
641
|
|
|
563
642
|
readonly hovered: boolean
|
|
643
|
+
readonly mouseCaptured: boolean
|
|
564
644
|
|
|
565
|
-
readonly
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
readonly utility: boolean
|
|
645
|
+
readonly relativeMouseMode: boolean
|
|
646
|
+
setRelativeMouseMode (relative?: boolean): void
|
|
647
|
+
unsetRelativeMouseMode (): void
|
|
569
648
|
|
|
570
649
|
render (width: number, height: number, stride: number, format: Format, buffer: Buffer, options?: {
|
|
571
650
|
scaling?: Scaling,
|
|
@@ -574,7 +653,7 @@ export namespace Sdl {
|
|
|
574
653
|
y: number,
|
|
575
654
|
width: number,
|
|
576
655
|
height: number,
|
|
577
|
-
}
|
|
656
|
+
} | null
|
|
578
657
|
}): void
|
|
579
658
|
|
|
580
659
|
setIcon (width: number, height: number, stride: number, format: Format, buffer: Buffer): void
|
|
@@ -587,26 +666,30 @@ export namespace Sdl {
|
|
|
587
666
|
destroyGently (): void
|
|
588
667
|
}
|
|
589
668
|
|
|
590
|
-
interface Module {
|
|
669
|
+
interface Module extends EventEmitter {
|
|
591
670
|
on (event: 'displayAdd', listener: (event: Events.Display.Add) => void): this
|
|
592
671
|
on (event: 'displayRemove', listener: (event: Events.Display.Remove) => void): this
|
|
593
672
|
on (event: 'displayOrient', listener: (event: Events.Display.Orient) => void): this
|
|
594
673
|
on (event: 'displayMove', listener: (event: Events.Display.Move) => void): this
|
|
674
|
+
on (event: 'displayScaleChange', listener: (event: Events.Display.Scale) => void): this
|
|
675
|
+
on (event: 'displayModeChange', listener: (event: Events.Display.Mode) => void): this
|
|
676
|
+
on (event: 'displayUsableChange', listener: (event: Events.Display.Usable) => void): this
|
|
595
677
|
on (event: '*', listener: (type: string, event: Events.Display.Any) => void): this
|
|
678
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
596
679
|
|
|
597
680
|
readonly displays: Display[]
|
|
598
681
|
|
|
599
682
|
readonly windows: Window[]
|
|
600
|
-
readonly focused: Window
|
|
601
|
-
readonly hovered: Window
|
|
683
|
+
readonly focused: Window | null
|
|
684
|
+
readonly hovered: Window | null
|
|
602
685
|
|
|
603
686
|
createWindow (options?: {
|
|
604
687
|
title?: string
|
|
605
|
-
display?: Display
|
|
606
|
-
x?: number
|
|
607
|
-
y?: number
|
|
608
|
-
width?: number
|
|
609
|
-
height?: number
|
|
688
|
+
display?: Display | null
|
|
689
|
+
x?: number | null
|
|
690
|
+
y?: number | null
|
|
691
|
+
width?: number | null
|
|
692
|
+
height?: number | null
|
|
610
693
|
visible?: boolean
|
|
611
694
|
fullscreen?: boolean
|
|
612
695
|
resizable?: boolean
|
|
@@ -616,11 +699,12 @@ export namespace Sdl {
|
|
|
616
699
|
vsync?: boolean
|
|
617
700
|
opengl?: boolean
|
|
618
701
|
webgpu?: boolean
|
|
619
|
-
skipTaskbar?: boolean
|
|
620
|
-
popupMenu?: boolean
|
|
621
|
-
tooltip?: boolean
|
|
622
|
-
utility?: boolean
|
|
623
702
|
}): Window
|
|
703
|
+
|
|
704
|
+
bytesPerPixel (format: Format): number
|
|
705
|
+
isYuv (format: Format): boolean
|
|
706
|
+
isPlanarYuv (format: Format): boolean
|
|
707
|
+
minBufferSize (format: Format, stride: number, height: number): number
|
|
624
708
|
}
|
|
625
709
|
}
|
|
626
710
|
|
|
@@ -842,16 +926,11 @@ export namespace Sdl {
|
|
|
842
926
|
| 'RALT'
|
|
843
927
|
| 'RGUI'
|
|
844
928
|
| 'MODE'
|
|
845
|
-
| '
|
|
846
|
-
| '
|
|
847
|
-
| '
|
|
848
|
-
| '
|
|
849
|
-
| '
|
|
850
|
-
| 'MEDIASELECT'
|
|
851
|
-
| 'WWW'
|
|
852
|
-
| 'MAIL'
|
|
853
|
-
| 'CALCULATOR'
|
|
854
|
-
| 'COMPUTER'
|
|
929
|
+
| 'MEDIA_NEXT_TRACK'
|
|
930
|
+
| 'MEDIA_PREVIOUS_TRACK'
|
|
931
|
+
| 'MEDIA_STOP'
|
|
932
|
+
| 'MEDIA_PLAY'
|
|
933
|
+
| 'MEDIA_SELECT'
|
|
855
934
|
| 'AC_SEARCH'
|
|
856
935
|
| 'AC_HOME'
|
|
857
936
|
| 'AC_BACK'
|
|
@@ -859,25 +938,36 @@ export namespace Sdl {
|
|
|
859
938
|
| 'AC_STOP'
|
|
860
939
|
| 'AC_REFRESH'
|
|
861
940
|
| 'AC_BOOKMARKS'
|
|
862
|
-
| '
|
|
863
|
-
| 'BRIGHTNESSUP'
|
|
864
|
-
| 'DISPLAYSWITCH'
|
|
865
|
-
| 'KBDILLUMTOGGLE'
|
|
866
|
-
| 'KBDILLUMDOWN'
|
|
867
|
-
| 'KBDILLUMUP'
|
|
868
|
-
| 'EJECT'
|
|
941
|
+
| 'MEDIA_EJECT'
|
|
869
942
|
| 'SLEEP'
|
|
870
|
-
| '
|
|
871
|
-
| '
|
|
872
|
-
| '
|
|
873
|
-
| '
|
|
943
|
+
| 'WAKE'
|
|
944
|
+
| 'CHANNEL_INCREMENT'
|
|
945
|
+
| 'CHANNEL_DECREMENT'
|
|
946
|
+
| 'MEDIA_PAUSE'
|
|
947
|
+
| 'MEDIA_RECORD'
|
|
948
|
+
| 'MEDIA_PLAY_PAUSE'
|
|
949
|
+
| 'MEDIA_REWIND'
|
|
950
|
+
| 'MEDIA_FAST_FORWARD'
|
|
951
|
+
| 'AC_NEW'
|
|
952
|
+
| 'AC_OPEN'
|
|
953
|
+
| 'AC_CLOSE'
|
|
954
|
+
| 'AC_EXIT'
|
|
955
|
+
| 'AC_SAVE'
|
|
956
|
+
| 'AC_PRINT'
|
|
957
|
+
| 'AC_PROPERTIES'
|
|
958
|
+
| 'SOFTLEFT'
|
|
959
|
+
| 'SOFTRIGHT'
|
|
960
|
+
| 'CALL'
|
|
961
|
+
| 'ENDCALL'
|
|
874
962
|
|
|
875
963
|
export type Key = string
|
|
876
964
|
|
|
877
|
-
interface Module {
|
|
965
|
+
interface Module extends EventEmitter {
|
|
878
966
|
readonly SCANCODE: { [name in ScancodeNames]: Scancode }
|
|
879
967
|
|
|
880
968
|
on (event: 'keymapChange', listener: (event: Events.Keyboard.KeymapChange) => void): this
|
|
969
|
+
on (event: '*', listener: (type: string, event: Events.Keyboard.Any) => void): this
|
|
970
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
881
971
|
|
|
882
972
|
getKey (scancode: Scancode): Key | null
|
|
883
973
|
getScancode (key: Key): Scancode | null
|
|
@@ -895,20 +985,30 @@ export namespace Sdl {
|
|
|
895
985
|
= 'LEFT'
|
|
896
986
|
| 'MIDDLE'
|
|
897
987
|
| 'RIGHT'
|
|
988
|
+
| 'X1'
|
|
989
|
+
| 'X2'
|
|
898
990
|
|
|
899
991
|
export type Cursor
|
|
900
|
-
= '
|
|
901
|
-
| '
|
|
992
|
+
= 'default'
|
|
993
|
+
| 'text'
|
|
902
994
|
| 'wait'
|
|
903
995
|
| 'crosshair'
|
|
904
|
-
| '
|
|
905
|
-
| '
|
|
906
|
-
| '
|
|
907
|
-
| '
|
|
908
|
-
| '
|
|
909
|
-
| '
|
|
910
|
-
| '
|
|
911
|
-
| '
|
|
996
|
+
| 'progress'
|
|
997
|
+
| 'nwseResize'
|
|
998
|
+
| 'neswResize'
|
|
999
|
+
| 'ewResize'
|
|
1000
|
+
| 'nsResize'
|
|
1001
|
+
| 'move'
|
|
1002
|
+
| 'notAllowed'
|
|
1003
|
+
| 'pointer'
|
|
1004
|
+
| 'nwResize'
|
|
1005
|
+
| 'nResize'
|
|
1006
|
+
| 'neResize'
|
|
1007
|
+
| 'eResize'
|
|
1008
|
+
| 'seResize'
|
|
1009
|
+
| 'sResize'
|
|
1010
|
+
| 'swResize'
|
|
1011
|
+
| 'wResize'
|
|
912
1012
|
|
|
913
1013
|
interface Module {
|
|
914
1014
|
readonly BUTTON: { [name in ButtonNames]: number }
|
|
@@ -923,13 +1023,14 @@ export namespace Sdl {
|
|
|
923
1023
|
|
|
924
1024
|
setCursor (cursor: Cursor): void
|
|
925
1025
|
resetCursor (): void
|
|
926
|
-
setCursorImage (width: number, height: number, stride: number, format: Video.Format, buffer: Buffer): void
|
|
1026
|
+
setCursorImage (width: number, height: number, stride: number, format: Video.Format, buffer: Buffer, x: number, y: number): void
|
|
927
1027
|
|
|
928
1028
|
showCursor (show?: boolean): void
|
|
929
1029
|
hideCursor (): void
|
|
930
1030
|
redrawCursor (): void
|
|
931
1031
|
|
|
932
|
-
|
|
1032
|
+
readonly captured: boolean
|
|
1033
|
+
capture (capture?: boolean): void
|
|
933
1034
|
uncapture (): void
|
|
934
1035
|
}
|
|
935
1036
|
|
|
@@ -943,7 +1044,7 @@ export namespace Sdl {
|
|
|
943
1044
|
| 'indirectRelative'
|
|
944
1045
|
|
|
945
1046
|
export interface Device {
|
|
946
|
-
readonly id:
|
|
1047
|
+
readonly id: bigint
|
|
947
1048
|
readonly name: string | null
|
|
948
1049
|
readonly type: DeviceType | null
|
|
949
1050
|
}
|
|
@@ -962,15 +1063,14 @@ export namespace Sdl {
|
|
|
962
1063
|
}
|
|
963
1064
|
|
|
964
1065
|
export type JoystickType
|
|
965
|
-
=
|
|
966
|
-
| 'gamecontroller'
|
|
1066
|
+
= 'gamepad'
|
|
967
1067
|
| 'wheel'
|
|
968
|
-
| '
|
|
969
|
-
| '
|
|
970
|
-
| '
|
|
1068
|
+
| 'arcadeStick'
|
|
1069
|
+
| 'flightStick'
|
|
1070
|
+
| 'dancePad'
|
|
971
1071
|
| 'guitar'
|
|
972
|
-
| '
|
|
973
|
-
| '
|
|
1072
|
+
| 'drumKit'
|
|
1073
|
+
| 'arcadePad'
|
|
974
1074
|
| 'throttle'
|
|
975
1075
|
|
|
976
1076
|
export type HatPosition
|
|
@@ -979,18 +1079,15 @@ export namespace Sdl {
|
|
|
979
1079
|
| 'right'
|
|
980
1080
|
| 'down'
|
|
981
1081
|
| 'left'
|
|
982
|
-
| '
|
|
983
|
-
| '
|
|
984
|
-
| '
|
|
985
|
-
| '
|
|
986
|
-
|
|
987
|
-
export
|
|
988
|
-
|
|
989
|
-
|
|
|
990
|
-
|
|
991
|
-
| 'full'
|
|
992
|
-
| 'wired'
|
|
993
|
-
| 'max'
|
|
1082
|
+
| 'rightUp'
|
|
1083
|
+
| 'rightDown'
|
|
1084
|
+
| 'leftUp'
|
|
1085
|
+
| 'leftDown'
|
|
1086
|
+
|
|
1087
|
+
export interface PowerInfo {
|
|
1088
|
+
readonly state: Sdl.Power.PowerState | null
|
|
1089
|
+
readonly percent: number | null
|
|
1090
|
+
}
|
|
994
1091
|
|
|
995
1092
|
export interface Device {
|
|
996
1093
|
readonly id: number
|
|
@@ -1004,7 +1101,7 @@ export namespace Sdl {
|
|
|
1004
1101
|
readonly player: number | null
|
|
1005
1102
|
}
|
|
1006
1103
|
|
|
1007
|
-
export
|
|
1104
|
+
export interface JoystickInstance extends EventEmitter {
|
|
1008
1105
|
on (event: 'axisMotion', listener: (event: Events.Joystick.AxisMotion) => void): this
|
|
1009
1106
|
on (event: 'ballMotion', listener: (event: Events.Joystick.BallMotion) => void): this
|
|
1010
1107
|
on (event: 'buttonDown', listener: (event: Events.Joystick.ButtonDown) => void): this
|
|
@@ -1013,40 +1110,42 @@ export namespace Sdl {
|
|
|
1013
1110
|
on (event: 'powerUpdate', listener: (event: Events.Joystick.PowerUpdate) => void): this
|
|
1014
1111
|
on (event: 'close', listener: (event: Events.Joystick.Close) => void): this
|
|
1015
1112
|
on (event: '*', listener: (type: string, event: Events.Joystick.Any) => void): this
|
|
1113
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
1016
1114
|
|
|
1017
1115
|
readonly device: Device
|
|
1018
|
-
readonly firmwareVersion: number
|
|
1019
|
-
readonly serialNumber: string
|
|
1116
|
+
readonly firmwareVersion: number | null
|
|
1117
|
+
readonly serialNumber: string | null
|
|
1020
1118
|
|
|
1021
1119
|
readonly axes: number[]
|
|
1022
1120
|
readonly balls: BallPosition[]
|
|
1023
|
-
readonly hats: HatPosition[]
|
|
1121
|
+
readonly hats: (HatPosition | null)[]
|
|
1024
1122
|
readonly buttons: boolean[]
|
|
1025
1123
|
|
|
1026
|
-
readonly power:
|
|
1124
|
+
readonly power: PowerInfo
|
|
1027
1125
|
|
|
1028
|
-
setPlayer (
|
|
1126
|
+
setPlayer (player: number): void
|
|
1029
1127
|
resetPlayer (): void
|
|
1030
1128
|
|
|
1031
1129
|
readonly hasLed: boolean
|
|
1032
1130
|
setLed (red: number, green: number, blue: number): void
|
|
1033
1131
|
|
|
1034
1132
|
readonly hasRumble: boolean
|
|
1035
|
-
rumble (lowFreqRumble
|
|
1133
|
+
rumble (lowFreqRumble?: number, highFreqRumble?: number, duration?: number | null): void
|
|
1036
1134
|
stopRumble (): void
|
|
1037
1135
|
|
|
1038
1136
|
readonly hasRumbleTriggers: boolean
|
|
1039
|
-
rumbleTriggers (leftRumble
|
|
1137
|
+
rumbleTriggers (leftRumble?: number, rightRumble?: number, duration?: number | null): void
|
|
1040
1138
|
stopRumbleTriggers (): void
|
|
1041
1139
|
|
|
1042
1140
|
readonly closed: boolean
|
|
1043
1141
|
close (): void
|
|
1044
1142
|
}
|
|
1045
1143
|
|
|
1046
|
-
interface Module {
|
|
1144
|
+
interface Module extends EventEmitter {
|
|
1047
1145
|
on (event: 'deviceAdd', listener: (event: Events.JoystickDevice.Add) => void): this
|
|
1048
1146
|
on (event: 'deviceRemove', listener: (event: Events.JoystickDevice.Remove) => void): this
|
|
1049
1147
|
on (event: '*', listener: (type: string, event: Events.JoystickDevice.Any) => void): this
|
|
1148
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
1050
1149
|
|
|
1051
1150
|
readonly devices: Device[]
|
|
1052
1151
|
|
|
@@ -1055,23 +1154,20 @@ export namespace Sdl {
|
|
|
1055
1154
|
|
|
1056
1155
|
}
|
|
1057
1156
|
|
|
1058
|
-
export namespace
|
|
1157
|
+
export namespace Gamepad {
|
|
1059
1158
|
|
|
1060
|
-
export type
|
|
1061
|
-
=
|
|
1159
|
+
export type GamepadType
|
|
1160
|
+
= 'standard'
|
|
1062
1161
|
| 'xbox360'
|
|
1063
1162
|
| 'xboxOne'
|
|
1064
1163
|
| 'ps3'
|
|
1065
1164
|
| 'ps4'
|
|
1066
|
-
| 'nintendoSwitchPro'
|
|
1067
|
-
| 'virtual'
|
|
1068
1165
|
| 'ps5'
|
|
1069
|
-
| '
|
|
1070
|
-
| 'googleStadia'
|
|
1071
|
-
| 'nvidiaShield'
|
|
1166
|
+
| 'nintendoSwitchPro'
|
|
1072
1167
|
| 'nintendoSwitchJoyconLeft'
|
|
1073
1168
|
| 'nintendoSwitchJoyconRight'
|
|
1074
1169
|
| 'nintendoSwitchJoyconPair'
|
|
1170
|
+
| 'gamecube'
|
|
1075
1171
|
|
|
1076
1172
|
export type Axis
|
|
1077
1173
|
= 'leftStickX'
|
|
@@ -1086,10 +1182,10 @@ export namespace Sdl {
|
|
|
1086
1182
|
| 'dpadRight'
|
|
1087
1183
|
| 'dpadUp'
|
|
1088
1184
|
| 'dpadDown'
|
|
1089
|
-
| '
|
|
1090
|
-
| '
|
|
1091
|
-
| '
|
|
1092
|
-
| '
|
|
1185
|
+
| 'south'
|
|
1186
|
+
| 'east'
|
|
1187
|
+
| 'west'
|
|
1188
|
+
| 'north'
|
|
1093
1189
|
| 'guide'
|
|
1094
1190
|
| 'back'
|
|
1095
1191
|
| 'start'
|
|
@@ -1097,16 +1193,33 @@ export namespace Sdl {
|
|
|
1097
1193
|
| 'rightStick'
|
|
1098
1194
|
| 'leftShoulder'
|
|
1099
1195
|
| 'rightShoulder'
|
|
1100
|
-
| '
|
|
1101
|
-
| '
|
|
1102
|
-
| '
|
|
1103
|
-
| '
|
|
1196
|
+
| 'rightPaddle1'
|
|
1197
|
+
| 'leftPaddle1'
|
|
1198
|
+
| 'rightPaddle2'
|
|
1199
|
+
| 'leftPaddle2'
|
|
1200
|
+
| 'misc1'
|
|
1201
|
+
| 'misc2'
|
|
1202
|
+
| 'misc3'
|
|
1203
|
+
| 'misc4'
|
|
1204
|
+
| 'misc5'
|
|
1205
|
+
| 'misc6'
|
|
1206
|
+
| 'touchpad'
|
|
1207
|
+
|
|
1208
|
+
export type ButtonLabel
|
|
1209
|
+
= 'a'
|
|
1210
|
+
| 'b'
|
|
1211
|
+
| 'x'
|
|
1212
|
+
| 'y'
|
|
1213
|
+
| 'cross'
|
|
1214
|
+
| 'circle'
|
|
1215
|
+
| 'square'
|
|
1216
|
+
| 'triangle'
|
|
1104
1217
|
|
|
1105
1218
|
export interface Device {
|
|
1106
1219
|
readonly id: number
|
|
1107
|
-
readonly name: string
|
|
1220
|
+
readonly name: string | null
|
|
1108
1221
|
readonly path: string | null
|
|
1109
|
-
readonly type:
|
|
1222
|
+
readonly type: GamepadType | null
|
|
1110
1223
|
readonly guid: string | null
|
|
1111
1224
|
readonly vendor: number | null
|
|
1112
1225
|
readonly product: number | null
|
|
@@ -1115,82 +1228,62 @@ export namespace Sdl {
|
|
|
1115
1228
|
readonly mapping: string | null
|
|
1116
1229
|
}
|
|
1117
1230
|
|
|
1118
|
-
export
|
|
1119
|
-
on (event: 'axisMotion', listener: (event: Events.
|
|
1120
|
-
on (event: 'buttonDown', listener: (event: Events.
|
|
1121
|
-
on (event: 'buttonUp', listener: (event: Events.
|
|
1122
|
-
on (event: 'powerUpdate', listener: (event: Events.
|
|
1123
|
-
on (event: 'steamHandleUpdate', listener: (event: Events.
|
|
1124
|
-
on (event: 'remap', listener: (event: Events.
|
|
1125
|
-
on (event: 'close', listener: (event: Events.
|
|
1126
|
-
on (event: '*', listener: (type: string, event: Events.
|
|
1231
|
+
export interface GamepadInstance extends EventEmitter {
|
|
1232
|
+
on (event: 'axisMotion', listener: (event: Events.Gamepad.AxisMotion) => void): this
|
|
1233
|
+
on (event: 'buttonDown', listener: (event: Events.Gamepad.ButtonDown) => void): this
|
|
1234
|
+
on (event: 'buttonUp', listener: (event: Events.Gamepad.ButtonUp) => void): this
|
|
1235
|
+
on (event: 'powerUpdate', listener: (event: Events.Gamepad.PowerUpdate) => void): this
|
|
1236
|
+
on (event: 'steamHandleUpdate', listener: (event: Events.Gamepad.SteamHandleUpdate) => void): this
|
|
1237
|
+
on (event: 'remap', listener: (event: Events.Gamepad.Remap) => void): this
|
|
1238
|
+
on (event: 'close', listener: (event: Events.Gamepad.Close) => void): this
|
|
1239
|
+
on (event: '*', listener: (type: string, event: Events.Gamepad.Any) => void): this
|
|
1240
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
1127
1241
|
|
|
1128
1242
|
readonly device: Device
|
|
1129
|
-
readonly firmwareVersion: number
|
|
1130
|
-
readonly serialNumber: string
|
|
1243
|
+
readonly firmwareVersion: number | null
|
|
1244
|
+
readonly serialNumber: string | null
|
|
1131
1245
|
readonly steamHandle: Buffer | null
|
|
1132
1246
|
|
|
1133
|
-
readonly axes: {
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
readonly
|
|
1137
|
-
readonly
|
|
1138
|
-
readonly
|
|
1139
|
-
readonly
|
|
1247
|
+
readonly axes: { readonly [axis in Axis]: number }
|
|
1248
|
+
readonly buttons: { readonly [button in Button]: boolean }
|
|
1249
|
+
readonly buttonLabels: {
|
|
1250
|
+
readonly south: ButtonLabel | null
|
|
1251
|
+
readonly east: ButtonLabel | null
|
|
1252
|
+
readonly west: ButtonLabel | null
|
|
1253
|
+
readonly north: ButtonLabel | null
|
|
1140
1254
|
}
|
|
1141
1255
|
|
|
1142
|
-
readonly
|
|
1143
|
-
readonly dpadLeft: boolean
|
|
1144
|
-
readonly dpadRight: boolean
|
|
1145
|
-
readonly dpadUp: boolean
|
|
1146
|
-
readonly dpadDown: boolean
|
|
1147
|
-
readonly a: boolean
|
|
1148
|
-
readonly b: boolean
|
|
1149
|
-
readonly x: boolean
|
|
1150
|
-
readonly y: boolean
|
|
1151
|
-
readonly guide: boolean
|
|
1152
|
-
readonly back: boolean
|
|
1153
|
-
readonly start: boolean
|
|
1154
|
-
readonly leftStick: boolean
|
|
1155
|
-
readonly rightStick: boolean
|
|
1156
|
-
readonly leftShoulder: boolean
|
|
1157
|
-
readonly rightShoulder: boolean
|
|
1158
|
-
readonly paddle1: boolean
|
|
1159
|
-
readonly paddle2: boolean
|
|
1160
|
-
readonly paddle3: boolean
|
|
1161
|
-
readonly paddle4: boolean
|
|
1162
|
-
}
|
|
1256
|
+
readonly power: Joystick.PowerInfo
|
|
1163
1257
|
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
setPlayer (index: number): void
|
|
1258
|
+
setPlayer (player: number): void
|
|
1167
1259
|
resetPlayer (): void
|
|
1168
1260
|
|
|
1169
1261
|
readonly hasLed: boolean
|
|
1170
1262
|
setLed (red: number, green: number, blue: number): void
|
|
1171
1263
|
|
|
1172
1264
|
readonly hasRumble: boolean
|
|
1173
|
-
rumble (lowFreqRumble
|
|
1265
|
+
rumble (lowFreqRumble?: number, highFreqRumble?: number, duration?: number | null): void
|
|
1174
1266
|
stopRumble (): void
|
|
1175
1267
|
|
|
1176
1268
|
readonly hasRumbleTriggers: boolean
|
|
1177
|
-
rumbleTriggers (leftRumble
|
|
1269
|
+
rumbleTriggers (leftRumble?: number, rightRumble?: number, duration?: number | null): void
|
|
1178
1270
|
stopRumbleTriggers (): void
|
|
1179
1271
|
|
|
1180
1272
|
readonly closed: boolean
|
|
1181
1273
|
close (): void
|
|
1182
1274
|
}
|
|
1183
1275
|
|
|
1184
|
-
interface Module {
|
|
1185
|
-
on (event: 'deviceAdd', listener: (event: Events.
|
|
1186
|
-
on (event: 'deviceRemove', listener: (event: Events.
|
|
1187
|
-
on (event: '*', listener: (type: string, event: Events.
|
|
1276
|
+
interface Module extends EventEmitter {
|
|
1277
|
+
on (event: 'deviceAdd', listener: (event: Events.GamepadDevice.Add) => void): this
|
|
1278
|
+
on (event: 'deviceRemove', listener: (event: Events.GamepadDevice.Remove) => void): this
|
|
1279
|
+
on (event: '*', listener: (type: string, event: Events.GamepadDevice.Any) => void): this
|
|
1280
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
1188
1281
|
|
|
1189
1282
|
addMappings (mappings: string[]): void
|
|
1190
1283
|
|
|
1191
1284
|
readonly devices: Device[]
|
|
1192
1285
|
|
|
1193
|
-
openDevice (device: Device):
|
|
1286
|
+
openDevice (device: Device): GamepadInstance
|
|
1194
1287
|
}
|
|
1195
1288
|
|
|
1196
1289
|
}
|
|
@@ -1198,8 +1291,7 @@ export namespace Sdl {
|
|
|
1198
1291
|
export namespace Sensor {
|
|
1199
1292
|
|
|
1200
1293
|
export type Type
|
|
1201
|
-
= '
|
|
1202
|
-
| 'accelerometer'
|
|
1294
|
+
= 'accelerometer'
|
|
1203
1295
|
| 'gyroscope'
|
|
1204
1296
|
|
|
1205
1297
|
export type Side
|
|
@@ -1208,22 +1300,22 @@ export namespace Sdl {
|
|
|
1208
1300
|
|
|
1209
1301
|
export interface Device {
|
|
1210
1302
|
readonly id: number
|
|
1211
|
-
readonly name: string
|
|
1303
|
+
readonly name: string | null
|
|
1212
1304
|
readonly type: Type | null
|
|
1213
1305
|
readonly side: Side | null
|
|
1214
1306
|
}
|
|
1215
1307
|
|
|
1216
1308
|
export interface Data {
|
|
1217
|
-
readonly timestamp: number | null
|
|
1218
1309
|
readonly x: number
|
|
1219
1310
|
readonly y: number
|
|
1220
1311
|
readonly z: number
|
|
1221
1312
|
}
|
|
1222
1313
|
|
|
1223
|
-
export
|
|
1314
|
+
export interface SensorInstance extends EventEmitter {
|
|
1224
1315
|
on (event: 'update', listener: (event: Events.Sensor.Update) => void): this
|
|
1225
1316
|
on (event: 'close', listener: (event: Events.Sensor.Close) => void): this
|
|
1226
1317
|
on (event: '*', listener: (type: string, event: Events.Sensor.Any) => void): this
|
|
1318
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
1227
1319
|
|
|
1228
1320
|
readonly device: Device
|
|
1229
1321
|
|
|
@@ -1248,39 +1340,36 @@ export namespace Sdl {
|
|
|
1248
1340
|
export type Format
|
|
1249
1341
|
= 's8'
|
|
1250
1342
|
| 'u8'
|
|
1251
|
-
| '
|
|
1252
|
-
| '
|
|
1253
|
-
| 's16sys'
|
|
1343
|
+
| 's16le'
|
|
1344
|
+
| 's16be'
|
|
1254
1345
|
| 's16'
|
|
1255
|
-
| '
|
|
1256
|
-
| '
|
|
1257
|
-
| 'u16sys'
|
|
1258
|
-
| 'u16'
|
|
1259
|
-
| 's32lsb'
|
|
1260
|
-
| 's32msb'
|
|
1261
|
-
| 's32sys'
|
|
1346
|
+
| 's32le'
|
|
1347
|
+
| 's32be'
|
|
1262
1348
|
| 's32'
|
|
1263
|
-
| '
|
|
1264
|
-
| '
|
|
1265
|
-
| 'f32sys'
|
|
1349
|
+
| 'f32le'
|
|
1350
|
+
| 'f32be'
|
|
1266
1351
|
| 'f32'
|
|
1267
1352
|
|
|
1268
1353
|
export interface Device {
|
|
1269
|
-
readonly
|
|
1270
|
-
readonly name
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
readonly
|
|
1354
|
+
readonly id: number | null
|
|
1355
|
+
readonly name: string | null
|
|
1356
|
+
readonly format: Format | null
|
|
1357
|
+
readonly channels: number | null
|
|
1358
|
+
readonly frequency: number | null
|
|
1359
|
+
readonly buffered: number | null
|
|
1275
1360
|
}
|
|
1276
1361
|
|
|
1277
|
-
export interface
|
|
1278
|
-
readonly
|
|
1362
|
+
export interface StreamOptions {
|
|
1363
|
+
readonly channels?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
|
|
1364
|
+
readonly frequency?: number
|
|
1365
|
+
readonly format?: Format
|
|
1366
|
+
readonly buffered?: number
|
|
1279
1367
|
}
|
|
1280
1368
|
|
|
1281
|
-
export
|
|
1369
|
+
export interface AudioStream extends EventEmitter {
|
|
1282
1370
|
on (event: 'close', listener: (event: Events.Audio.Close) => void): this
|
|
1283
1371
|
on (event: '*', listener: (type: string, event: Events.Audio.Any) => void): this
|
|
1372
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
1284
1373
|
|
|
1285
1374
|
readonly id: number
|
|
1286
1375
|
readonly device: Device
|
|
@@ -1288,14 +1377,12 @@ export namespace Sdl {
|
|
|
1288
1377
|
readonly channels: number
|
|
1289
1378
|
readonly frequency: number
|
|
1290
1379
|
readonly format: Format
|
|
1291
|
-
readonly buffered: number
|
|
1292
1380
|
|
|
1293
1381
|
readonly playing: boolean
|
|
1294
1382
|
play (play?: boolean): void
|
|
1295
1383
|
pause (): void
|
|
1296
1384
|
|
|
1297
|
-
|
|
1298
|
-
clearQueue (): void
|
|
1385
|
+
clear (): void
|
|
1299
1386
|
|
|
1300
1387
|
readonly bytesPerSample: number
|
|
1301
1388
|
readonly minSampleValue: number
|
|
@@ -1308,30 +1395,30 @@ export namespace Sdl {
|
|
|
1308
1395
|
close (): void
|
|
1309
1396
|
}
|
|
1310
1397
|
|
|
1311
|
-
export
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
export class AudioRecordingInstance extends AudioInstance {
|
|
1316
|
-
dequeue (buffer: Buffer, bytes?: number): number
|
|
1398
|
+
export interface AudioPlaybackStream extends AudioStream {
|
|
1399
|
+
readonly queued: number
|
|
1400
|
+
putData (buffer: Buffer, bytes?: number): void
|
|
1317
1401
|
}
|
|
1318
1402
|
|
|
1319
|
-
export interface
|
|
1320
|
-
readonly
|
|
1321
|
-
|
|
1322
|
-
readonly format?: Format
|
|
1323
|
-
readonly buffered?: number
|
|
1403
|
+
export interface AudioRecordingStream extends AudioStream {
|
|
1404
|
+
readonly available: number
|
|
1405
|
+
getData (buffer: Buffer, bytes?: number): number
|
|
1324
1406
|
}
|
|
1325
1407
|
|
|
1326
|
-
interface
|
|
1408
|
+
interface DeviceModule<Stream extends AudioStream> extends EventEmitter {
|
|
1327
1409
|
on (event: 'deviceAdd', listener: (event: Events.AudioDevice.Add) => void): this
|
|
1328
1410
|
on (event: 'deviceRemove', listener: (event: Events.AudioDevice.Remove) => void): this
|
|
1329
1411
|
on (event: '*', listener: (type: string, event: Events.AudioDevice.Any) => void): this
|
|
1412
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
1330
1413
|
|
|
1331
1414
|
readonly devices: Device[]
|
|
1332
1415
|
|
|
1333
|
-
openDevice (device
|
|
1334
|
-
|
|
1416
|
+
openDevice (device?: Device | null, options?: StreamOptions): Stream
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
interface Module {
|
|
1420
|
+
readonly playback: DeviceModule<AudioPlaybackStream>
|
|
1421
|
+
readonly recording: DeviceModule<AudioRecordingStream>
|
|
1335
1422
|
|
|
1336
1423
|
bytesPerSample (format: Format): number
|
|
1337
1424
|
minSampleValue (format: Format): number
|
|
@@ -1344,9 +1431,10 @@ export namespace Sdl {
|
|
|
1344
1431
|
|
|
1345
1432
|
export namespace Clipboard {
|
|
1346
1433
|
|
|
1347
|
-
interface Module {
|
|
1434
|
+
interface Module extends EventEmitter {
|
|
1348
1435
|
on (event: 'update', listener: (event: Events.Clipboard.Update) => void): this
|
|
1349
1436
|
on (event: '*', listener: (type: string, event: Events.Clipboard.Any) => void): this
|
|
1437
|
+
on (event: 'error', listener: (error: Error) => void): this
|
|
1350
1438
|
|
|
1351
1439
|
readonly text: string
|
|
1352
1440
|
setText (text: string): void
|
|
@@ -1382,7 +1470,7 @@ export const keyboard: Sdl.Keyboard.Module
|
|
|
1382
1470
|
export const mouse: Sdl.Mouse.Module
|
|
1383
1471
|
export const touch: Sdl.Touch.Module
|
|
1384
1472
|
export const joystick: Sdl.Joystick.Module
|
|
1385
|
-
export const
|
|
1473
|
+
export const gamepad: Sdl.Gamepad.Module
|
|
1386
1474
|
export const sensor: Sdl.Sensor.Module
|
|
1387
1475
|
export const audio: Sdl.Audio.Module
|
|
1388
1476
|
export const clipboard: Sdl.Clipboard.Module
|