-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.d.ts
1084 lines (968 loc) · 32.3 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare module "glfw-raub" {
type EventEmitter = import('node:events').EventEmitter;
type TWindowMode = 'windowed' | 'borderless' | 'fullscreen';
type TSize = Readonly<{ width: number; height: number }>;
type TPos = Readonly<{ x: number; y: number }>;
type TCbVoid = () => void;
type TRect = TSize & TPos & {
left: number;
top: number;
right: number;
bottom: number;
};
/* Image data for icons and cursors. */
type TImageData = TSize & Readonly<{
data: Buffer;
noflip?: boolean;
}>;
type TMonitorMode = TSize & Readonly<{
/** Refresh rate. */
rate: number;
}>;
type TMonitor = TMonitorMode & {
/** Is this screen primary. */
is_primary: boolean;
/** Screen name. */
name: string;
/** Global position x of the screen. */
pos_x: number;
/** Global position y of the screen. */
pos_y: number;
/** Screen width in mm. */
width_mm: number;
/** Screen height in mm. */
height_mm: number;
/** An array of supported display modes. */
modes: ReadonlyArray<TMonitorMode>;
};
type TEvent = {
type: string;
[key: string]: any;
};
type TMouseEvent = TEvent & {
buttons: number;
clientX: number;
clientY: number;
pageX: number;
pageY: number;
x: number;
y: number;
shiftKey: boolean;
ctrlKey: boolean;
altKey: boolean;
metaKey: boolean;
};
type TMouseMoveEvent = TMouseEvent & {
movementX: number;
movementY: number;
};
type TMouseButtonEvent = TMouseEvent & {
button: number;
which: number;
};
type TMouseScrollEvent = TMouseEvent & {
deltaX: number;
deltaY: number;
deltaZ: number;
wheelDeltaX: number;
wheelDeltaY: number;
wheelDelta: number;
};
type TJoystickEvent = TEvent & {
id: number;
event: number;
};
type TKeyEvent = TEvent & {
repeat: boolean;
altKey: boolean;
ctrlKey: boolean;
metaKey: boolean;
shiftKey: boolean;
code: string | null;
key: string | null;
which: number;
charCode: number;
};
type TDropEvent = TEvent & {
dataTransfer: Readonly<{ [key: string]: never }>
dropEffect: 'none';
effectAllowed: 'all';
files: ReadonlyArray<string>;
items: ReadonlyArray<string>;
types: ReadonlyArray<never>;
};
type TIconifyEvent = TEvent & {
iconified: boolean;
};
type TPosEvent = TEvent & TPos;
type TSizeEvent = TEvent & TSize;
type TEventCb<T extends TEvent> = (event: T) => (void | boolean);
type TCbField<T extends TEvent> = TEventCb<T> | ReadonlyArray<TEventCb<T>>;
export type TWindowOpts = Readonly<Partial<{
/** Major OpenGL version to be used. Default is 2. */
major: number;
/** Minor OpenGL version to be used. Default is 1. */
minor: number;
/** Window title, takes current directory as default. Default is $PWD. */
width: number;
/** Window initial width. Default is 800. */
height: number;
/** Window initial height. Default is 600. */
display: number;
/** Display id to open window on a specific display. Default is undefined. */
vsync: boolean;
/** If vsync should be used. Default is false. */
autoIconify: boolean;
/** If the window is fullscreen, takes presedence over `mode`. Default is false. */
fullscreen: boolean;
/** One of `'windowed', 'borderless', 'fullscreen'`. Default is 'windowed'. */
mode: TWindowMode;
/** If fullscreen windows should iconify automatically on focus loss. Default is true. */
decorated: boolean;
/** Multisample antialiasing level. Default is 2. */
msaa: number;
/** Winodw icon. Default is null. */
icon: TImageData;
/** If window has borders (use `false` for borderless fullscreen). Default is true. */
title: string;
/** Make window resizable. Default is true. */
resizable: boolean;
/**
* This callback is called right before the window creation.
*
* `window` - a reference to the Window object (`this`).
* `glfw` - is a reference to GLFW module, just in case if needed.
*/
onBeforeWindow: (window: Window, glfw: unknown) => void;
}>>;
type TWindowPtr = number;
type TVkInstancePtr = number;
type TVkSurfacePtr = number;
type TVkDevicePtr = number;
type TVkPhysicalDevicePtr = number;
type TVkProcedurePtr = number;
type TVkAllocationCallbacksPtr = number;
type TFnWindow = (window: TWindowPtr) => void;
/**
* GLFW Window API wrapper.
*
* Window is a higher-level js-wrapper for GLFW API.
* It helps managing window instances. It also extends
* EventEmitter to provide event-handling.
*/
export class Window implements EventEmitter {
constructor(opts?: TWindowOpts);
/** The ratio between physical and logical pixels, e.g 2 for Retina. Default is 1.*/
readonly ratio: number;
/** Alias for ratio. */
readonly devicePixelRatio: number;
/** GLFW window pointer. Literally, the pointer from C++. */
readonly handle: number;
/** Always 0. */
readonly scrollX: number;
/** Always 0. */
readonly scrollY: number;
/** Number of msaa samples. */
readonly msaa: number;
/** OpenGL vendor info. */
readonly version: string;
/** The size of allocated framebuffer, same as pxSize. */
readonly framebufferSize: Readonly<{ width: number; height: number }>;
/** Which OpenGL context is now current. */
readonly currentContext: number;
/** Platform device (e.g. `wglGetCurrentDC()` or `glfwGetX11Display()`). */
readonly platformDevice: number;
/** Platform-specific window handle (e.g. Windows HWND). */
readonly platformWindow: number;
/** Platform OpenGL context ID for this window. */
readonly platformContext: number;
/**
* Window display mode. Default is 'windowed'.
*
* One of: 'windowed', 'borderless', 'fullscreen'.
* Here 'borderless' emulates fullscreen by a frameless, screen-sized window.
* When this property is changed, a new window is created and the old is hidden.
*/
mode: TWindowMode;
/**
* Width in LOGICAL pixels.
*
* For Retina - twice the window size.
*/
width: number;
/**
* Height in LOGICAL pixels.
*
* For Retina - twice the window size.
*/
height: number;
/** Alias for width. */
offsetWidth: number;
/** Alias for height. */
offsetHeight: number;
/** Alias for width. */
w: number;
/** Alias for height. */
h: number;
/** An Array, containing LOGICAL width and height. */
wh: [number, number];
/** An Object, containing LOGICAL width and height. */
pxSize: TSize;
/** Alias for width. */
innerWidth: number;
/** Alias for height. */
innerHeight: number;
/** Alias for width. */
clientWidth: number;
/** Alias for height. */
clientHeight: number;
/**
* Alias for .on('keydown', cb).
*
* Setter adds a new callback.
* Getter returns an Array of currently existing callbacks.
*/
onkeydown: TCbField<TKeyEvent>;
/**
* Alias for .on('keyup', cb).
*
* Setter adds a new callback.
* Getter returns an Array of currently existing callbacks.
*/
onkeyup: TCbField<TKeyEvent>;
/**
* Alias for .on('mousedown', cb).
*
* Setter adds a new callback.
* Getter returns an Array of currently existing callbacks.
*/
onmousedown: TCbField<TMouseButtonEvent>;
/**
* Alias for .on('mouseup', cb).
*
* Setter adds a new callback.
* Getter returns an Array of currently existing callbacks.
*/
onmouseup: TCbField<TMouseButtonEvent>;
/**
* Alias for .on('wheel', cb).
*
* Setter adds a new callback.
* Getter returns an Array of currently existing callbacks.
*/
onwheel: TCbField<TMouseScrollEvent>;
/**
* Alias for .on('mousewheel', cb).
*
* Setter adds a new callback.
* Getter returns an Array of currently existing callbacks.
*/
onmousewheel: TCbField<TMouseScrollEvent>;
/**
* Alias for .on('resize', cb).
*
* Setter adds a new callback.
* Getter returns an Array of currently existing callbacks.
*/
onresize: TCbField<TSizeEvent>;
/** An Object, containing PHYSICAL width and height of the window. */
size: TSize;
/** Boolean, sets window resizability */
resizable: boolean;
/**
* Alias for .on('keydown', cb).
*
* Setter adds a new callback.
* Getter returns an Array of currently existing callbacks.
*/
title: string;
/**
* Window icon in RGBA format.
*
* Consider using image-raub Image implementation.
* The given image is vertically flipped if noflip is not set to true.
* @see https://github.com/node-3d/image-raub
* @see https://github.com/node-3d/glfw-raub/examples/icon.js
* */
icon: TImageData | unknown;
/** If the window is going to be closed. */
shouldClose: boolean;
/** Window position X-coordinate on the screen. */
x: number;
/** Window position Y-coordinate on the screen. */
y: number;
/** An Object, containing the window position coordinates. */
pos: TPos;
/** An Object, containing the cursor position coordinates. */
cursorPos: TPos;
/** Get a monitor having the most overlap with this window. */
getCurrentMonitor(): TMonitor;
/**
* Gets a browserlike rect of this window.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
*/
getBoundingClientRect(): TRect;
/**
* Get key state (GLFW_PRESS/GLFW_RELEASE).
*
* @see https://www.glfw.org/docs/latest/group__keys.html
*/
getKey(key: number): number;
/**
* Get mouse button state (GLFW_PRESS/GLFW_RELEASE).
*
* @see https://www.glfw.org/docs/latest/group__buttons.html
*/
getMouseButton(button: number): number;
/**
* Get window attribute.
*
* @see https://www.glfw.org/docs/latest/window_guide.html#window_attribs
*/
getWindowAttrib(attrib: number): number;
/** Set input mode option. */
setInputMode(mode: number, value: number): void;
/** Swaps the front and back buffers of the window. */
swapBuffers(): void;
/** Make this window's GL context current. */
makeCurrent(): void;
/** Destroy the GLFW window. */
destroy(): void;
/** Minimize the window. */
iconify(): void;
/** Restore the window if it was previously iconified or maximized. */
restore(): void;
/** Hide the window. */
hide(): void;
/** Show the window, if it is hidden. */
show(): void;
/**
* Add event listener.
*
* 'blur' - window [focus lost](https://developer.mozilla.org/en-US/docs/Web/Events/blur)
* 'click' - mouse button [clicked](https://developer.mozilla.org/en-US/docs/Web/Events/click)
* 'drop' - drag-[dropped](https://developer.mozilla.org/en-US/docs/Web/Events/drop) some files on the window
* 'focus' - window [focus gained](https://developer.mozilla.org/en-US/docs/Web/Events/focus)
* 'focusin' - window [focus gained](https://developer.mozilla.org/en-US/docs/Web/Events/focusin)
* 'focusout' - window [focus lost](https://developer.mozilla.org/en-US/docs/Web/Events/focusout)
* 'resize' - render-surface resized (values in pixels) `{ width, height }`
* 'iconifiy' - window was iconified
* 'keydown' - keyboard [key down](https://developer.mozilla.org/en-US/docs/Web/Events/keydown)
* 'keyup' - keyboard [key up](https://developer.mozilla.org/en-US/docs/Web/Events/keyup)
* 'mousedown' - mouse [button down](https://developer.mozilla.org/en-US/docs/Web/Events/mousedown)
* 'mouseenter' - mouse [entered](https://developer.mozilla.org/en-US/docs/Web/Events/mouseenter) the window
* 'mouseleave' - mouse [left](https://developer.mozilla.org/en-US/docs/Web/Events/mouseleave) the window
* 'mouseup' - mouse [button up](https://developer.mozilla.org/en-US/docs/Web/Events/mouseup)
* 'quit' - window closed
* 'refresh' - window needs to be redrawn
* 'wresize' - window frame resized (NOT really pixels) `{ width, height }`
* 'wheel' - mouse [wheel rotation](https://developer.mozilla.org/en-US/docs/Web/Events/wheel)
* 'move' - window moved `{ x, y }`
* Note: `keypress` event is not supported.
*/
on(name: string, cb: (event: TEvent) => (void | boolean)): this;
/** Alias for `emit`, type is expected inside the event object. */
dispatchEvent(event: TEvent): void;
/** Alias for `on`. */
addEventListener(name: string, cb: (event: TEvent) => (void | boolean)): this;
/** Alias for `removeListener`. */
removeEventListener(name: string): void;
/** BOUND `requestAnimationFrame` method, returns id. */
requestAnimationFrame(cb: (dateNow: number) => void): number;
/** BOUND `cancelAnimationFrame` method. Cancels by id. */
cancelAnimationFrame(id: number): void;
// ------ implements EventEmitter
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
removeAllListeners(event?: string | symbol): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(eventName: string | symbol): Function[];
rawListeners(eventName: string | symbol): Function[];
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount(eventName: string | symbol, listener?: Function): number;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
eventNames(): Array<string | symbol>;
}
export type TDocumentOpts = TWindowOpts & Readonly<Partial<{
/**
* If the window should ignore the default quit signals.
*
* E.g.: process 'SIGINT', document 'quit', and ESC press if `autoEsc` enabled.
*/
ignoreQuit: boolean;
/**
* If window has the default key handlers for fullscreen.
*
* * CTRL+F - borderless fullscreen window.
* * CTRL+ALT+F - real, exclusive fullscreen mode.
* * CTRL+SHIFT+F - back to windowed.
*/
autoFullscreen: boolean;
/**
* Handle ESC key to close window automatically.
*
* Does nothing if `ignoreQuit` is enabled.
*/
autoEsc: boolean;
}>>;
/**
* Web-like Document.
*
* Document extends Window to provide an additional web-style compatibility layer.
* As name suggests, objects of such class will mimic the behavior and properties of
* your typical browser window.document. But also it is a Window, at the same time.
* And it is incomplete at this point: you still have to provide an Image class of
* your choice and WebGL context (implementation).
* Two static methods are designated for this: setImage and setWebgl.
*/
export class Document extends Window {
/**
* Set `Image` implementation.
*
* For example, [this Image implementation](https://github.com/raub/node-image).
* Also sets global.HTMLImageElement.
*/
static setImage(Image: unknown): void;
/**
* Set `WebGL` implementation.
*
* For example, [this WebGL implementation](https://github.com/raub/node-webgl).
*/
static setWebgl(Webgl: unknown): void;
constructor(opts?: TDocumentOpts);
/** Returns `this`. */
readonly body: Document;
/** Set `glfw.CURSOR` mode to `glfw.CURSOR_DISABLED`. */
setPointerCapture(): void;
/** Set `glfw.CURSOR` mode to `glfw.CURSOR_NORMAL`. */
releasePointerCapture(): void;
/**
* Mimics web-element `style` property.
*
* But only `width` and `height` matters.
*/
readonly style: TSize;
/** Returns `Document.webgl`, set through `Document.setWebgl`. */
readonly context: Readonly<{ [key: string]: unknown }>;
/** Returns `Document.webgl`, set through `Document.setWebgl`. */
getContext(kind: string): Readonly<{ [key: string]: unknown }>;
/** Returns `this`. */
getElementById(id: string): Document;
/** If contains 'canvas', returns `this`, otherwise `null`. */
getElementsByTagName(tag: string): ReadonlyArray<Document>;
/** Does nothing. */
appendChild(): void;
/** Returns the result of `createElement(tag)` */
createElementNS(unused: unknown, tag: string): void;
/**
* Fake createElement.
*
* For `'canvas'` returns `this` for *the first call*,
* then returns new instances of canvas-like object capable of using 2d or 3d context.
* This is done for some web APIs like three.js, which create additional canvases.
* For `'image'` returns `new Document.Image`, as per `Document.setImage`.
*/
createElement(tag: string): Document;
}
/**
* Hide the terminal window.
*
* **Windows ONLY** hides the console window, but only in case
* this console window is property of this process. For instance this works if you use
* `pkg` module to bundle your app, and then doubleclick the EXE. But if you are running
* a command, like `node script.js`, then this won't hide the window. **It's safe to call
* this function on all platforms, but it will be ignored, unless the platform is Windows**.
*/
const hideConsole: TCbVoid;
/**
* Show the terminal window.
*
* **Windows ONLY** shows the console window
* if it was previously hidden with `glfw.hideConsole()`.
*/
const showConsole: TCbVoid;
/** Draws a test scene, used in examples here. */
const testScene: (w: number, h: number, z: number) => void;
/** Draws a test scene, that reacts to a joystick. */
const testJoystick: TCbVoid;
const init: TCbVoid;
const initHint: (hint: number, value: number) => void;
const terminate: TCbVoid;
const getVersion: () => Readonly<{
major: number;
minor: number;
rev: number;
}>;
const getVersionString: () => string;
const getError: () => string;
const getTime: () => number;
const setTime: (time: number) => void;
const getMonitors: () => ReadonlyArray<TMonitor>;
const getPrimaryMonitor: () => TMonitor;
const windowHint: (hint: number, value: number) => void;
const windowHintString: (hint: number, value: string) => void;
const defaultWindowHints: TCbVoid;
const joystickPresent: () => boolean;
const getJoystickAxes: (id: number) => string;
const getJoystickButtons: (id: number) => string;
const getJoystickName: (id: number) => string;
/**
* Create a GLFW window.
*
* This function differs from GLFW Docs signature due to JS specifics.
* Here `emitter` is any object having a **BOUND** `emit()` method.
* It will be used to transmit GLFW events.
*/
const createWindow: (
width: number,
height: number,
emitter: Readonly<{ emit: (name: string, event: TEvent ) => void }>,
title: string,
monitor: number,
isNoApi: boolean,
) => TWindowPtr;
const destroyWindow: TFnWindow;
const setWindowTitle: (window: TWindowPtr, title: string) => void;
const setWindowIcon: (window: TWindowPtr, icon: TImageData) => void;
const getWindowSize: (window: TWindowPtr) => TSize;
const getWindowFrameSize: (window: TWindowPtr) => Readonly<{
left: number;
top: number;
right: number;
bottom: number;
}>;
const getWindowContentScale: (window: TWindowPtr) => Readonly<{
xscale: number;
yscale: number;
}>;
const setWindowSize: (window: TWindowPtr, w: number, h: number) => void;
const setWindowSizeLimits: (
window: TWindowPtr,
minwidth: number,
minheight: number,
maxwidth: number,
maxheight: number,
) => void;
const setWindowAspectRatio: (window: TWindowPtr, numer: number, denom: number) => void;
const setWindowPos: (window: TWindowPtr, x: number, y: number) => void;
const getWindowPos: (window: TWindowPtr) => TPos;
const getWindowOpacity: (window: TWindowPtr) => number;
const setWindowOpacity: (window: TWindowPtr, opacity: number) => void;
const maximizeWindow: TFnWindow;
const focusWindow: TFnWindow;
const requestWindowAttention: TFnWindow;
const getWindowMonitor: (window: TWindowPtr) => TMonitor;
const getFramebufferSize: (window: TWindowPtr) => TSize;
const iconifyWindow: TFnWindow;
const restoreWindow: TFnWindow;
const hideWindow: TFnWindow;
const showWindow: TFnWindow;
const windowShouldClose: (window: TWindowPtr) => number;
const setWindowShouldClose: (window: TWindowPtr, shouldClose: number) => void;
const getWindowAttrib: (window: TWindowPtr, attrib: number) => number;
const setWindowAttrib: (window: TWindowPtr, attrib: number, value: number) => void;
const setInputMode: (window: TWindowPtr, mode: number, value: number) => void;
const getInputMode: (window: TWindowPtr, mode: number) => number;
const pollEvents: TCbVoid;
const waitEvents: TCbVoid;
const waitEventsTimeout: (timeout: number) => void;
const postEmptyEvent: TCbVoid;
const getKey: (window: TWindowPtr, key: number) => number;
const getMouseButton: (window: TWindowPtr, button: number) => number;
const getCursorPos: (window: TWindowPtr, x: number, y: number) => void;
const setCursorPos: (window: TWindowPtr) => TPos;
const makeContextCurrent: TFnWindow;
const getCurrentContext: () => TWindowPtr;
const swapBuffers: TFnWindow;
const swapInterval: (interval: number) => void;
const extensionSupported: (name: string) => boolean;
const rawMouseMotionSupported: () => boolean;
const getKeyName: (key: number, scan: number) => string;
const getKeyScancode: (key: number) => number;
const getJoystickHats: (id: string) => ReadonlyArray<number>;
const joystickIsGamepad: (id: string) => boolean;
const updateGamepadMappings: (mappings: string) => boolean;
const getGamepadName: (id: number) => string;
const getGamepadState: (id: number) => Readonly<{
buttons: ReadonlyArray<number>;
axes: ReadonlyArray<number>;
}>;
const setClipboardString: (window: TWindowPtr, value: string) => void;
const getClipboardString: (window: TWindowPtr) => string;
const getTimerValue: () => number;
const getTimerFrequency: () => number;
const platformWindow: (window: TWindowPtr) => number;
const platformContext: (window: TWindowPtr) => number;
const platformDevice: (window: TWindowPtr) => number;
const getJoystickGUID: (id: number) => (null | string);
const vulkanSupported: () => boolean;
const getRequiredInstanceExtensions: () => string[];
const getInstanceProcAddress: (instance: TVkInstancePtr, name: string) => TVkProcedurePtr;
const getPhysicalDevicePresentationSupport: (
instance: TVkInstancePtr,
physicalDevice: TVkPhysicalDevicePtr,
queueFamily: number,
) => boolean;
const createWindowSurface: (
instance: TVkInstancePtr,
window: TWindowPtr,
allocator: TVkAllocationCallbacksPtr,
) => TVkSurfacePtr;
const vulkanCreateInstance: () => TVkInstancePtr;
const vulkanCreateDevice: () => ({
device: TVkDevicePtr,
physicalDevice: TVkPhysicalDevicePtr,
queueFamily: number,
});
const vulkanDestroyDevice: (instance: TVkInstancePtr, device: TVkDevicePtr) => void;
const vulkanDestroyInstance: (instance: TVkInstancePtr) => void;
const VERSION_MAJOR: number;
const VERSION_MINOR: number;
const VERSION_REVISION: number;
const TRUE: number;
const FALSE: number;
const RELEASE: number;
const PRESS: number;
const REPEAT: number;
const HAT_CENTERED: number;
const HAT_UP: number;
const HAT_RIGHT: number;
const HAT_DOWN: number;
const HAT_LEFT: number;
const HAT_RIGHT_UP: number;
const HAT_RIGHT_DOWN: number;
const HAT_LEFT_UP: number;
const HAT_LEFT_DOWN: number;
const KEY_UNKNOWN: number;
const KEY_SPACE: number;
const KEY_APOSTROPHE: number;
const KEY_COMMA: number;
const KEY_MINUS: number;
const KEY_PERIOD: number;
const KEY_SLASH: number;
const KEY_0: number;
const KEY_1: number;
const KEY_2: number;
const KEY_3: number;
const KEY_4: number;
const KEY_5: number;
const KEY_6: number;
const KEY_7: number;
const KEY_8: number;
const KEY_9: number;
const KEY_SEMICOLON: number;
const KEY_EQUAL: number;
const KEY_A: number;
const KEY_B: number;
const KEY_C: number;
const KEY_D: number;
const KEY_E: number;
const KEY_F: number;
const KEY_G: number;
const KEY_H: number;
const KEY_I: number;
const KEY_J: number;
const KEY_K: number;
const KEY_L: number;
const KEY_M: number;
const KEY_N: number;
const KEY_O: number;
const KEY_P: number;
const KEY_Q: number;
const KEY_R: number;
const KEY_S: number;
const KEY_T: number;
const KEY_U: number;
const KEY_V: number;
const KEY_W: number;
const KEY_X: number;
const KEY_Y: number;
const KEY_Z: number;
const KEY_LEFT_BRACKET: number;
const KEY_BACKSLASH: number;
const KEY_RIGHT_BRACKET: number;
const KEY_GRAVE_ACCENT: number;
const KEY_WORLD_1: number;
const KEY_WORLD_2: number;
const KEY_ESCAPE: number;
const KEY_ENTER: number;
const KEY_TAB: number;
const KEY_BACKSPACE: number;
const KEY_INSERT: number;
const KEY_DELETE: number;
const KEY_RIGHT: number;
const KEY_LEFT: number;
const KEY_DOWN: number;
const KEY_UP: number;
const KEY_PAGE_UP: number;
const KEY_PAGE_DOWN: number;
const KEY_HOME: number;
const KEY_END: number;
const KEY_CAPS_LOCK: number;
const KEY_SCROLL_LOCK: number;
const KEY_NUM_LOCK: number;
const KEY_PRINT_SCREEN: number;
const KEY_PAUSE: number;
const KEY_F1: number;
const KEY_F2: number;
const KEY_F3: number;
const KEY_F4: number;
const KEY_F5: number;
const KEY_F6: number;
const KEY_F7: number;
const KEY_F8: number;
const KEY_F9: number;
const KEY_F10: number;
const KEY_F11: number;
const KEY_F12: number;
const KEY_F13: number;
const KEY_F14: number;
const KEY_F15: number;
const KEY_F16: number;
const KEY_F17: number;
const KEY_F18: number;
const KEY_F19: number;
const KEY_F20: number;
const KEY_F21: number;
const KEY_F22: number;
const KEY_F23: number;
const KEY_F24: number;
const KEY_F25: number;
const KEY_KP_0: number;
const KEY_KP_1: number;
const KEY_KP_2: number;
const KEY_KP_3: number;
const KEY_KP_4: number;
const KEY_KP_5: number;
const KEY_KP_6: number;
const KEY_KP_7: number;
const KEY_KP_8: number;
const KEY_KP_9: number;
const KEY_KP_DECIMAL: number;
const KEY_KP_DIVIDE: number;
const KEY_KP_MULTIPLY: number;
const KEY_KP_SUBTRACT: number;
const KEY_KP_ADD: number;
const KEY_KP_ENTER: number;
const KEY_KP_EQUAL: number;
const KEY_LEFT_SHIFT: number;
const KEY_LEFT_CONTROL: number;
const KEY_LEFT_ALT: number;
const KEY_LEFT_SUPER: number;
const KEY_RIGHT_SHIFT: number;
const KEY_RIGHT_CONTROL: number;
const KEY_RIGHT_ALT: number;
const KEY_RIGHT_SUPER: number;
const KEY_MENU: number;
const KEY_LAST: number;
const MOD_SHIFT: number;
const MOD_CONTROL: number;
const MOD_ALT: number;
const MOD_SUPER: number;
const MOD_CAPS_LOCK: number;
const MOD_NUM_LOCK: number;
const MOUSE_BUTTON_1: number;
const MOUSE_BUTTON_2: number;
const MOUSE_BUTTON_3: number;
const MOUSE_BUTTON_4: number;
const MOUSE_BUTTON_5: number;
const MOUSE_BUTTON_6: number;
const MOUSE_BUTTON_7: number;
const MOUSE_BUTTON_8: number;
const MOUSE_BUTTON_LAST: number;
const MOUSE_BUTTON_LEFT: number;
const MOUSE_BUTTON_RIGHT: number;
const MOUSE_BUTTON_MIDDLE: number;
const JOYSTICK_1: number;
const JOYSTICK_2: number;
const JOYSTICK_3: number;
const JOYSTICK_4: number;
const JOYSTICK_5: number;
const JOYSTICK_6: number;
const JOYSTICK_7: number;
const JOYSTICK_8: number;
const JOYSTICK_9: number;
const JOYSTICK_10: number;
const JOYSTICK_11: number;
const JOYSTICK_12: number;
const JOYSTICK_13: number;
const JOYSTICK_14: number;
const JOYSTICK_15: number;
const JOYSTICK_16: number;
const JOYSTICK_LAST: number;
const GAMEPAD_BUTTON_A: number;
const GAMEPAD_BUTTON_B: number;
const GAMEPAD_BUTTON_X: number;
const GAMEPAD_BUTTON_Y: number;
const GAMEPAD_BUTTON_LEFT_BUMPER: number;
const GAMEPAD_BUTTON_RIGHT_BUMPER: number;
const GAMEPAD_BUTTON_BACK: number;
const GAMEPAD_BUTTON_START: number;
const GAMEPAD_BUTTON_GUIDE: number;
const GAMEPAD_BUTTON_LEFT_THUMB: number;
const GAMEPAD_BUTTON_RIGHT_THUMB: number;
const GAMEPAD_BUTTON_DPAD_UP: number;
const GAMEPAD_BUTTON_DPAD_RIGHT: number;
const GAMEPAD_BUTTON_DPAD_DOWN: number;
const GAMEPAD_BUTTON_DPAD_LEFT: number;
const GAMEPAD_BUTTON_LAST: number;
const GAMEPAD_BUTTON_CROSS: number;
const GAMEPAD_BUTTON_CIRCLE: number;
const GAMEPAD_BUTTON_SQUARE: number;
const GAMEPAD_BUTTON_TRIANGLE: number;
const GAMEPAD_AXIS_LEFT_X: number;
const GAMEPAD_AXIS_LEFT_Y: number;
const GAMEPAD_AXIS_RIGHT_X: number;
const GAMEPAD_AXIS_RIGHT_Y: number;
const GAMEPAD_AXIS_LEFT_TRIGGER: number;
const GAMEPAD_AXIS_RIGHT_TRIGGER: number;
const GAMEPAD_AXIS_LAST: number;
const NO_ERROR: number;
const NOT_INITIALIZED: number;
const NO_CURRENT_CONTEXT: number;
const INVALID_ENUM: number;
const INVALID_VALUE: number;
const OUT_OF_MEMORY: number;
const API_UNAVAILABLE: number;
const VERSION_UNAVAILABLE: number;
const PLATFORM_ERROR: number;
const FORMAT_UNAVAILABLE: number;
const NO_WINDOW_CONTEXT: number;
const CURSOR_UNAVAILABLE: number;
const FEATURE_UNAVAILABLE: number;
const FEATURE_UNIMPLEMENTED: number;
const PLATFORM_UNAVAILABLE: number;
const FOCUSED: number;
const ICONIFIED: number;
const RESIZABLE: number;
const VISIBLE: number;
const DECORATED: number;
const AUTO_ICONIFY: number;
const FLOATING: number;
const MAXIMIZED: number;
const CENTER_CURSOR: number;
const TRANSPARENT_FRAMEBUFFER: number;
const HOVERED: number;
const FOCUS_ON_SHOW: number;
const MOUSE_PASSTHROUGH: number;
const POSITION_X: number;
const POSITION_Y: number;
const RED_BITS: number;
const GREEN_BITS: number;
const BLUE_BITS: number;
const ALPHA_BITS: number;
const DEPTH_BITS: number;
const STENCIL_BITS: number;
const ACCUM_RED_BITS: number;
const ACCUM_GREEN_BITS: number;
const ACCUM_BLUE_BITS: number;
const ACCUM_ALPHA_BITS: number;
const AUX_BUFFERS: number;
const STEREO: number;
const SAMPLES: number;
const SRGB_CAPABLE: number;
const REFRESH_RATE: number;
const DOUBLEBUFFER: number;
const CLIENT_API: number;
const CONTEXT_VERSION_MAJOR: number;
const CONTEXT_VERSION_MINOR: number;
const CONTEXT_REVISION: number;
const CONTEXT_ROBUSTNESS: number;
const OPENGL_FORWARD_COMPAT: number;
const CONTEXT_DEBUG: number;
const OPENGL_DEBUG_CONTEXT: number;
const OPENGL_PROFILE: number;
const CONTEXT_RELEASE_BEHAVIOR: number;
const CONTEXT_NO_ERROR: number;
const CONTEXT_CREATION_API: number;
const SCALE_TO_MONITOR: number;
const SCALE_FRAMEBUFFER: number;
const COCOA_RETINA_FRAMEBUFFER: number;
const COCOA_FRAME_NAME: number;
const COCOA_GRAPHICS_SWITCHING: number;