This repository has been archived by the owner on Dec 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathglfw3.nim
645 lines (420 loc) · 20.1 KB
/
glfw3.nim
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
# GLFW3 Bindings/Wrapper for Nimrod
# Authors: Rafael Vasco, Cory Golden
{.deadCodeElim: on.}
when defined(windows):
const GlfwLib = "glfw3.dll"
elif defined(macosx):
const GlfwLib = "libglfw.3.dylib"
else:
const GlfwLib = "libglfw.so.3"
#[*************************************************************************
* GLFW API tokens
*************************************************************************]#
const
VERSION_MAJOR* = 3
VERSION_MINOR* = 2
VERSION_REVISION* = 0
TRUE* = 1
FALSE* = 0
RELEASE* = 0
PRESS* = 1
REPEAT* = 2
#[ The unknown key ]#
KEY_UNKNOWN* = - 1
#[ Printable keys ]#
KEY_SPACE* = 32
KEY_APOSTROPHE* = 39
KEY_COMMA* = 44
KEY_MINUS* = 45
KEY_PERIOD* = 46
KEY_SLASH* = 47
KEY_0* = 48
KEY_1* = 49
KEY_2* = 50
KEY_3* = 51
KEY_4* = 52
KEY_5* = 53
KEY_6* = 54
KEY_7* = 55
KEY_8* = 56
KEY_9* = 57
KEY_SEMICOLON* = 59
KEY_EQUAL* = 61
KEY_A* = 65
KEY_B* = 66
KEY_C* = 67
KEY_D* = 68
KEY_E* = 69
KEY_F* = 70
KEY_G* = 71
KEY_H* = 72
KEY_I* = 73
KEY_J* = 74
KEY_K* = 75
KEY_L* = 76
KEY_M* = 77
KEY_N* = 78
KEY_O* = 79
KEY_P* = 80
KEY_Q* = 81
KEY_R* = 82
KEY_S* = 83
KEY_T* = 84
KEY_U* = 85
KEY_V* = 86
KEY_W* = 87
KEY_X* = 88
KEY_Y* = 89
KEY_Z* = 90
KEY_LEFT_BRACKET* = 91
KEY_BACKSLASH* = 92
KEY_RIGHT_BRACKET* = 93
KEY_GRAVE_ACCENT* = 96
KEY_WORLD_1* = 161
KEY_WORLD_2* = 162
#[ Function keys ]#
KEY_ESCAPE* = 256
KEY_ENTER* = 257
KEY_TAB* = 258
KEY_BACKSPACE* = 259
KEY_INSERT* = 260
KEY_DELETE* = 261
KEY_RIGHT* = 262
KEY_LEFT* = 263
KEY_DOWN* = 264
KEY_UP* = 265
KEY_PAGE_UP* = 266
KEY_PAGE_DOWN* = 267
KEY_HOME* = 268
KEY_END* = 269
KEY_CAPS_LOCK* = 280
KEY_SCROLL_LOCK* = 281
KEY_NUM_LOCK* = 282
KEY_PRINT_SCREEN* = 283
KEY_PAUSE* = 284
KEY_F1* = 290
KEY_F2* = 291
KEY_F3* = 292
KEY_F4* = 293
KEY_F5* = 294
KEY_F6* = 295
KEY_F7* = 296
KEY_F8* = 297
KEY_F9* = 298
KEY_F10* = 299
KEY_F11* = 300
KEY_F12* = 301
KEY_F13* = 302
KEY_F14* = 303
KEY_F15* = 304
KEY_F16* = 305
KEY_F17* = 306
KEY_F18* = 307
KEY_F19* = 308
KEY_F20* = 309
KEY_F21* = 310
KEY_F22* = 311
KEY_F23* = 312
KEY_F24* = 313
KEY_F25* = 314
KEY_KP_0* = 320
KEY_KP_1* = 321
KEY_KP_2* = 322
KEY_KP_3* = 323
KEY_KP_4* = 324
KEY_KP_5* = 325
KEY_KP_6* = 326
KEY_KP_7* = 327
KEY_KP_8* = 328
KEY_KP_9* = 329
KEY_KP_DECIMAL* = 330
KEY_KP_DIVIDE* = 331
KEY_KP_MULTIPLY* = 332
KEY_KP_SUBTRACT* = 333
KEY_KP_ADD* = 334
KEY_KP_ENTER* = 335
KEY_KP_EQUAL* = 336
KEY_LEFT_SHIFT* = 340
KEY_LEFT_CONTROL* = 341
KEY_LEFT_ALT* = 342
KEY_LEFT_SUPER* = 343
KEY_RIGHT_SHIFT* = 344
KEY_RIGHT_CONTROL* = 345
KEY_RIGHT_ALT* = 346
KEY_RIGHT_SUPER* = 347
KEY_MENU* = 348
KEY_LAST* = KEY_MENU
MOD_SHIFT* = 0x0001
MOD_CONTROL* = 0x0002
MOD_ALT* = 0x0004
MOD_SUPER* = 0x0008
MOUSE_BUTTON_1* = 0
MOUSE_BUTTON_2* = 1
MOUSE_BUTTON_3* = 2
MOUSE_BUTTON_4* = 3
MOUSE_BUTTON_5* = 4
MOUSE_BUTTON_6* = 5
MOUSE_BUTTON_7* = 6
MOUSE_BUTTON_8* = 7
MOUSE_BUTTON_LAST* = MOUSE_BUTTON_8
MOUSE_BUTTON_LEFT* = MOUSE_BUTTON_1
MOUSE_BUTTON_RIGHT* = MOUSE_BUTTON_2
MOUSE_BUTTON_MIDDLE* = MOUSE_BUTTON_3
JOYSTICK_1* = 0
JOYSTICK_2* = 1
JOYSTICK_3* = 2
JOYSTICK_4* = 3
JOYSTICK_5* = 4
JOYSTICK_6* = 5
JOYSTICK_7* = 6
JOYSTICK_8* = 7
JOYSTICK_9* = 8
JOYSTICK_10* = 9
JOYSTICK_11* = 10
JOYSTICK_12* = 11
JOYSTICK_13* = 12
JOYSTICK_14* = 13
JOYSTICK_15* = 14
JOYSTICK_16* = 15
JOYSTICK_LAST* = JOYSTICK_16
NOT_INITIALIZED* = 0x00010001
NO_CURRENT_CONTEXT* = 0x00010002
INVALID_ENUM* = 0x00010003
INVALID_VALUE* = 0x00010004
OUT_OF_MEMORY* = 0x00010005
API_UNAVAILABLE* = 0x00010006
VERSION_UNAVAILABLE* = 0x00010007
PLATFORM_ERROR* = 0x00010008
FORMAT_UNAVAILABLE* = 0x00010009
NO_WINDOW_CONTEXT* = 0x0001000A
FOCUSED* = 0x00020001
ICONIFIED* = 0x00020002
RESIZABLE* = 0x00020003
VISIBLE* = 0x00020004
DECORATED* = 0x00020005
AUTO_ICONIFY* = 0x00020006
FLOATING* = 0x00020007
GLFW_MAXIMIZED* = 0x00020008
RED_BITS* = 0x00021001
GREEN_BITS* = 0x00021002
BLUE_BITS* = 0x00021003
ALPHA_BITS* = 0x00021004
DEPTH_BITS* = 0x00021005
STENCIL_BITS* = 0x00021006
ACCUM_RED_BITS* = 0x00021007
ACCUM_GREEN_BITS* = 0x00021008
ACCUM_BLUE_BITS* = 0x00021009
ACCUM_ALPHA_BITS* = 0x0002100A
AUX_BUFFERS* = 0x0002100B
STEREO* = 0x0002100C
SAMPLES* = 0x0002100D
SRGB_CAPABLE* = 0x0002100E
REFRESH_RATE* = 0x0002100F
DOUBLEBUFFER* = 0x00021010
CLIENT_API* = 0x00022001
CONTEXT_VERSION_MAJOR* = 0x00022002
CONTEXT_VERSION_MINOR* = 0x00022003
CONTEXT_REVISION* = 0x00022004
CONTEXT_ROBUSTNESS* = 0x00022005
OPENGL_FORWARD_COMPAT* = 0x00022006
OPENGL_DEBUG_CONTEXT* = 0x00022007
OPENGL_PROFILE* = 0x00022008
CONTEXT_RELEASE_BEHAVIOR* = 0x00022009
CONTEXT_NO_ERROR* = 0x0002200A
CONTEXT_CREATION_API* = 0x0002200B
NO_API* = 0
OPENGL_API* = 0x00030001
OPENGL_ES_API* = 0x00030002
NO_ROBUSTNESS* = 0
NO_RESET_NOTIFICATION* = 0x00031001
LOSE_CONTEXT_ON_RESET* = 0x00031002
OPENGL_ANY_PROFILE* = 0
OPENGL_CORE_PROFILE* = 0x00032001
OPENGL_COMPAT_PROFILE* = 0x00032002
CURSOR* = 0x00033001
STICKY_KEYS* = 0x00033002
STICKY_MOUSE_BUTTONS* = 0x00033003
CURSOR_NORMAL* = 0x00034001
CURSOR_HIDDEN* = 0x00034002
CURSOR_DISABLED* = 0x00034003
ANY_RELEASE_BEHAVIOR* = 0
RELEASE_BEHAVIOR_FLUSH* = 0x00035001
RELEASE_BEHAVIOR_NONE* = 0x00035002
NATIVE_CONTEXT_API* = 0x00036001
EGL_CONTEXT_API* = 0x00036002
ARROW_CURSOR* = 0x00036001
IBEAM_CURSOR* = 0x00036002
CROSSHAIR_CURSOR* = 0x00036003
HAND_CURSOR* = 0x00036004
HRESIZE_CURSOR* = 0x00036005
VRESIZE_CURSOR* = 0x00036006
CONNECTED* = 0x00040001
DISCONNECTED* = 0x00040002
DONT_CARE* = -1
#[*************************************************************************
* GLFW API types
*************************************************************************]#
type
GLProc* = proc() {.cdecl.}
VKProc* = proc() {.cdecl.}
Monitor* = pointer
Window* = pointer
CursorHandle* = pointer
ErrorFun* = proc (errorCode: cint; description: cstring) {.cdecl.}
WindowPosFun = proc (window: Window; x: cint; y: cint) {.cdecl.}
WindowSizeFun* = proc (window: Window; width: cint; height: cint) {.cdecl.}
WindowCloseFun* = proc (window: Window) {.cdecl.}
WindowRefreshFun* = proc (window: Window) {.cdecl.}
WindowFocusFun* = proc (window: Window; focused: cint) {.cdecl.}
WindowIconifyFun* = proc (window: Window; iconified: cint) {.cdecl.}
FrameBufferSizeFun* = proc (window: Window; width: cint; height: cint) {.cdecl.}
MouseButtonFun* = proc (window: Window; button: cint; action: cint; modifiers: cint) {.cdecl.}
CursorPosFun* = proc (window: Window; x: cdouble; y: cdouble) {.cdecl.}
CursorEnterFun* = proc (window: Window; entered: cint) {.cdecl.}
ScrollFun* = proc (window: Window; xoffset: cdouble; yoffset: cdouble) {.cdecl.}
KeyFun* = proc (window: Window; key: cint; scancode: cint; action: cint; modifiers: cint) {.cdecl.}
CharFun* = proc (window: Window; character: cuint) {.cdecl.}
CharModsFun* = proc (window: Window; codepoint: cuint; mods: cint) {.cdecl.}
DropFun* = proc (window: Window; count: cint; paths: ptr cstring)
MonitorFun* = proc (monitor: Monitor; connected: cint) {.cdecl.}
JoystickFun* = proc (joy : cint; event: cint)
VidMode* {.pure, final.} = object
width*: cint
height*: cint
redBits*: cint
greenBits*: cint
blueBits*: cint
refreshRate*: cint
GammaRamp* {.pure, final.} = object
red*: ptr cushort
green*: ptr cushort
blue*: ptr cushort
size*: cuint
Image* {.pure, final.} = ptr object
width: cint
height: cint
pixels: seq[byte]
# -------------------------------------------------------------------
# Methods
proc Init*(): cint {.cdecl, importc: "glfwInit", dynlib: GlfwLib.}
proc Terminate*() {.cdecl, importc: "glfwTerminate", dynlib: GlfwLib.}
proc GetVersion*(major: ptr cint; minor: ptr cint; rev: ptr cint) {.cdecl, importc: "glfwGetVersion", dynlib: GlfwLib.}
proc GetVersionString*(): cstring {.cdecl, importc: "glfwGetVersionString",dynlib: GlfwLib.}
proc SetErrorCallback*(cbfun: ErrorFun): ErrorFun {.cdecl, importc: "glfwSetErrorCallback", dynlib: GlfwLib.}
proc GetMonitors*(count: ptr cint): ptr Monitor {.cdecl, importc: "glfwGetMonitors", dynlib: GlfwLib.}
proc GetPrimaryMonitor*(): Monitor {.cdecl, importc: "glfwGetPrimaryMonitor", dynlib: GlfwLib.}
proc GetMonitorPos*(monitor: Monitor; xpos: ptr cint; ypos: ptr cint) {.cdecl, importc: "glfwGetMonitorPos", dynlib: GlfwLib.}
proc GetMonitorPhysicalSize*(monitor: Monitor; width: ptr cint; height: ptr cint) {.cdecl, importc: "glfwGetMonitorPhysicalSize", dynlib: GlfwLib.}
proc GetMonitorName*(monitor: Monitor): cstring {.cdecl, importc: "glfwGetMonitorName", dynlib: GlfwLib.}
proc SetMonitorCallback*(cbfun: MonitorFun): MonitorFun {.cdecl, importc: "glfwSetMonitorCallback", dynlib: GlfwLib.}
proc GetVideoModes*(monitor: Monitor; count: ptr cint): ptr VidMode {.cdecl, importc: "glfwGetVideoModes", dynlib: GlfwLib.}
proc GetVideoMode*(monitor: Monitor): ptr VidMode {.cdecl, importc: "glfwGetVideoMode", dynlib: GlfwLib.}
proc SetGamma*(monitor: Monitor; gamma: cfloat) {.cdecl, importc: "glfwSetGamma", dynlib: GlfwLib.}
proc GetGammaRamp*(monitor: Monitor): ptr GammaRamp {.cdecl, importc: "glfwGetGammaRamp", dynlib: GlfwLib.}
proc SetGammaRamp*(monitor: Monitor; ramp: ptr GammaRamp) {.cdecl, importc: "glfwSetGammaRamp", dynlib: GlfwLib.}
proc DefaultWindowHints*() {.cdecl, importc: "glfwDefaultWindowHints", dynlib: GlfwLib.}
proc WindowHint*(target: cint; hint: cint) {.cdecl, importc: "glfwWindowHint", dynlib: GlfwLib.}
proc CreateWindow*(width: cint; height: cint; title: cstring; monitor: Monitor; share: Window): Window{.cdecl, importc: "glfwCreateWindow", dynlib: GlfwLib.}
proc DestroyWindow*(window: Window) {.cdecl, importc: "glfwDestroyWindow", dynlib: GlfwLib.}
proc WindowShouldClose*(window: Window): cint {.cdecl, importc: "glfwWindowShouldClose", dynlib: GlfwLib.}
proc SetWindowShouldClose*(window: Window; value: cint) {.cdecl, importc: "glfwSetWindowShouldClose", dynlib: GlfwLib.}
proc SetWindowTitle*(window: Window; title: cstring) {.cdecl, importc: "glfwSetWindowTitle", dynlib: GlfwLib.}
proc SetWindowIcon*(window: Window; count: cint, image: Image) {.cdecl, importc: "glfwSetWindowIcon", dynlib: GlfwLib.}
proc GetWindowPos*(window: Window; xpos: ptr cint; ypos: ptr cint) {.cdecl, importc: "glfwGetWindowPos", dynlib: GlfwLib.}
proc SetWindowPos*(window: Window; xpos: cint; ypos: cint) {.cdecl, importc: "glfwSetWindowPos", dynlib: GlfwLib.}
proc GetWindowSize*(window: Window; width: ptr cint; height: ptr cint) {.cdecl, importc: "glfwGetWindowSize", dynlib: GlfwLib.}
proc SetWindowSizeLimits*(window: Window, minwidth, minheight, maxwidth, maxheight: cint) {.cdecl, importc: "glfwSetWindowSizeLimits", dynlib: GlfwLib.}
proc SetWindowAspectRatio*(window: Window, numer, denom: cint) {.cdecl, importc: "glfwSetWindowAspectRatio", dynlib: GlfwLib.}
proc SetWindowSize*(window: Window; width: cint; height: cint) {.cdecl, importc: "glfwSetWindowSize", dynlib: GlfwLib.}
proc GetFramebufferSize*(window: Window; width: ptr cint; height: ptr cint) {.cdecl, importc: "glfwGetFramebufferSize", dynlib: GlfwLib.}
proc GetWindowFrameSize*(window: Window, left, top, right, bottom: ptr int) {.cdecl, importc: "glfwGetWindowFrameSize", dynlib: GlfwLib.}
proc IconifyWindow*(window: Window) {.cdecl, importc: "glfwIconifyWindow", dynlib: GlfwLib.}
proc RestoreWindow*(window: Window) {.cdecl, importc: "glfwRestoreWindow", dynlib: GlfwLib.}
proc MaximizeWindow*(window: Window) {.cdecl, importc: "glfwMaximizeWindow", dynlib: GlfwLib.}
proc ShowWindow*(window: Window) {.cdecl, importc: "glfwShowWindow", dynlib: GlfwLib.}
proc HideWindow*(window: Window) {.cdecl, importc: "glfwHideWindow", dynlib: GlfwLib.}
proc FocusWindow*(window: Window) {.cdecl, importc: "glfwFocusWindow", dynlib: GlfwLib.}
proc GetWindowMonitor*(window: Window): Monitor {.cdecl, importc: "glfwGetWindowMonitor", dynlib: GlfwLib.}
proc SetWindowMonitor*(window: Window, monitor: Monitor, xpos, ypos, width, height: cint) {.cdecl, importc: "glfwSetWindowMonitor", dynlib: GlfwLib.}
proc GetWindowAttrib*(window: Window; attrib: cint): cint {.cdecl, importc: "glfwGetWindowAttrib", dynlib: GlfwLib.}
proc SetWindowUserPointer*(window: Window; pointer: pointer) {.cdecl, importc: "glfwSetWindowUserPointer", dynlib: GlfwLib.}
proc GetWindowUserPointer*(window: Window): pointer {.cdecl, importc: "glfwGetWindowUserPointer", dynlib: GlfwLib.}
proc SetWindowPosCallback*(window: Window; cbfun: WindowPosFun): WindowPosFun {.cdecl, importc: "glfwSetWindowPosCallback", dynlib: GlfwLib.}
proc SetWindowSizeCallback*(window: Window; cbfun: WindowSizeFun): WindowSizeFun {.cdecl, importc: "glfwSetWindowSizeCallback", dynlib: GlfwLib.}
proc SetWindowCloseCallback*(window: Window; cbfun: WindowCloseFun): WindowCloseFun {.cdecl, importc: "glfwSetWindowCloseCallback", dynlib: GlfwLib.}
proc SetWindowRefreshCallback*(window: Window; cbfun: Windowrefreshfun): Windowrefreshfun {.cdecl, importc: "glfwSetWindowRefreshCallback", dynlib: GlfwLib.}
proc SetWindowFocusCallback*(window: Window; cbfun: WindowFocusFun): WindowFocusFun {.cdecl, importc: "glfwSetWindowFocusCallback", dynlib: GlfwLib.}
proc SetWindowIconifyCallback*(window: Window; cbfun: WindowIconifyFun): WindowIconifyFun {.cdecl, importc: "glfwSetWindowIconifyCallback", dynlib: GlfwLib.}
proc SetFramebufferSizeCallback*(window: Window; cbfun: FrameBufferSizeFun): FrameBufferSizeFun {.cdecl, importc: "glfwSetFramebufferSizeCallback", dynlib: GlfwLib.}
proc PollEvents*() {.cdecl, importc: "glfwPollEvents", dynlib: GlfwLib.}
proc WaitEvents*() {.cdecl, importc: "glfwWaitEvents", dynlib: GlfwLib.}
proc WaitEventsTimeout*(timeout: cdouble) {.cdecl, importc: "glfwWaitEventsTimeout", dynlib: GlfwLib.}
proc PostEmptyEvent*() {.cdecl, importc: "glfwPostEmptyEvent", dynlib: GlfwLib.}
proc GetInputMode*(window: Window; mode: cint): cint {.cdecl, importc: "glfwGetInputMode", dynlib: GlfwLib.}
proc SetInputMode*(window: Window; mode: cint; value: cint) {.cdecl, importc: "glfwSetInputMode", dynlib: GlfwLib.}
proc GetKey*(window: Window; key: cint): cint {.cdecl, importc: "glfwGetKey", dynlib: GlfwLib.}
proc GetMouseButton*(window: Window; button: cint): cint {.cdecl, importc: "glfwGetMouseButton", dynlib: GlfwLib.}
proc GetCursorPos*(window: Window; xpos: ptr cdouble; ypos: ptr cdouble) {.cdecl, importc: "glfwGetCursorPos", dynlib: GlfwLib.}
proc SetCursorPos*(window: Window; xpos: cdouble; ypos: cdouble) {.cdecl, importc: "glfwSetCursorPos", dynlib: GlfwLib.}
proc CreateCursor*(image: Image, xhot, yhot: cint): CursorHandle {.cdecl, importc: "glfwCreateCursor", dynlib: GlfwLib.}
proc CreateStandardCursor*(shape: cint): CursorHandle {.cdecl, importc: "glfwCreateStandardCursor", dynlib: GlfwLib.}
proc DestroyCursor*(cusor: CursorHandle) {.cdecl, importc: "glfwDestroyCursor", dynlib: GlfwLib.}
proc SetCursor*(window: Window; cursor: CursorHandle) {.cdecl, importc: "glfwSetCursor", dynlib: GlfwLib.}
proc SetKeyCallback*(window: Window; cbfun: KeyFun): KeyFun {.cdecl, importc: "glfwSetKeyCallback", dynlib: GlfwLib.}
proc SetCharCallback*(window: Window; cbfun: CharFun): CharFun {.cdecl, importc: "glfwSetCharCallback", dynlib: GlfwLib.}
proc SetCharModsCallback*(window: Window, cbfun: CharModsFun): CharModsFun {.cdecl, importc: "glfwSetCharModsCallback", dynlib: GlfwLib.}
proc SetMouseButtonCallback*(window: Window; cbfun: MouseButtonFun): MouseButtonFun {.cdecl, importc: "glfwSetMouseButtonCallback", dynlib: GlfwLib.}
proc SetCursorPosCallback*(window: Window; cbfun: CursorPosFun): CursorPosFun {.cdecl, importc: "glfwSetCursorPosCallback", dynlib: GlfwLib.}
proc SetCursorEnterCallback*(window: Window; cbfun: CursorEnterFun): CursorEnterFun {.cdecl, importc: "glfwSetCursorEnterCallback", dynlib: GlfwLib.}
proc SetScrollCallback*(window: Window; cbfun: ScrollFun): ScrollFun {.cdecl, importc: "glfwSetScrollCallback", dynlib: GlfwLib.}
proc SetDropCallback*(window: Window, cbfun: DropFun) {.cdecl, importc: "glfwSetDropCallback", dynlib: GlfwLib.}
proc JoystickPresent*(joy: cint): cint {.cdecl, importc: "glfwJoystickPresent", dynlib: GlfwLib.}
proc GetJoystickAxes*(joy: cint; count: ptr cint): ptr cfloat {.cdecl, importc: "glfwGetJoystickAxes", dynlib: GlfwLib.}
proc GetJoystickButtons*(joy: cint; count: ptr cint): ptr cuchar {.cdecl, importc: "glfwGetJoystickButtons", dynlib: GlfwLib.}
proc GetJoystickName*(joy: cint): cstring {.cdecl, importc: "glfwGetJoystickName", dynlib: GlfwLib.}
proc SetJoystickCallback*(cbfun: JoystickFun): JoystickFun {.cdecl, importc: "glfwSetJoystickCallback", dynlib: GlfwLib.}
proc SetClipboardString*(window: Window; string: cstring) {.cdecl, importc: "glfwSetClipboardString", dynlib: GlfwLib.}
proc GetClipboardString*(window: Window): cstring {.cdecl, importc: "glfwGetClipboardString", dynlib: GlfwLib.}
proc GetTime*(): cdouble {.cdecl, importc: "glfwGetTime", dynlib: GlfwLib.}
proc SetTime*(time: cdouble) {.cdecl, importc: "glfwSetTime", dynlib: GlfwLib.}
proc GetTimerValue*(): culonglong {.cdecl, importc: "glfwGetTimerValue", dynlib: GlfwLib.}
proc GetTimerFrequency*(): culonglong {.cdecl, importc: "glfwGetTimerFrequency", dynlib: GlfwLib.}
proc MakeContextCurrent*(window: Window) {.cdecl, importc: "glfwMakeContextCurrent", dynlib: GlfwLib.}
proc GetCurrentContext*(): Window {.cdecl, importc: "glfwGetCurrentContext", dynlib: GlfwLib.}
proc SwapBuffers*(window: Window) {.cdecl, importc: "glfwSwapBuffers", dynlib: GlfwLib.}
proc SwapInterval*(interval: cint) {.cdecl, importc: "glfwSwapInterval", dynlib: GlfwLib.}
proc ExtensionSupported*(extension: cstring): cint {.cdecl, importc: "glfwExtensionSupported", dynlib: GlfwLib.}
proc GetProcAddress*(procname: cstring): GLProc {.cdecl, importc: "glfwGetProcAddress", dynlib: GlfwLib.}
proc VulkanSupported*(): cint {.cdecl, importc: "glfwVulkanSupported", dynlib: GlfwLib.}
proc GetRequiredInstanceExtensions*(count: ptr cuint): ptr cstring {.cdecl, importc: "glfwGetRequiredInstanceExtensions", dynlib: GlfwLib.}
when not defined(VkInstance):
type VkInstance* = pointer
when not defined(VkPhysicalDevice):
type VkPhysicalDevice* = pointer
when not defined(VkAllocationCallbacks):
type VkAllocationCallbacks* = pointer
when not defined(VkSurfaceKHR):
type VkSurfaceKHR* = pointer
when not defined(VkResult):
type VkResult* = enum
VK_ERROR_FRAGMENTED_POOL = -12
VK_ERROR_FORMAT_NOT_SUPPORTED = -11
VK_ERROR_TOO_MANY_OBJECTS = -10
VK_ERROR_INCOMPATIBLE_DRIVER = -9
VK_ERROR_FEATURE_NOT_PRESENT = -8
VK_ERROR_EXTENSION_NOT_PRESENT = -7
VK_ERROR_LAYER_NOT_PRESENT = -6
VK_ERROR_MEMORY_MAP_FAILED = -5
VK_ERROR_DEVICE_LOST = -4
VK_ERROR_INITIALIZATION_FAILED = -3
VK_ERROR_OUT_OF_DEVICE_MEMORY = -2
VK_ERROR_OUT_OF_HOST_MEMORY = -1
VK_SUCCESS = 0
VK_NOT_READY = 1
VK_TIMEOUT = 2
VK_EVENT_SET = 3
VK_EVENT_RESET = 4
VK_INCOMPLETE = 5
proc GetInstanceProcAddress*(instance: VkInstance, procname: cstring): VKProc {.cdecl, importc: "glfwGetInstanceProcAddress", dynlib: GlfwLib.}
proc GetPhysicalDevicePresentationSupport*(instance: VkInstance, device: VkPhysicalDevice, queuefamily: cuint): cint {.cdecl, importc: "glfwGetPhysicalDevicePresentationSupport", dynlib: GlfwLib.}
proc CreateWindowSurface*(instance: VkInstance, window: Window, allocator: ptr VkAllocationCallbacks, surface: ptr VkSurfaceKHR): VkResult {.cdecl, importc: "glfwCreateWindowSurface", dynlib: GlfwLib.}