generated from jyapayne/nimterop-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglfw_standalone.nim
4540 lines (4530 loc) · 184 KB
/
glfw_standalone.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
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
# Warning: Note that this file is experimental. It was generated on a 64 bit macOS Mojave laptop.
# As a result, there may be platform specific code for other platforms that was not generated.
#
# This file is produced as a courtesy to those who do not want to use nimterop or to those
# who want a faster build.
#
# To link statically, compile with `-d:glfwStatic -passL:"/path/to/static/lib"`, otherwise
# dynamic linking will be used (`-lglfw`)
{.push hint[ConvFromXtoItselfNotNeeded]: off.}
{.experimental: "codeReordering".}
when defined(macosx):
when defined(glfwStatic):
{.passL: "-m64 -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -framework Carbon -framework CoreAudio -lm -pthread".}
else:
{.passL: "-lglfw -m64 -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -framework Carbon -framework CoreAudio -lm -pthread".}
else:
when defined(glfwStatic):
{.passL: "-pthread".}
else:
{.passL: "-lglfw -pthread".}
const
VERSION_MAJOR* = 3
VERSION_MINOR* = 4
VERSION_REVISION* = 0
TRUE* = 1
FALSE* = 0
RELEASE* = 0
PRESS* = 1
REPEAT* = 2
HAT_CENTERED* = 0
HAT_UP* = 1
HAT_RIGHT* = 2
HAT_DOWN* = 4
HAT_LEFT* = 8
HAT_RIGHT_UP* = (HAT_RIGHT or HAT_UP)
HAT_RIGHT_DOWN* = (HAT_RIGHT or HAT_DOWN)
HAT_LEFT_UP* = (HAT_LEFT or HAT_UP)
HAT_LEFT_DOWN* = (HAT_LEFT or HAT_DOWN)
KEY_UNKNOWN* = -1
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
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
MOD_SHIFT* = 0x00000001
MOD_CONTROL* = 0x00000002
MOD_ALT* = 0x00000004
MOD_SUPER* = 0x00000008
MOD_CAPS_LOCK* = 0x00000010
MOD_NUM_LOCK* = 0x00000020
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
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
GAMEPAD_BUTTON_A* = 0
GAMEPAD_BUTTON_B* = 1
GAMEPAD_BUTTON_X* = 2
GAMEPAD_BUTTON_Y* = 3
GAMEPAD_BUTTON_LEFT_BUMPER* = 4
GAMEPAD_BUTTON_RIGHT_BUMPER* = 5
GAMEPAD_BUTTON_BACK* = 6
GAMEPAD_BUTTON_START* = 7
GAMEPAD_BUTTON_GUIDE* = 8
GAMEPAD_BUTTON_LEFT_THUMB* = 9
GAMEPAD_BUTTON_RIGHT_THUMB* = 10
GAMEPAD_BUTTON_DPAD_UP* = 11
GAMEPAD_BUTTON_DPAD_RIGHT* = 12
GAMEPAD_BUTTON_DPAD_DOWN* = 13
GAMEPAD_BUTTON_DPAD_LEFT* = 14
GAMEPAD_AXIS_LEFT_X* = 0
GAMEPAD_AXIS_LEFT_Y* = 1
GAMEPAD_AXIS_RIGHT_X* = 2
GAMEPAD_AXIS_RIGHT_Y* = 3
GAMEPAD_AXIS_LEFT_TRIGGER* = 4
GAMEPAD_AXIS_RIGHT_TRIGGER* = 5
NO_ERROR* = 0
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
CURSOR_UNAVAILABLE* = 0x0001000B
FEATURE_UNAVAILABLE* = 0x0001000C
FEATURE_UNIMPLEMENTED* = 0x0001000D
FOCUSED* = 0x00020001
ICONIFIED* = 0x00020002
RESIZABLE* = 0x00020003
VISIBLE* = 0x00020004
DECORATED* = 0x00020005
AUTO_ICONIFY* = 0x00020006
FLOATING* = 0x00020007
MAXIMIZED* = 0x00020008
CENTER_CURSOR* = 0x00020009
TRANSPARENT_FRAMEBUFFER* = 0x0002000A
HOVERED* = 0x0002000B
FOCUS_ON_SHOW* = 0x0002000C
MOUSE_PASSTHROUGH* = 0x0002000D
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
CONTEXT_DEBUG* = 0x00022007
OPENGL_PROFILE* = 0x00022008
CONTEXT_RELEASE_BEHAVIOR* = 0x00022009
CONTEXT_NO_ERROR* = 0x0002200A
CONTEXT_CREATION_API* = 0x0002200B
SCALE_TO_MONITOR* = 0x0002200C
COCOA_RETINA_FRAMEBUFFER* = 0x00023001
COCOA_FRAME_NAME* = 0x00023002
COCOA_GRAPHICS_SWITCHING* = 0x00023003
X11_CLASS_NAME* = 0x00024001
X11_INSTANCE_NAME* = 0x00024002
WIN32_KEYBOARD_MENU* = 0x00025001
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
INPUT_MODE_CURSOR* = 0x00033001
STICKY_KEYS* = 0x00033002
STICKY_MOUSE_BUTTONS* = 0x00033003
LOCK_KEY_MODS* = 0x00033004
RAW_MOUSE_MOTION* = 0x00033005
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
OSMESA_CONTEXT_API* = 0x00036003
ANGLE_PLATFORM_TYPE_NONE* = 0x00037001
ANGLE_PLATFORM_TYPE_OPENGL* = 0x00037002
ANGLE_PLATFORM_TYPE_OPENGLES* = 0x00037003
ANGLE_PLATFORM_TYPE_D3D9* = 0x00037004
ANGLE_PLATFORM_TYPE_D3D11* = 0x00037005
ANGLE_PLATFORM_TYPE_VULKAN* = 0x00037007
ANGLE_PLATFORM_TYPE_METAL* = 0x00037008
ARROW_CURSOR* = 0x00036001
IBEAM_CURSOR* = 0x00036002
CROSSHAIR_CURSOR* = 0x00036003
POINTING_HAND_CURSOR* = 0x00036004
RESIZE_EW_CURSOR* = 0x00036005
RESIZE_NS_CURSOR* = 0x00036006
RESIZE_NWSE_CURSOR* = 0x00036007
RESIZE_NESW_CURSOR* = 0x00036008
RESIZE_ALL_CURSOR* = 0x00036009
NOT_ALLOWED_CURSOR* = 0x0003600A
CONNECTED* = 0x00040001
DISCONNECTED* = 0x00040002
JOYSTICK_HAT_BUTTONS* = 0x00050001
ANGLE_PLATFORM_TYPE* = 0x00050002
COCOA_CHDIR_RESOURCES* = 0x00051001
COCOA_MENUBAR* = 0x00051002
DONT_CARE* = -1
type
Glproc* = proc () {.cdecl.}
Vkproc* = proc () {.cdecl.}
Monitor* {.incompleteStruct.} = object
Window* {.incompleteStruct.} = object
Cursor* {.incompleteStruct.} = object
Errorfun* = proc (a1: cint; a2: cstring) {.cdecl.}
Windowposfun* = proc (a1: ptr Window; a2: cint; a3: cint) {.cdecl.}
Windowsizefun* = proc (a1: ptr Window; a2: cint; a3: cint) {.cdecl.}
Windowclosefun* = proc (a1: ptr Window) {.cdecl.}
Windowrefreshfun* = proc (a1: ptr Window) {.cdecl.}
Windowfocusfun* = proc (a1: ptr Window; a2: cint) {.cdecl.}
Windowiconifyfun* = proc (a1: ptr Window; a2: cint) {.cdecl.}
Windowmaximizefun* = proc (a1: ptr Window; a2: cint) {.cdecl.}
Framebuffersizefun* = proc (a1: ptr Window; a2: cint; a3: cint) {.cdecl.}
Windowcontentscalefun* = proc (a1: ptr Window; a2: cfloat; a3: cfloat) {.cdecl.}
Mousebuttonfun* = proc (a1: ptr Window; a2: cint; a3: cint; a4: cint) {.cdecl.}
Cursorposfun* = proc (a1: ptr Window; a2: cdouble; a3: cdouble) {.cdecl.}
Cursorenterfun* = proc (a1: ptr Window; a2: cint) {.cdecl.}
Scrollfun* = proc (a1: ptr Window; a2: cdouble; a3: cdouble) {.cdecl.}
Keyfun* = proc (a1: ptr Window; a2: cint; a3: cint; a4: cint; a5: cint) {.cdecl.}
Charfun* = proc (a1: ptr Window; a2: cuint) {.cdecl.}
Charmodsfun* = proc (a1: ptr Window; a2: cuint; a3: cint) {.cdecl.}
Dropfun* = proc (a1: ptr Window; a2: cint; a3: cstring) {.cdecl.}
Monitorfun* = proc (a1: ptr Monitor; a2: cint) {.cdecl.}
Joystickfun* = proc (a1: cint; a2: cint) {.cdecl.}
Vidmode* {.bycopy.} = object ## ```
## ! @brief Video mode type.
##
## This describes a single video mode.
##
## @sa @ref monitor_modes
## @sa @ref glfwGetVideoMode
## @sa @ref glfwGetVideoModes
##
## @since Added in version 1.0.
## @glfw3 Added refresh rate member.
##
## @ingroup monitor
## ```
width*: cint ## ```
## ! The width, in screen coordinates, of the video mode.
## ```
height*: cint ## ```
## ! The height, in screen coordinates, of the video mode.
## ```
redBits*: cint ## ```
## ! The bit depth of the red channel of the video mode.
## ```
greenBits*: cint ## ```
## ! The bit depth of the green channel of the video mode.
## ```
blueBits*: cint ## ```
## ! The bit depth of the blue channel of the video mode.
## ```
refreshRate*: cint ## ```
## ! The refresh rate, in Hz, of the video mode.
## ```
Gammaramp* {.bycopy.} = object ## ```
## ! @brief Gamma ramp.
##
## This describes the gamma ramp for a monitor.
##
## @sa @ref monitor_gamma
## @sa @ref glfwGetGammaRamp
## @sa @ref glfwSetGammaRamp
##
## @since Added in version 3.0.
##
## @ingroup monitor
## ```
red*: ptr cushort ## ```
## ! An array of value describing the response of the red channel.
## ```
green*: ptr cushort ## ```
## ! An array of value describing the response of the green channel.
## ```
blue*: ptr cushort ## ```
## ! An array of value describing the response of the blue channel.
## ```
size*: cuint ## ```
## ! The number of elements in each array.
## ```
Image* {.bycopy.} = object ## ```
## ! @brief Image data.
##
## This describes a single 2D image. See the documentation for each related
## function what the expected pixel format is.
##
## @sa @ref cursor_custom
## @sa @ref window_icon
##
## @since Added in version 2.1.
## @glfw3 Removed format and bytes-per-pixel members.
##
## @ingroup window
## ```
width*: cint ## ```
## ! The width, in pixels, of this image.
## ```
height*: cint ## ```
## ! The height, in pixels, of this image.
## ```
pixels*: ptr cuchar ## ```
## ! The pixel data of this image, arranged left-to-right, top-to-bottom.
## ```
Gamepadstate* {.bycopy.} = object ## ```
## ! @brief Gamepad input state
##
## This describes the input state of a gamepad.
##
## @sa @ref gamepad
## @sa @ref glfwGetGamepadState
##
## @since Added in version 3.3.
##
## @ingroup input
## ```
buttons*: array[15, cuchar] ## ```
## ! The states of each [gamepad button](@ref gamepad_buttons), GLFW_PRESS
## or GLFW_RELEASE.
## ```
axes*: array[6, cfloat] ## ```
## ! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
## to 1.0 inclusive.
## ```
proc init*(): cint {.importc: "glfwInit", cdecl.}
## ```
## **********************************************************************
## GLFW API functions
## **********************************************************************
## ! @brief Initializes the GLFW library.
##
## This function initializes the GLFW library. Before most GLFW functions can
## be used, GLFW must be initialized, and before an application terminates GLFW
## should be terminated in order to free any resources allocated during or
## after initialization.
##
## If this function fails, it calls @ref glfwTerminate before returning. If it
## succeeds, you should call @ref glfwTerminate before the application exits.
##
## Additional calls to this function after successful initialization but before
## termination will return GLFW_TRUE immediately.
##
## @return GLFW_TRUE if successful, or GLFW_FALSE if an
## [error](@ref error_handling) occurred.
##
## @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
##
## @remark @macos This function will change the current directory of the
## application to the Contents/Resources subdirectory of the application's
## bundle, if present. This can be disabled with the @ref
## GLFW_COCOA_CHDIR_RESOURCES init hint.
##
## @remark @macos This function will create the main menu and dock icon for the
## application. If GLFW finds a MainMenu.nib it is loaded and assumed to
## contain a menu bar. Otherwise a minimal menu bar is created manually with
## common commands like Hide, Quit and About. The About entry opens a minimal
## about dialog with information from the application's bundle. The menu bar
## and dock icon can be disabled entirely with the @ref GLFW_COCOA_MENUBAR init
## hint.
##
## @remark @x11 This function will set the LC_CTYPE category of the
## application locale according to the current environment if that category is
## still "C". This is because the "C" locale breaks Unicode text input.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa @ref intro_init
## @sa @ref glfwTerminate
##
## @since Added in version 1.0.
##
## @ingroup init
## ```
proc terminate*() {.importc: "glfwTerminate", cdecl.}
## ```
## ! @brief Terminates the GLFW library.
##
## This function destroys all remaining windows and cursors, restores any
## modified gamma ramps and frees any other allocated resources. Once this
## function is called, you must again call @ref glfwInit successfully before
## you will be able to use most GLFW functions.
##
## If GLFW has been successfully initialized, this function should be called
## before the application exits. If initialization fails, there is no need to
## call this function, as it is called by @ref glfwInit before it returns
## failure.
##
## This function has no effect if GLFW is not initialized.
##
## @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
##
## @remark This function may be called before @ref glfwInit.
##
## @warning The contexts of any remaining windows must not be current on any
## other thread when this function is called.
##
## @reentrancy This function must not be called from a callback.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa @ref intro_init
## @sa @ref glfwInit
##
## @since Added in version 1.0.
##
## @ingroup init
## ```
proc initHint*(hint: cint; value: cint) {.importc: "glfwInitHint", cdecl.}
## ```
## ! @brief Sets the specified init hint to the desired value.
##
## This function sets hints for the next initialization of GLFW.
##
## The values you set hints to are never reset by GLFW, but they only take
## effect during initialization. Once GLFW has been initialized, any values
## you set will be ignored until the library is terminated and initialized
## again.
##
## Some hints are platform specific. These may be set on any platform but they
## will only affect their specific platform. Other platforms will ignore them.
## Setting these hints requires no platform specific headers or functions.
##
## @param[in] hint The [init hint](@ref init_hints) to set.
## @param[in] value The new value of the init hint.
##
## @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref
## GLFW_INVALID_VALUE.
##
## @remarks This function may be called before @ref glfwInit.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa init_hints
## @sa glfwInit
##
## @since Added in version 3.3.
##
## @ingroup init
## ```
proc getVersion*(major: ptr cint; minor: ptr cint; rev: ptr cint) {.
importc: "glfwGetVersion", cdecl.}
## ```
## ! @brief Retrieves the version of the GLFW library.
##
## This function retrieves the major, minor and revision numbers of the GLFW
## library. It is intended for when you are using GLFW as a shared library and
## want to ensure that you are using the minimum required version.
##
## Any or all of the version arguments may be NULL.
##
## @param[out] major Where to store the major version number, or NULL.
## @param[out] minor Where to store the minor version number, or NULL.
## @param[out] rev Where to store the revision number, or NULL.
##
## @errors None.
##
## @remark This function may be called before @ref glfwInit.
##
## @thread_safety This function may be called from any thread.
##
## @sa @ref intro_version
## @sa @ref glfwGetVersionString
##
## @since Added in version 1.0.
##
## @ingroup init
## ```
proc getVersionString*(): cstring {.importc: "glfwGetVersionString", cdecl.}
## ```
## ! @brief Returns a string describing the compile-time configuration.
##
## This function returns the compile-time generated
## [version string](@ref intro_version_string) of the GLFW library binary. It
## describes the version, platform, compiler and any platform-specific
## compile-time options. It should not be confused with the OpenGL or OpenGL
## ES version string, queried with glGetString.
##
## __Do not use the version string__ to parse the GLFW library version. The
## @ref glfwGetVersion function provides the version of the running library
## binary in numerical format.
##
## @return The ASCII encoded GLFW version string.
##
## @errors None.
##
## @remark This function may be called before @ref glfwInit.
##
## @pointer_lifetime The returned string is static and compile-time generated.
##
## @thread_safety This function may be called from any thread.
##
## @sa @ref intro_version
## @sa @ref glfwGetVersion
##
## @since Added in version 3.0.
##
## @ingroup init
## ```
proc getError*(description: ptr cstring): cint {.importc: "glfwGetError", cdecl.}
## ```
## ! @brief Returns and clears the last error for the calling thread.
##
## This function returns and clears the [error code](@ref errors) of the last
## error that occurred on the calling thread, and optionally a UTF-8 encoded
## human-readable description of it. If no error has occurred since the last
## call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is
## set to NULL.
##
## @param[in] description Where to store the error description pointer, or NULL.
## @return The last error code for the calling thread, or @ref GLFW_NO_ERROR
## (zero).
##
## @errors None.
##
## @pointer_lifetime The returned string is allocated and freed by GLFW. You
## should not free it yourself. It is guaranteed to be valid only until the
## next error occurs or the library is terminated.
##
## @remark This function may be called before @ref glfwInit.
##
## @thread_safety This function may be called from any thread.
##
## @sa @ref error_handling
## @sa @ref glfwSetErrorCallback
##
## @since Added in version 3.3.
##
## @ingroup init
## ```
proc setErrorCallback*(callback: Errorfun): Errorfun {.
importc: "glfwSetErrorCallback", cdecl.}
## ```
## ! @brief Sets the error callback.
##
## This function sets the error callback, which is called with an error code
## and a human-readable description each time a GLFW error occurs.
##
## The error code is set before the callback is called. Calling @ref
## glfwGetError from the error callback will return the same value as the error
## code argument.
##
## The error callback is called on the thread where the error occurred. If you
## are using GLFW from multiple threads, your error callback needs to be
## written accordingly.
##
## Because the description string may have been generated specifically for that
## error, it is not guaranteed to be valid after the callback has returned. If
## you wish to use it after the callback returns, you need to make a copy.
##
## Once set, the error callback remains set even after the library has been
## terminated.
##
## @param[in] callback The new callback, or NULL to remove the currently set
## callback.
## @return The previously set callback, or NULL if no callback was set.
##
## @callback_signature
## @code
## void callback_name(int error_code, const char* description)
## @endcode
## For more information about the callback parameters, see the
## [callback pointer type](@ref GLFWerrorfun).
##
## @errors None.
##
## @remark This function may be called before @ref glfwInit.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa @ref error_handling
## @sa @ref glfwGetError
##
## @since Added in version 3.0.
##
## @ingroup init
## ```
proc getMonitors*(count: ptr cint): ptr ptr Monitor {.importc: "glfwGetMonitors", cdecl.}
## ```
## ! @brief Returns the currently connected monitors.
##
## This function returns an array of handles for all currently connected
## monitors. The primary monitor is always first in the returned array. If no
## monitors were found, this function returns NULL.
##
## @param[out] count Where to store the number of monitors in the returned
## array. This is set to zero if an error occurred.
## @return An array of monitor handles, or NULL if no monitors were found or
## if an [error](@ref error_handling) occurred.
##
## @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
##
## @pointer_lifetime The returned array is allocated and freed by GLFW. You
## should not free it yourself. It is guaranteed to be valid only until the
## monitor configuration changes or the library is terminated.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa @ref monitor_monitors
## @sa @ref monitor_event
## @sa @ref glfwGetPrimaryMonitor
##
## @since Added in version 3.0.
##
## @ingroup monitor
## ```
proc getPrimaryMonitor*(): ptr Monitor {.importc: "glfwGetPrimaryMonitor", cdecl.}
## ```
## ! @brief Returns the primary monitor.
##
## This function returns the primary monitor. This is usually the monitor
## where elements like the task bar or global menu bar are located.
##
## @return The primary monitor, or NULL if no monitors were found or if an
## [error](@ref error_handling) occurred.
##
## @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
##
## @thread_safety This function must only be called from the main thread.
##
## @remark The primary monitor is always first in the array returned by @ref
## glfwGetMonitors.
##
## @sa @ref monitor_monitors
## @sa @ref glfwGetMonitors
##
## @since Added in version 3.0.
##
## @ingroup monitor
## ```
proc getMonitorPos*(monitor: ptr Monitor; xpos: ptr cint; ypos: ptr cint) {.
importc: "glfwGetMonitorPos", cdecl.}
## ```
## ! @brief Returns the position of the monitor's viewport on the virtual screen.
##
## This function returns the position, in screen coordinates, of the upper-left
## corner of the specified monitor.
##
## Any or all of the position arguments may be NULL. If an error occurs, all
## non-NULL position arguments will be set to zero.
##
## @param[in] monitor The monitor to query.
## @param[out] xpos Where to store the monitor x-coordinate, or NULL.
## @param[out] ypos Where to store the monitor y-coordinate, or NULL.
##
## @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
## GLFW_PLATFORM_ERROR.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa @ref monitor_properties
##
## @since Added in version 3.0.
##
## @ingroup monitor
## ```
proc getMonitorWorkarea*(monitor: ptr Monitor; xpos: ptr cint; ypos: ptr cint;
width: ptr cint; height: ptr cint) {.
importc: "glfwGetMonitorWorkarea", cdecl.}
## ```
## ! @brief Retrieves the work area of the monitor.
##
## This function returns the position, in screen coordinates, of the upper-left
## corner of the work area of the specified monitor along with the work area
## size in screen coordinates. The work area is defined as the area of the
## monitor not occluded by the operating system task bar where present. If no
## task bar exists then the work area is the monitor resolution in screen
## coordinates.
##
## Any or all of the position and size arguments may be NULL. If an error
## occurs, all non-NULL position and size arguments will be set to zero.
##
## @param[in] monitor The monitor to query.
## @param[out] xpos Where to store the monitor x-coordinate, or NULL.
## @param[out] ypos Where to store the monitor y-coordinate, or NULL.
## @param[out] width Where to store the monitor width, or NULL.
## @param[out] height Where to store the monitor height, or NULL.
##
## @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
## GLFW_PLATFORM_ERROR.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa @ref monitor_workarea
##
## @since Added in version 3.3.
##
## @ingroup monitor
## ```
proc getMonitorPhysicalSize*(monitor: ptr Monitor; widthMM: ptr cint;
heightMM: ptr cint) {.
importc: "glfwGetMonitorPhysicalSize", cdecl.}
## ```
## ! @brief Returns the physical size of the monitor.
##
## This function returns the size, in millimetres, of the display area of the
## specified monitor.
##
## Some systems do not provide accurate monitor size information, either
## because the monitor
## [EDID](https:en.wikipedia.org/wiki/Extended_display_identification_data)
## data is incorrect or because the driver does not report it accurately.
##
## Any or all of the size arguments may be NULL. If an error occurs, all
## non-NULL size arguments will be set to zero.
##
## @param[in] monitor The monitor to query.
## @param[out] widthMM Where to store the width, in millimetres, of the
## monitor's display area, or NULL.
## @param[out] heightMM Where to store the height, in millimetres, of the
## monitor's display area, or NULL.
##
## @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
##
## @remark @win32 calculates the returned physical size from the
## current resolution and system DPI instead of querying the monitor EDID data.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa @ref monitor_properties
##
## @since Added in version 3.0.
##
## @ingroup monitor
## ```
proc getMonitorContentScale*(monitor: ptr Monitor; xscale: ptr cfloat;
yscale: ptr cfloat) {.
importc: "glfwGetMonitorContentScale", cdecl.}
## ```
## ! @brief Retrieves the content scale for the specified monitor.
##
## This function retrieves the content scale for the specified monitor. The
## content scale is the ratio between the current DPI and the platform's
## default DPI. This is especially important for text and any UI elements. If
## the pixel dimensions of your UI scaled by this look appropriate on your
## machine then it should appear at a reasonable size on other machines
## regardless of their DPI and scaling settings. This relies on the system DPI
## and scaling settings being somewhat correct.
##
## The content scale may depend on both the monitor resolution and pixel
## density and on user settings. It may be very different from the raw DPI
## calculated from the physical size and current resolution.
##
## @param[in] monitor The monitor to query.
## @param[out] xscale Where to store the x-axis content scale, or NULL.
## @param[out] yscale Where to store the y-axis content scale, or NULL.
##
## @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
## GLFW_PLATFORM_ERROR.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa @ref monitor_scale
## @sa @ref glfwGetWindowContentScale
##
## @since Added in version 3.3.
##
## @ingroup monitor
## ```
proc getMonitorName*(monitor: ptr Monitor): cstring {.importc: "glfwGetMonitorName",
cdecl.}
## ```
## ! @brief Returns the name of the specified monitor.
##
## This function returns a human-readable name, encoded as UTF-8, of the
## specified monitor. The name typically reflects the make and model of the
## monitor and is not guaranteed to be unique among the connected monitors.
##
## @param[in] monitor The monitor to query.
## @return The UTF-8 encoded name of the monitor, or NULL if an
## [error](@ref error_handling) occurred.
##
## @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
##
## @pointer_lifetime The returned string is allocated and freed by GLFW. You
## should not free it yourself. It is valid until the specified monitor is
## disconnected or the library is terminated.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa @ref monitor_properties
##
## @since Added in version 3.0.
##
## @ingroup monitor
## ```
proc setMonitorUserPointer*(monitor: ptr Monitor; pointer: pointer) {.
importc: "glfwSetMonitorUserPointer", cdecl.}
## ```
## ! @brief Sets the user pointer of the specified monitor.
##
## This function sets the user-defined pointer of the specified monitor. The
## current value is retained until the monitor is disconnected. The initial
## value is NULL.
##
## This function may be called from the monitor callback, even for a monitor
## that is being disconnected.
##
## @param[in] monitor The monitor whose pointer to set.
## @param[in] pointer The new value.
##
## @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
##
## @thread_safety This function may be called from any thread. Access is not
## synchronized.
##
## @sa @ref monitor_userptr
## @sa @ref glfwGetMonitorUserPointer
##
## @since Added in version 3.3.
##
## @ingroup monitor
## ```
proc getMonitorUserPointer*(monitor: ptr Monitor): pointer {.
importc: "glfwGetMonitorUserPointer", cdecl.}
## ```
## ! @brief Returns the user pointer of the specified monitor.
##
## This function returns the current value of the user-defined pointer of the
## specified monitor. The initial value is NULL.
##
## This function may be called from the monitor callback, even for a monitor
## that is being disconnected.
##
## @param[in] monitor The monitor whose pointer to return.
##
## @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
##
## @thread_safety This function may be called from any thread. Access is not
## synchronized.
##
## @sa @ref monitor_userptr
## @sa @ref glfwSetMonitorUserPointer
##
## @since Added in version 3.3.
##
## @ingroup monitor
## ```
proc setMonitorCallback*(callback: Monitorfun): Monitorfun {.
importc: "glfwSetMonitorCallback", cdecl.}
## ```
## ! @brief Sets the monitor configuration callback.
##
## This function sets the monitor configuration callback, or removes the
## currently set callback. This is called when a monitor is connected to or
## disconnected from the system.
##
## @param[in] callback The new callback, or NULL to remove the currently set
## callback.
## @return The previously set callback, or NULL if no callback was set or the
## library had not been [initialized](@ref intro_init).
##
## @callback_signature
## @code
## void function_name(GLFWmonitor* monitor, int event)
## @endcode
## For more information about the callback parameters, see the
## [function pointer type](@ref GLFWmonitorfun).
##
## @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
##
## @thread_safety This function must only be called from the main thread.
##
## @sa @ref monitor_event
##
## @since Added in version 3.0.
##
## @ingroup monitor
## ```
proc getVideoModes*(monitor: ptr Monitor; count: ptr cint): ptr Vidmode {.
importc: "glfwGetVideoModes", cdecl.}
## ```