@kmamal/sdl 0.11.4 → 0.11.7
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 +70 -16
- package/binding.gyp +1 -0
- package/package.json +1 -1
- package/src/javascript/audio/audio-instance.js +2 -3
- package/src/javascript/audio/device.js +1 -10
- package/src/javascript/audio/index.js +5 -7
- package/src/javascript/controller/controller-instance.js +2 -0
- package/src/javascript/controller/device.js +14 -3
- package/src/javascript/controller/index.js +5 -11
- package/src/javascript/events/index.js +61 -123
- package/src/javascript/events/reconcile-audio-devices.js +15 -0
- package/src/javascript/events/reconcile-displays.js +16 -0
- package/src/javascript/events/reconcile-joystick-and-controller-devices.js +37 -0
- package/src/javascript/events/reconcile.js +61 -0
- package/src/javascript/joystick/device.js +9 -3
- package/src/javascript/joystick/index.js +13 -5
- package/src/javascript/joystick/joystick-instance.js +2 -0
- package/src/javascript/sensor/sensor-instance.js +2 -0
- package/src/javascript/video/display.js +4 -0
- package/src/javascript/video/index.js +1 -0
- package/src/javascript/video/window.js +6 -0
- package/src/native/audio.cpp +10 -12
- package/src/native/audio.h +4 -0
- package/src/native/controller.cpp +72 -56
- package/src/native/controller.h +3 -0
- package/src/native/enums.cpp +315 -315
- package/src/native/events.cpp +161 -79
- package/src/native/events.h +2 -0
- package/src/native/global.cpp +47 -20
- package/src/native/joystick.cpp +87 -48
- package/src/native/joystick.h +3 -2
- package/src/native/keyboard.cpp +1 -1
- package/src/native/mouse.cpp +2 -2
- package/src/native/power.cpp +9 -3
- package/src/native/sensor.cpp +24 -13
- package/src/native/video.cpp +21 -13
- package/src/native/video.h +1 -0
- package/src/native/window.cpp +41 -29
- package/src/types/index.d.ts +65 -17
package/src/types/index.d.ts
CHANGED
|
@@ -11,11 +11,25 @@ export namespace Events {
|
|
|
11
11
|
readonly display: Sdl.Video.Display
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export interface Add extends DisplayEvent {
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export interface Add extends DisplayEvent {
|
|
15
|
+
readonly type: 'deviceAdd'
|
|
16
|
+
readonly device: Sdl.Video.Display
|
|
17
|
+
}
|
|
18
|
+
export interface Remove extends DisplayEvent {
|
|
19
|
+
readonly type: 'deviceRemove'
|
|
20
|
+
readonly device: Sdl.Video.Display
|
|
21
|
+
}
|
|
22
|
+
export interface Orient extends DisplayEvent {
|
|
23
|
+
readonly type: 'deviceOrient'
|
|
24
|
+
readonly device: Sdl.Video.Display
|
|
25
|
+
readonly orientation: Sdl.Video.Orientation
|
|
26
|
+
}
|
|
27
|
+
export interface Move extends DisplayEvent {
|
|
28
|
+
readonly type: 'deviceMove'
|
|
29
|
+
readonly device: Sdl.Video.Display
|
|
30
|
+
}
|
|
17
31
|
|
|
18
|
-
export type Any = Add | Remove | Orient
|
|
32
|
+
export type Any = Add | Remove | Orient | Move
|
|
19
33
|
|
|
20
34
|
}
|
|
21
35
|
|
|
@@ -86,6 +100,10 @@ export namespace Events {
|
|
|
86
100
|
readonly pixelWidth: number
|
|
87
101
|
readonly pixelHeight: number
|
|
88
102
|
}
|
|
103
|
+
export interface DisplayChange extends WindowEvent {
|
|
104
|
+
readonly type: 'displayChange'
|
|
105
|
+
readonly display: Sdl.Video.Display
|
|
106
|
+
}
|
|
89
107
|
export interface Focus extends WindowEvent { readonly type: 'focus' }
|
|
90
108
|
export interface Blur extends WindowEvent { readonly type: 'blur' }
|
|
91
109
|
export interface Hover extends WindowEvent { readonly type: 'hover' }
|
|
@@ -123,6 +141,7 @@ export namespace Events {
|
|
|
123
141
|
| Restore
|
|
124
142
|
| Move
|
|
125
143
|
| Resize
|
|
144
|
+
| DisplayChange
|
|
126
145
|
| Focus
|
|
127
146
|
| Blur
|
|
128
147
|
| Hover
|
|
@@ -313,6 +332,12 @@ export namespace Sdl {
|
|
|
313
332
|
|
|
314
333
|
export namespace Video {
|
|
315
334
|
|
|
335
|
+
export type Orientation
|
|
336
|
+
= 'portrait'
|
|
337
|
+
| 'portraitFlipped'
|
|
338
|
+
| 'landscape'
|
|
339
|
+
| 'landscapeFlipped'
|
|
340
|
+
|
|
316
341
|
export type Format
|
|
317
342
|
= 'rgb332'
|
|
318
343
|
| 'rgb444'
|
|
@@ -377,6 +402,7 @@ export namespace Sdl {
|
|
|
377
402
|
readonly vertical: number
|
|
378
403
|
readonly diagonal: number
|
|
379
404
|
} | null
|
|
405
|
+
readonly orientation: Orientation | null
|
|
380
406
|
}
|
|
381
407
|
|
|
382
408
|
export class Window {
|
|
@@ -388,6 +414,7 @@ export namespace Sdl {
|
|
|
388
414
|
on (event: 'restore', listener: (event: Events.Window.Restore) => void): this
|
|
389
415
|
on (event: 'move', listener: (event: Events.Window.Move) => void): this
|
|
390
416
|
on (event: 'resize', listener: (event: Events.Window.Resize) => void): this
|
|
417
|
+
on (event: 'displayChange', listener: (event: Events.Window.DisplayChange) => void): this
|
|
391
418
|
on (event: 'focus', listener: (event: Events.Window.Focus) => void): this
|
|
392
419
|
on (event: 'blur', listener: (event: Events.Window.Blur) => void): this
|
|
393
420
|
on (event: 'hover', listener: (event: Events.Window.Hover) => void): this
|
|
@@ -424,6 +451,8 @@ export namespace Sdl {
|
|
|
424
451
|
readonly pixelHeight: number
|
|
425
452
|
setSizeInPixels (pixelWidth: number, pixelHeight: number): void
|
|
426
453
|
|
|
454
|
+
readonly display: Display
|
|
455
|
+
|
|
427
456
|
readonly visible: boolean
|
|
428
457
|
show (show?: boolean): void
|
|
429
458
|
hide (): void
|
|
@@ -491,6 +520,7 @@ export namespace Sdl {
|
|
|
491
520
|
on (event: 'displayAdd', listener: (event: Events.Display.Add) => void): this
|
|
492
521
|
on (event: 'displayRemove', listener: (event: Events.Display.Remove) => void): this
|
|
493
522
|
on (event: 'displayOrient', listener: (event: Events.Display.Orient) => void): this
|
|
523
|
+
on (event: 'displayMove', listener: (event: Events.Display.Move) => void): this
|
|
494
524
|
on (event: '*', listener: (type: string, event: Events.Display.Any) => void): this
|
|
495
525
|
|
|
496
526
|
readonly displays: Display[]
|
|
@@ -840,7 +870,8 @@ export namespace Sdl {
|
|
|
840
870
|
}
|
|
841
871
|
|
|
842
872
|
export type JoystickType
|
|
843
|
-
=
|
|
873
|
+
= null
|
|
874
|
+
| 'gamecontroller'
|
|
844
875
|
| 'wheel'
|
|
845
876
|
| 'arcadestick'
|
|
846
877
|
| 'flightstick'
|
|
@@ -871,10 +902,10 @@ export namespace Sdl {
|
|
|
871
902
|
|
|
872
903
|
export interface Device {
|
|
873
904
|
readonly id: number
|
|
874
|
-
readonly type: JoystickType
|
|
875
905
|
readonly name: string
|
|
876
906
|
readonly path: string
|
|
877
907
|
readonly guid: string
|
|
908
|
+
readonly type: JoystickType | null
|
|
878
909
|
readonly vendor: number | null
|
|
879
910
|
readonly product: number | null
|
|
880
911
|
readonly version: number | null
|
|
@@ -933,17 +964,21 @@ export namespace Sdl {
|
|
|
933
964
|
|
|
934
965
|
export namespace Controller {
|
|
935
966
|
|
|
936
|
-
export
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
967
|
+
export type ControllerType
|
|
968
|
+
= null
|
|
969
|
+
| 'xbox360'
|
|
970
|
+
| 'xboxOne'
|
|
971
|
+
| 'ps3'
|
|
972
|
+
| 'ps4'
|
|
973
|
+
| 'nintendoSwitchPro'
|
|
974
|
+
| 'virtual'
|
|
975
|
+
| 'ps5'
|
|
976
|
+
| 'amazonLuna'
|
|
977
|
+
| 'googleStadia'
|
|
978
|
+
| 'nvidiaShield'
|
|
979
|
+
| 'nintendoSwitchJoyconLeft'
|
|
980
|
+
| 'nintendoSwitchJoyconRight'
|
|
981
|
+
| 'nintendoSwitchJoyconPair'
|
|
947
982
|
|
|
948
983
|
export type Axis
|
|
949
984
|
= 'leftStickX'
|
|
@@ -974,6 +1009,19 @@ export namespace Sdl {
|
|
|
974
1009
|
| 'paddle3'
|
|
975
1010
|
| 'paddle4'
|
|
976
1011
|
|
|
1012
|
+
export interface Device {
|
|
1013
|
+
readonly id: number
|
|
1014
|
+
readonly name: string
|
|
1015
|
+
readonly path: string
|
|
1016
|
+
readonly guid: string
|
|
1017
|
+
readonly type: ControllerType | null;
|
|
1018
|
+
readonly vendor: number | null
|
|
1019
|
+
readonly product: number | null
|
|
1020
|
+
readonly version: number | null
|
|
1021
|
+
readonly player: number | null
|
|
1022
|
+
readonly mapping: string
|
|
1023
|
+
}
|
|
1024
|
+
|
|
977
1025
|
export class ControllerInstance {
|
|
978
1026
|
on (event: 'axisMotion', listener: (event: Events.Controller.AxisMotion) => void): this
|
|
979
1027
|
on (event: 'buttonDown', listener: (event: Events.Controller.ButtonDown) => void): this
|